Commit Graph

50 Commits

Author SHA1 Message Date
Cherser-s 65dfabc430 sni: fix passing relative coordinates to dbus methods
Doesn't correctly handle the case with both margin and width/height being set at the same time.
2023-08-25 20:37:16 +03:00
Jan Palus c8237437d2
Explicitly cast ustring to string when passing to fmt
don't rely on implicit conversion which is no longer present in fmt
10.1.0

Fixes #2403
2023-08-15 20:57:07 +02:00
André Aparício a1cd0acac5 Fix random segfault on GTK icon functions
The segfaults were happening on GTK icon theme functions, which are
called via the C++ interface functions such as Gtk::IconTheme::has_icon.

There are multiple modules and threads using this functions on the default
icon theme by calling Gtk::IconTheme::get_default(), which returns the same
object for all callers, and was causing concurrent access to the same internal
data structures on the GTK lib. Even a seemingly read-only function such as
has_icon can cause writes due to the internal icon cache being updated.

To avoid this issues, a program wide global mutex must be used to ensure
a single thread is accessing the default icon theme instance.

This commit implements wrappers for the existing IconTheme function calls,
ensuring the global lock is held while calling the underling GTK functions.
2023-07-03 22:32:24 +01:00
asas1asas200 4a929240df style(lint): fix some files lint 2022-08-31 15:51:50 +08:00
akliuxingyuan 0d27949f0a scale icons for HiDPI monitor 2022-08-30 23:13:38 +08:00
Alex bcee4e15d3 fix: lint files 2022-08-18 15:22:25 +02:00
Marvin Dostal 95b5348c24 sni: change missing icon in theme logging from info to trace 2022-08-03 17:34:34 +02:00
Marvin Dostal 04d66de866 sni: remove unnecesary parameter 2022-07-17 22:20:24 +02:00
Marvin Dostal 699f732146 sni: Remove unnecessary getIconByName call 2022-07-17 22:15:14 +02:00
Marvin Dostal f437bf96e3 sni: Prefer system icons over pixmap 2022-07-17 22:15:12 +02:00
Marvin Dostal fc9a390977 sni: Use the given pixmap even if there is a name given 2022-07-17 22:14:57 +02:00
Alex f2fcadbf62 refactor: lint 2022-04-06 08:37:19 +02:00
Alex Maystrenko d4da04a750 move Glib ustring format helper to utils
this formatter is useful for other modules
which want to print Glib exceptions messages
2022-02-05 21:26:48 +01:00
Aleksei Bavshin fbedc3d133
fix(tray): fix visibility of Passive items
`show_all` call from `Tray::update` attempts to walk the widget tree and
make every widget visible. Since we control individual tray item
visibility based on `Status` SNI property, we don't want that to happen.

Modify `Tray::update` to control the visibility of a whole tray module
only and ensure that the children of `Item` are still visible when
necessary.
2021-10-02 00:08:45 -07:00
Michael Swiger 4f76c9bd43 Only use g_memdup2 for glib >= 2.68 2021-08-29 13:11:04 -07:00
Michael Swiger cb49650ea4 Use g_memdup2 instead of g_memdup
This fixes a compile warning.

See: https://discourse.gnome.org/t/port-your-module-from-g-memdup-to-g-memdup2-now/5538
2021-08-22 14:46:40 -07:00
Michael Swiger 2d80d31527 Fix tray icon scaling on multi-display setups 2021-08-16 23:33:29 -07:00
Michael Swiger 4f6a9b1bc2 Fix incorrect tray icon scaling 2021-07-31 18:01:31 -07:00
Aleksei Bavshin a5fe6f40b8
feat(tray): handle Status property
On the `Passive` value of `Status` tray items would be hidden unless
`show-passive-items` is set to true.
On the `NeedsAttention` value of `Status` tray items will have a
`.needs-attention` CSS class.
2021-07-22 08:04:06 -07:00
Aleksei Bavshin 245f7f4b11
feat(tray): handle scroll events 2021-07-22 08:04:05 -07:00
Aleksei Bavshin 1418f96e46
feat(tray): fallback to Title for items without ToolTip 2021-07-22 08:04:04 -07:00
Aleksei Bavshin 84a8f79bbe
feat(tray): implement tooltips (text only) for tray items 2021-07-22 08:04:03 -07:00
Aleksei Bavshin 4b6253e810
refactor(tray): infer changed properties from signal name
Comparing two GVariants is too expensive; let's collect the set of
properties updated by each signal and apply them unconditionally.
2021-07-22 08:04:00 -07:00
Aleksei Bavshin 929fc16994
fix(tray): ignore unused WindowId property 2021-07-22 08:01:25 -07:00
Michael Swiger 1440ed29d4 Fix blurry tray icons for HiDPI displays 2021-07-20 22:29:34 -07:00
Jan Beich c844d7ac2e tray: drop std::filesystem dependency 2020-05-19 10:37:27 +00:00
Louis des Landes 569f40de9b
Keep aspect ratio when scaling tray icons. 2020-01-09 17:27:10 +10:30
Aleksei Bavshin 01ad3d96d8
fix(tray): pre-create dbusmenu for tray items
It seems that dbusmenu is not ready to display menu immediately and
needs some time to sync data via DBus.
Fixes LIBDBUSMENU-GLIB-CRITICAL: dbusmenu_menuitem_send_about_to_show:
assertion 'DBUSMENU_IS_MENUITEM(mi)' failed.
Also fixes initial render of the menu with layer shell popups support patch.
2019-08-27 00:34:00 -07:00
Aleksei Bavshin 642fd48af1
fix(tray): restore Activate support for compliant SNI implementation
Set ItemIsMenu to true by default because libappindicator supports
neither ItemIsMenu nor Activate method and compiant SNI implementations
are expected to reset the flag during initial property fetch.
To be revisited if anyone finds the implementation that has Activate
but does not set ItemIsMenu.
2019-08-27 00:33:59 -07:00
Alex ec75be0bc3 fix(Tray): click behaviour 2019-06-11 17:53:16 +02:00
Aleksei Bavshin 50bfe78aed refactor(tray): improve error handling and add debug logs 2019-05-20 08:00:07 -07:00
Aleksei Bavshin afd291a566 fix(tray): Fix glib assertion when old property value is missing
xembedsniproxy sets WindowId as 'i' instead of 'u' and DBus::Proxy
ignores incorrectly typed value.
2019-05-20 07:16:08 -07:00
Aleksei Bavshin 316a9be656 refactor(tray): Use spdlog for SNI::Item error messages 2019-05-20 07:16:08 -07:00
Lucas Lazare 51be97f9aa Adding spdlog 2019-05-18 19:44:45 -04:00
Alex d2d9db23b5 fix: uninitialized bool 2019-05-17 14:23:52 +02:00
Alex 311c34ecbc feat(Bar): handle widget size changes 2019-04-24 12:37:24 +02:00
Alex 29d8f365f8 refactor(Tray): proper lookup in the default theme 2019-04-19 17:30:40 +02:00
Alex 6ed8f94dab refactor: format code 2019-04-18 17:52:00 +02:00
Alex 6d6df4be00 refactor(sni-item): better way to search in default theme 2019-04-17 22:15:18 +02:00
Alex aeaa1927d9 fix: add default_paths on init 2019-04-17 19:23:52 +02:00
Alex 346ec68578 refactor: format tray && partial fix for #235 2019-04-17 14:19:04 +02:00
Alex 3273ee8b42 fix(Tray): icon size lookup 2019-04-15 12:10:37 +02:00
Alex 57c99dc526 refactor(Tray): also search in default theme 2019-04-11 15:28:38 +02:00
Alex 78067462be fix(Tray): icons update 2019-04-11 15:20:39 +02:00
Aleksei Bavshin 5a2b5624dc feat(tray): process tray icon update signals 2019-03-29 18:40:28 -07:00
Aleksei Bavshin 82fcee33b3 refactor(tray): use Gio::DBus bindings in SNI Item class 2019-03-29 18:28:29 -07:00
Aleksei Bavshin 842e8501f9 fix(tray): free icon data on pixbuf update 2019-03-28 10:52:25 -07:00
Alex aeec80f375 fix(Tray): big icon 2019-02-07 13:34:30 +01:00
Alexis 0b1b0eb1a7 feat(tray): multiple hosts 2018-11-22 16:20:49 +01:00
Alexis ba79b4d397 refactor(tray): cleanup and fixes 2018-11-22 15:47:23 +01:00
Renamed from src/modules/sni/sni.cpp (Browse further)