Skip to content

fix: stop sketcher status bar from resizing the window - #387

Open
knipknap wants to merge 1 commit into
mainfrom
fix/385-sketcher-window-resize
Open

fix: stop sketcher status bar from resizing the window#387
knipknap wants to merge 1 commit into
mainfrom
fix/385-sketcher-window-resize

Conversation

@knipknap

@knipknap knipknap commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

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 via preview_changed and on edit_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 GtkPaned divider position, which is why the left panel changed size too.

Fix

Host the shortcut row of the shared StatusBar in a Gtk.ScrolledWindow with an EXTERNAL horizontal policy:

  • The bar no longer propagates the content width into the window's size request, so changing entries can no longer resize the window.
  • The height still follows the content (single row, unchanged appearance).
  • If the bar is ever too narrow, entries are clipped instead of widening the window.

Testing

  • Added 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.
  • Ran the shared UI tests: 13 pre-existing tests still pass; the pre-existing environment-related import errors (bezier/raygeo) are unchanged.
  • ruff, flake8 and pyflakes pass on the full tree.

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.
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.

Windows "jumps" when editing shape

1 participant