Skip to content

st-icon: Only reload the icon when something it depends on changed - #14157

Open
SeniorMatt wants to merge 1 commit into
linuxmint:masterfrom
SeniorMatt:st-icon-reload-only-when-needed
Open

SeniorMatt wants to merge 1 commit into
linuxmint:masterfrom
SeniorMatt:st-icon-reload-only-when-needed

Conversation

@SeniorMatt

Copy link
Copy Markdown

On Wayland the pointer was stuttering for me when moving quickly over the menu or opening and closing it a few times in a row. The pointer is moved on Muffin's main thread, and every hover restyled the widgets under it, and StIcon reloaded its icon each time (theme lookup plus a new texture actor), even when nothing about the icon had changed.

This does what GNOME Shell does in StIcon: only reload when the icon-shadow, colors, icon-style, size or scale actually changed, or when a previous update was skipped. Icon theme changes now come from StTextureCache::icon-theme-changed.

Tested on a ThinkPad T14s Gen 2 (Iris Xe), Mint 27, Wayland. The stutter is gone, and icons still follow theme, symbolic color and size changes.

On Wayland the mouse cursor stutters when spamming Super (opening and
closing the menu) or moving the pointer quickly over menus. The pointer
is moved on the compositor's main thread there, so main thread work shows
up as cursor lag, unlike X11 where the X server moves the cursor itself.

st_icon_style_changed() reloaded the icon on every style change. Hover and
other pseudo-class changes restyle every icon below the widget, and each
reload does an icon theme lookup and creates a new texture actor.

Port GNOME Shell's guard: only reload when icon-shadow, the icon colors,
icon-style, the icon size or the scale changed, or when an earlier update
was skipped because the icon had no theme node yet (needs_update).

Icon theme changes used to arrive through the theme context's fake style
change, so connect to StTextureCache::icon-theme-changed directly.

Known limit: a theme that changes the text color on hover still reloads
that button's icon (symbolic recolor).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant