Skip to content

renderer: don't reload theme for unchanged size - #197

Merged
kou merged 1 commit into
rabbit-shocker:mainfrom
matz:fix-reload-on-unchanged-size
Oct 17, 2026
Merged

kou merged 1 commit into
rabbit-shocker:mainfrom
matz:fix-reload-on-unchanged-size

Conversation

@matz

@matz matz commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

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 (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 in Theme::Applier for more than a minute. Tracing update_size() and Canvas#apply_theme showed update_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 in Frame already doesn't call update_size() for an unchanged size. (Adding the same check to the GTK 3 configure-event handler in Frame would 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.rb gives the same result as main (one failure in BlockDiagTest because blockdiag isn't installed here).

🤖 Generated with Claude Code

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>
@matz
matz deployed to release October 17, 2026 22:30 — with GitHub Actions Active
@kou
kou merged commit a89b8ba into rabbit-shocker:main Oct 17, 2026
6 checks passed
@kou

kou commented Oct 17, 2026

Copy link
Copy Markdown
Member

Good catch.

This branch was successfully deployed

1 active deployment
release — 43091a03 Deployed Oct 17, 2026 by matz via RubyGems #218
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.

2 participants