Skip to content

Commit

Permalink
[WIN32K] Prevent infinite recursion
Browse files Browse the repository at this point in the history
  • Loading branch information
tkreuzer committed Dec 12, 2024
1 parent 9382aa2 commit 6d2ab1e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions win32ss/user/ntuser/winpos.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ SelectWindowRgn(PWND Window, HRGN hRgnClip)
/* Delete no longer needed region handle */
IntGdiSetRegionOwner(Window->hrgnClip, GDI_OBJ_HMGR_POWNED);
GreDeleteObject(Window->hrgnClip);
Window->hrgnClip = NULL;
Window->hrgnClip = NULL;
}

if (hRgnClip > HRGN_WINDOW)
Expand Down Expand Up @@ -915,7 +915,7 @@ UserGetWindowBorders(DWORD Style, DWORD ExStyle, SIZE *Size, BOOL WithClient)

//
// Fix CORE-5177
// See winetests:user32:win.c:wine_AdjustWindowRectEx,
// See winetests:user32:win.c:wine_AdjustWindowRectEx,
// Simplified version.
//
DWORD IntGetWindowBorders(DWORD Style, DWORD ExStyle)
Expand Down Expand Up @@ -2256,15 +2256,18 @@ co_WinPosSetWindowPos(
//ERR("WPSWP : set active window\n");
if (!(Window->state & WNDS_BEINGACTIVATED)) // Inside SAW?
{
// Set state flag to prevent recursions.
Window->state |= WNDS_BEINGACTIVATED;
co_IntSetForegroundWindow(Window); // Fixes SW_HIDE issues. Wine win test_SetActiveWindow & test_SetForegroundWindow.
Window->state &= ~WNDS_BEINGACTIVATED;
}
}
}
}

if ( !PosChanged &&
(WinPos.flags & SWP_FRAMECHANGED) &&
!(WinPos.flags & SWP_DEFERERASE) && // Prevent sending WM_SYNCPAINT message.
!(WinPos.flags & SWP_DEFERERASE) && // Prevent sending WM_SYNCPAINT message.
VisAfter )
{
PWND Parent = Window->spwndParent;
Expand Down Expand Up @@ -3915,7 +3918,7 @@ co_IntCalculateSnapPosition(PWND Wnd, UINT Edge, OUT RECT *Pos)
{
case HTTOP: /* Maximized (Calculate RECT snap preview for SC_MOVE) */
height = min(Pos->bottom - Pos->top, maxs.y);
break;
break;
case HTLEFT:
Pos->right = width;
break;
Expand Down

0 comments on commit 6d2ab1e

Please sign in to comment.