Skip to content

Commit

Permalink
Fix bad offset for MDI when restoring a maximized window
Browse files Browse the repository at this point in the history
  • Loading branch information
RamonUnch authored Apr 20, 2024
1 parent 7dc5c37 commit bbad73d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -1793,8 +1793,11 @@ static void RestoreOldWin(const POINT pt, unsigned was_snapped, RECT *ownd)

RECT wnd;
GetWindowRect(state.hwnd, &wnd);
// In case window is Maximized + Rolled get bottom where it needs to be
// So that the window stays fully in the monitor
// Note: a maximized then rolled window does not have the rolled flag.
if (state.origin.maximized)
wnd.bottom = state.origin.mon.bottom;
wnd.bottom = state.origin.mon.bottom + state.mdipt.y;

// Set offset
state.offset.x = state.origin.width * min(pt.x-wnd.left, wnd.right-wnd.left)
Expand All @@ -1804,7 +1807,7 @@ static void RestoreOldWin(const POINT pt, unsigned was_snapped, RECT *ownd)

if (rdata_flag&ROLLED) {
if (state.origin.maximized || was_snapped) {
// if we restore a Rolled Maximized/snapped window...
// if we restore a Rolled + Maximized/snapped window...
state.offset.y = GetSystemMetricsForWin(SM_CYMIN, state.hwnd)/2;
} else {
state.offset.x = pt.x - wnd.left;
Expand Down

0 comments on commit bbad73d

Please sign in to comment.