diff --git a/.changes/multi-monitor-window-state.md b/.changes/multi-monitor-window-state.md new file mode 100644 index 0000000000..f3807da9e8 --- /dev/null +++ b/.changes/multi-monitor-window-state.md @@ -0,0 +1,6 @@ +--- +window-state: patch +window-state-js: patch +--- + +Fix window size gets bigger/smaller on secondary monitor with a different scaling than the primary one diff --git a/plugins/window-state/src/lib.rs b/plugins/window-state/src/lib.rs index a5cf58478c..50345b64aa 100644 --- a/plugins/window-state/src/lib.rs +++ b/plugins/window-state/src/lib.rs @@ -184,13 +184,6 @@ impl WindowExt for Window { self.set_decorations(state.decorated)?; } - if flags.contains(StateFlags::SIZE) { - self.set_size(PhysicalSize { - width: state.width, - height: state.height, - })?; - } - if flags.contains(StateFlags::POSITION) { let position = (state.x, state.y).into(); let size = (state.width, state.height).into(); @@ -214,6 +207,13 @@ impl WindowExt for Window { } } + if flags.contains(StateFlags::SIZE) { + self.set_size(PhysicalSize { + width: state.width, + height: state.height, + })?; + } + if flags.contains(StateFlags::MAXIMIZED) && state.maximized { self.maximize()?; }