fix(wm): lars' secret sauce for min-width apps

This commit applies a technique shared by Lars from GlazeWM and first
noticed by J.SH on Discord to add the SWP_NOSENDCHANGING flag when
positioning windows to overcome any hard-coded minimum width
restrictions an application might have.
This commit is contained in:
LGUG2Z
2023-07-09 19:26:40 -07:00
parent fc7198823b
commit f7dccfe0f5
3 changed files with 9 additions and 4 deletions
+4 -2
View File
@@ -703,10 +703,12 @@ impl WindowManager {
if let Layout::Custom(ref mut custom) = rule.1 { if let Layout::Custom(ref mut custom) = rule.1 {
match sizing { match sizing {
Sizing::Increase => { Sizing::Increase => {
custom.set_primary_width_percentage(percentage + 5.0); custom
.set_primary_width_percentage(percentage + 5.0);
} }
Sizing::Decrease => { Sizing::Decrease => {
custom.set_primary_width_percentage(percentage - 5.0); custom
.set_primary_width_percentage(percentage - 5.0);
} }
} }
} }
+4 -1
View File
@@ -303,7 +303,10 @@ impl WindowsApi {
} }
pub fn position_window(hwnd: HWND, layout: &Rect, top: bool) -> Result<()> { pub fn position_window(hwnd: HWND, layout: &Rect, top: bool) -> Result<()> {
let flags = SetWindowPosition::NO_ACTIVATE; let flags = SetWindowPosition::NO_ACTIVATE
| SetWindowPosition::NO_SEND_CHANGING
| SetWindowPosition::NO_COPY_BITS
| SetWindowPosition::FRAME_CHANGED;
let position = if top { HWND_TOPMOST } else { HWND_BOTTOM }; let position = if top { HWND_TOPMOST } else { HWND_BOTTOM };
Self::set_window_pos(hwnd, layout, position, flags.bits()) Self::set_window_pos(hwnd, layout, position, flags.bits())