[0.4.9][WIN32SS] Fix maximized window positioning and 2 addendum commits

Fix CORE-5177 "TaskMgr and ProcExp positioning when maximized."

which regressed by SVN r47264 == git
0ac861114e

fix cherry picked from commit 0.4.12-dev-954-g
1f619b2781
-----------
but since above commit did introduce a new regression CORE-15893
symptom "Most of maximized windows have extra row of pixels around"
I had to port back those 2 follow-up-master-commits as well:
0.4.12-dev-956-g
197c4f875d3332dbc4656a6360e3c7e9def2ed5
and 0.4.13-dev-397-g
3cc50cedaf

Side-note: This results in the same final state as 0.4.12rls0, because
I ported 0.4.13-dev-397-g3cc50ce into 0.4.12-RC-29-gab7f77a earlier.
This commit is contained in:
Joachim Henze 2020-11-09 19:41:30 +01:00
parent 913c11aaa7
commit 64ccae4b26
2 changed files with 62 additions and 46 deletions

View file

@ -890,14 +890,14 @@ UserGetWindowBorders(DWORD Style, DWORD ExStyle, SIZE *Size, BOOL WithClient)
if (UserHasWindowEdge(Style, ExStyle)) if (UserHasWindowEdge(Style, ExStyle))
Border += 2; Border += 2;
else if (ExStyle & WS_EX_STATICEDGE) else if ((ExStyle & (WS_EX_STATICEDGE|WS_EX_DLGMODALFRAME)) == WS_EX_STATICEDGE)
Border += 1; Border += 1; /* for the outer frame always present */
if ((ExStyle & WS_EX_CLIENTEDGE) && WithClient) if ((ExStyle & WS_EX_CLIENTEDGE) && WithClient)
Border += 2; Border += 2;
if (Style & WS_CAPTION || ExStyle & WS_EX_DLGMODALFRAME) if (Style & WS_CAPTION || ExStyle & WS_EX_DLGMODALFRAME)
Border ++; Border ++; /* The other border */
Size->cx = Size->cy = Border; Size->cx = Size->cy = Border;
if ((Style & WS_THICKFRAME) && !(Style & WS_MINIMIZE)) if ((Style & WS_THICKFRAME) && !(Style & WS_MINIMIZE)) /* The resize border */
{ {
Size->cx += UserGetSystemMetrics(SM_CXFRAME) - UserGetSystemMetrics(SM_CXDLGFRAME); Size->cx += UserGetSystemMetrics(SM_CXFRAME) - UserGetSystemMetrics(SM_CXDLGFRAME);
Size->cy += UserGetSystemMetrics(SM_CYFRAME) - UserGetSystemMetrics(SM_CYDLGFRAME); Size->cy += UserGetSystemMetrics(SM_CYFRAME) - UserGetSystemMetrics(SM_CYDLGFRAME);
@ -906,32 +906,27 @@ UserGetWindowBorders(DWORD Style, DWORD ExStyle, SIZE *Size, BOOL WithClient)
Size->cy *= UserGetSystemMetrics(SM_CYBORDER); Size->cy *= UserGetSystemMetrics(SM_CYBORDER);
} }
BOOL WINAPI //
UserAdjustWindowRectEx(LPRECT lpRect, // Fix CORE-5177
DWORD dwStyle, // See winetests:user32:win.c:wine_AdjustWindowRectEx,
BOOL bMenu, // Simplified version.
DWORD dwExStyle) //
DWORD IntGetWindowBorders(DWORD Style, DWORD ExStyle)
{ {
SIZE BorderSize; DWORD adjust = 0;
if (bMenu) if ( ExStyle & WS_EX_WINDOWEDGE ) // 1st
{ adjust = 2; /* outer */
lpRect->top -= UserGetSystemMetrics(SM_CYMENU); else if ( ExStyle & WS_EX_STATICEDGE ) // 2nd
} adjust = 1; /* for the outer frame always present */
if ((dwStyle & WS_CAPTION) == WS_CAPTION)
{
if (dwExStyle & WS_EX_TOOLWINDOW)
lpRect->top -= UserGetSystemMetrics(SM_CYSMCAPTION);
else
lpRect->top -= UserGetSystemMetrics(SM_CYCAPTION);
}
UserGetWindowBorders(dwStyle, dwExStyle, &BorderSize, TRUE);
RECTL_vInflateRect(
lpRect,
BorderSize.cx,
BorderSize.cy);
return TRUE; if (ExStyle & WS_EX_CLIENTEDGE)
adjust += 2;
if ( Style & WS_CAPTION || ExStyle & WS_EX_DLGMODALFRAME )
adjust++; /* The other border */
return adjust;
} }
UINT FASTCALL UINT FASTCALL
@ -945,6 +940,7 @@ co_WinPosGetMinMaxInfo(PWND Window, POINT* MaxSize, POINT* MaxPos,
LONG adjustedStyle; LONG adjustedStyle;
LONG exstyle = Window->ExStyle; LONG exstyle = Window->ExStyle;
RECT rc; RECT rc;
DWORD adjust;
ASSERT_REFS_CO(Window); ASSERT_REFS_CO(Window);
@ -959,9 +955,26 @@ co_WinPosGetMinMaxInfo(PWND Window, POINT* MaxSize, POINT* MaxPos,
else else
adjustedStyle = style; adjustedStyle = style;
if(Window->spwndParent) if (Window->spwndParent)
IntGetClientRect(Window->spwndParent, &rc); IntGetClientRect(Window->spwndParent, &rc);
UserAdjustWindowRectEx(&rc, adjustedStyle, ((style & WS_POPUP) && Window->IDMenu), exstyle);
adjust = IntGetWindowBorders(adjustedStyle, exstyle);
// Handle special case while maximized. CORE-15893
if ((adjustedStyle & WS_THICKFRAME) && !(adjustedStyle & WS_CHILD) && !(adjustedStyle & WS_MINIMIZE))
adjust += 1;
xinc = yinc = adjust;
if ((adjustedStyle & WS_THICKFRAME) && (adjustedStyle & WS_CHILD) && !(adjustedStyle & WS_MINIMIZE))
{
xinc += UserGetSystemMetrics(SM_CXFRAME) - UserGetSystemMetrics(SM_CXDLGFRAME);
yinc += UserGetSystemMetrics(SM_CYFRAME) - UserGetSystemMetrics(SM_CYDLGFRAME);
}
RECTL_vInflateRect( &rc,
xinc * UserGetSystemMetrics(SM_CXBORDER),
yinc * UserGetSystemMetrics(SM_CYBORDER) );
xinc = -rc.left; xinc = -rc.left;
yinc = -rc.top; yinc = -rc.top;
@ -1013,7 +1026,9 @@ co_WinPosGetMinMaxInfo(PWND Window, POINT* MaxSize, POINT* MaxPos,
} }
if (MinMax.ptMaxSize.x >= (monitor->rcMonitor.right - monitor->rcMonitor.left) && if (MinMax.ptMaxSize.x >= (monitor->rcMonitor.right - monitor->rcMonitor.left) &&
MinMax.ptMaxSize.y >= (monitor->rcMonitor.bottom - monitor->rcMonitor.top) ) MinMax.ptMaxSize.y >= (monitor->rcMonitor.bottom - monitor->rcMonitor.top) )
{
Window->state |= WNDS_MAXIMIZESTOMONITOR; Window->state |= WNDS_MAXIMIZESTOMONITOR;
}
else else
Window->state &= ~WNDS_MAXIMIZESTOMONITOR; Window->state &= ~WNDS_MAXIMIZESTOMONITOR;
} }
@ -1033,7 +1048,7 @@ co_WinPosGetMinMaxInfo(PWND Window, POINT* MaxSize, POINT* MaxPos,
if (MaxTrack) if (MaxTrack)
*MaxTrack = MinMax.ptMaxTrackSize; *MaxTrack = MinMax.ptMaxTrackSize;
return 0; // FIXME: What does it return? return 0; // FIXME: What does it return? Wine returns MINMAXINFO.
} }
static static

View file

@ -22,6 +22,7 @@ void mirror_rect( const RECT *window_rect, RECT *rect )
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
#if 0 // Keep legacy code. Moved to Win32k:NtUser:WinPos.c.
#define EMPTYPOINT(pt) ((pt).x == -1 && (pt).y == -1) #define EMPTYPOINT(pt) ((pt).x == -1 && (pt).y == -1)
UINT WINAPI UINT WINAPI
@ -126,9 +127,9 @@ WinPosGetMinMaxInfo(HWND hwnd, POINT* maxSize, POINT* maxPos,
if (minTrack) *minTrack = MinMax.ptMinTrackSize; if (minTrack) *minTrack = MinMax.ptMinTrackSize;
if (maxTrack) *maxTrack = MinMax.ptMaxTrackSize; if (maxTrack) *maxTrack = MinMax.ptMaxTrackSize;
return 0; //FIXME: what does it return? return 0; //FIXME: what does it return? Wine returns MINMAXINFO.
} }
#endif
/* /*
* @implemented * @implemented