Skip to content

Commit

Permalink
fix(wm): add shadow rect to move_window calls
Browse files Browse the repository at this point in the history
This fixes a bug when windows get shunk during the animation
  • Loading branch information
thearturca authored and LGUG2Z committed Jul 4, 2024
1 parent 3de2c6e commit b58620f
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions komorebi/src/windows_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,17 +433,14 @@ impl WindowsApi {
}

pub fn move_window(hwnd: HWND, layout: &Rect, repaint: bool) -> Result<()> {
unsafe {
MoveWindow(
hwnd,
layout.left,
layout.top,
layout.right,
layout.bottom,
repaint,
)
}
.process()
let shadow_rect = Self::shadow_rect(hwnd).unwrap_or_default();
let rect = Rect {
left: layout.left + shadow_rect.left,
top: layout.top + shadow_rect.top,
right: layout.right + shadow_rect.right,
bottom: layout.bottom + shadow_rect.bottom,
};
unsafe { MoveWindow(hwnd, rect.left, rect.top, rect.right, rect.bottom, repaint) }.process()
}

pub fn show_window(hwnd: HWND, command: SHOW_WINDOW_CMD) {
Expand Down

0 comments on commit b58620f

Please sign in to comment.