Repository navigation
renderer: don't reload theme for unchanged size - #197
Merged
Merged
Conversation
With GTK 3, Frame calls the renderer's update_size() on every configure-event, which is also emitted for moves and restacks. DrawingAreaBase#update_size() reloads the theme even when the size isn't changed, and reloading re-applies the theme to all slides. On Hyprland (XWayland), toggling fullscreen or showing the information window kept Rabbit busy re-applying the theme, and the window stopped responding. Display::Base#update_size() already ignores an unchanged size; skip the mask reset and the theme reload in that case too. The GTK 4 code path in Frame already doesn't call update_size() for an unchanged size. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
|
Good catch. |
This branch was successfully deployed
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.
With GTK 3,
Framecalls the renderer'supdate_size()on everyconfigure-event, which is also emitted for moves and restacks.DrawingAreaBase#update_size()reloads the theme even when the size isn't changed, and reloading re-applies the theme to all slides.On Hyprland (Rabbit running on XWayland with
GDK_BACKEND=x11), this made Rabbit stop responding when toggling fullscreen (F11) or showing the information window (Shift+I): the main thread stayed at ~100% CPU inTheme::Applierfor more than a minute. Tracingupdate_size()andCanvas#apply_themeshowedupdate_size(801, 600)called three times in a row at start-up, each followed by a full theme application (~0.9 s each with my slides).Display::Base#update_size()already ignores an unchanged size, so this skips the mask reset and the theme reload in that case too. The GTK 4 code path inFramealready doesn't callupdate_size()for an unchanged size. (Adding the same check to the GTK 3configure-eventhandler inFramewould also work; I put it in the renderer so it covers every caller.)With this change, F11 and Shift+I work again on Hyprland, and start-up applies the theme 3 times instead of 5.
Tested with Rabbit 4.0.1 + this patch, Ruby 4.0.7, Ruby-GNOME 4.3.9, GTK 3.24.52, Hyprland 0.56.2.
test/run-test.rbgives the same result asmain(one failure inBlockDiagTestbecause blockdiag isn't installed here).🤖 Generated with Claude Code