Skip to content

fix(ui): stop resetting window size on every activation - #90

Open
obesity40 wants to merge 1 commit into
jasperdevs:mainfrom
obesity40:fix/window-resize-on-activation
Open

obesity40 wants to merge 1 commit into
jasperdevs:mainfrom
obesity40:fix/window-resize-on-activation

Conversation

@obesity40

Copy link
Copy Markdown

Fixes a bug where resizing a window was undone as soon as it regained focus.

Repro

  1. Open Settings (or any OddSnap window).
  2. Resize it — e.g. drag the bottom edge to make it taller.
  3. Click another application, then click back into OddSnap.
  4. The window snaps back to its previous size.

Cause

UiScale.ApplyToWindow is called on every Activated event so the palette can
be refreshed. Besides setting the theme, it also re-applies the design-time
window bounds from the recorded WindowScaleState, which overwrites whatever
size the user just chose.

Fix

Track the scale that was last applied and return early when it has not changed,
so the bounds are only written when the UI scale itself changes:

if (Math.Abs(state.LastAppliedScale - scale) < 0.001)
    return;

state.LastAppliedScale = scale;

@obesity40
obesity40 force-pushed the fix/window-resize-on-activation branch from 1f4d6ff to 87b7e62 Compare October 11, 2026 11:50

This branch has not been deployed

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

1 participant