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

View File

@@ -703,10 +703,12 @@ impl WindowManager {
if let Layout::Custom(ref mut custom) = rule.1 {
match sizing {
Sizing::Increase => {
custom.set_primary_width_percentage(percentage + 5.0);
custom
.set_primary_width_percentage(percentage + 5.0);
}
Sizing::Decrease => {
custom.set_primary_width_percentage(percentage - 5.0);
custom
.set_primary_width_percentage(percentage - 5.0);
}
}
}

View File

@@ -1040,7 +1040,7 @@ impl WindowManager {
.get_mut(first_idx)
.ok_or_else(|| anyhow!("There is no monitor"))?
.remove_workspaces();
let second_workspaces = self
.monitors_mut()
.get_mut(second_idx)

View File

@@ -303,7 +303,10 @@ impl WindowsApi {
}
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 };
Self::set_window_pos(hwnd, layout, position, flags.bits())