fix: stop sketcher status bar from resizing the window - #387
Open
knipknap wants to merge 1 commit into
Open
Conversation
The sketcher status bar rebuilds its shortcut entries whenever tool state changes, which happens continuously while dragging elements. Because the entries differ in width between states, the bar's minimum width - and with it the main window's minimum size - changed during drags. GTK enforces the minimum window size, so on macOS the window visibly resized, and the sketcher side panel followed because the Paned divider gets clamped on every window resize. Host the shortcut row in a scrolled window with an EXTERNAL horizontal policy. The bar no longer propagates the content width into the window's size request; if it is too narrow, entries are clipped instead of resizing the window. Height still follows the content.
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.
Fixes #385
Problem
On macOS the window resizes ("jumps") while dragging elements in the sketcher, and the left side panel changes size along with it.
Root cause
The sketcher status bar (
SketchStudio._update_status_bar()) clears and rebuilds its shortcut entries whenever tool state changes - including continuously during drags viapreview_changedand onedit_drag_begin/edit_drag_end. The entry sets differ between idle and dragging (e.g. "Space Pan" / "Shift+Doubleclick Select Connected" vs. "Shift Constrain to Axis" / "Tab Toggle Magnetic Snap"), so the bar's minimum width changes on every state flip.Because the bar is part of the main window's widget hierarchy, its minimum width propagated into the window's minimum size. GTK enforces that minimum, so on macOS the NSWindow was resized whenever it changed. Each window resize also re-clamps the
GtkPaneddivider position, which is why the left panel changed size too.Fix
Host the shortcut row of the shared
StatusBarin aGtk.ScrolledWindowwith anEXTERNALhorizontal policy:Testing
tests/ui_gtk/shared/test_status_bar.py, including a regression test asserting the bar's measured minimum width stays constant regardless of how many/wide entries are added. It fails on the old implementation and passes with the fix.bezier/raygeo) are unchanged.ruff,flake8andpyflakespass on the full tree.