wf-shell icon indicating copy to clipboard operation
wf-shell copied to clipboard

Ported to GTK4

Open trigg opened this issue 10 months ago • 0 comments

Extensive changes to bring the code base up to working on GTK4.

Dependencies:

  • gtkmm 3 > 4 (same for gdk, glib so on)
  • gtk-layer-shell > gtk4-layer-shell
  • libdbusmenu-gtk3 > libdbusmenu-glib

Material changes overview:

  • The menus on system tray icons had to be rewritten from scratch as the supporting library appears to not be available for gtk4
    • Menu & items are regenerated when changed over the dbus wire
    • Icons appear to be getting ignored by Popover Menu. From all my reading this is intentional on GTK4s part
    • Dbus library answers that there are no tickbox or radio button variants despite testing intentionally for them. These menu items function correctly but don't display the radio/checkmark
    • I am convinced there are some memory leaks here and am squashing them as I find them
  • The entirety of the event handling side of GTK has been rewritten and redefined.
    • System tray icons, Window list windows and application menu context buttons are all now MenuButton allowing us to connect menu options to them
    • EventBox no longer exists, so event callbacks are connected in directly to widgets
    • Volume control slider popup stops scroll wheel & swipe events on button, so the popup no longer shows when volume changes
  • Size allocation events, Redraw events, Scale change events have been removed from gtk4 and considered "the wrong way to do things" for most uses
    • Widgets should not base their internal logic on position & size
    • Scale is left to GTK4 to account for in all cases
    • Icon size should be changed with CSS rules only
    • All icon_size options have been fed into CSS Styles that are generated & updated from config
  • Output management and hotplugging is managed differently and worth double and triple checking by people with less boring monitor layouts than mine
  • Font override is removed. The only way I can see to do this now is to set it via CSS. While feeding the data in from the config is possible the way people write this options currently won't work in GTK4
    • Size needs to be in pixels or css sizes like : 17px 1.2em 0.9rem

While I was in the area:

  • Implemented CSS directory loading for dock and background
  • Added some hover, open window & close window animations to default css
  • Added a dock window-close-animation option as it has adverse effects if you enable it but don't update your default css
  • Realised we'd be better served with a Gtk Revealer... but that's a bigger task that I'll do in a separate attempt.
  • Reworked Background, needs sanity check as I'm sure it'll leak memory

I'm sure there's more, and will edit this as and when possible.

I look forward to uncrustify.

trigg avatar Feb 16 '25 14:02 trigg