Repository navigation
st-icon: Only reload the icon when something it depends on changed - #14157
Open
SeniorMatt wants to merge 1 commit into
Open
SeniorMatt wants to merge 1 commit into
SeniorMatt wants to merge 1 commit into
Conversation
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.