Skip to content

Commit

Permalink
fix(komorebi): don't scale for DPI, as we're not DPI aware
Browse files Browse the repository at this point in the history
This fixes a regression from 344e6ad
that assumed we were declared DPI aware.
  • Loading branch information
raggi authored and LGUG2Z committed Feb 26, 2024
1 parent e0e3afa commit 0afcf6d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions komorebi/src/windows_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,11 @@ impl WindowsApi {
let mut rect = unsafe { std::mem::zeroed() };

if Self::dwm_get_window_attribute(hwnd, DWMWA_EXTENDED_FRAME_BOUNDS, &mut rect).is_ok() {
let window_scale = unsafe { GetDpiForWindow(hwnd) };
let system_scale = unsafe { GetDpiForSystem() };
Ok(Rect::from(rect).scale(system_scale.try_into()?, window_scale.try_into()?))
// TODO(raggi): once we declare DPI awareness, we will need to scale the rect.
// let window_scale = unsafe { GetDpiForWindow(hwnd) };
// let system_scale = unsafe { GetDpiForSystem() };
// Ok(Rect::from(rect).scale(system_scale.try_into()?, window_scale.try_into()?))
Ok(Rect::from(rect))
} else {
unsafe { GetWindowRect(hwnd, &mut rect) }.process()?;
Ok(Rect::from(rect))
Expand Down

0 comments on commit 0afcf6d

Please sign in to comment.