mirror of
https://github.com/reactos/reactos.git
synced 2024-06-29 01:12:06 +00:00
[Win32k|User32]
- Clarify the meaning and the use of 0, 1 and 2 for user window regions, wine never did. Noticing patches not corresponding in correctness and understanding, leaving potential crashes in the DCE code, which depend on these types. - Patch based on Rafal Harabien patch, fixes wine msg SetWindowRgn test, see also bug 5959. svn path=/trunk/; revision=50933
This commit is contained in:
parent
efd76a4a9c
commit
823118e08a
|
@ -1189,7 +1189,7 @@ User32DefWindowProc(HWND hWnd,
|
|||
case WM_SYSCOLORCHANGE:
|
||||
{
|
||||
/* force to redraw non-client area */
|
||||
DefWndNCPaint(hWnd, (HRGN)1, -1);
|
||||
DefWndNCPaint(hWnd, HRGN_WINDOW, -1);
|
||||
/* Use InvalidateRect to redraw client area, enable
|
||||
* erase to redraw all subcontrols otherwise send the
|
||||
* WM_SYSCOLORCHANGE to child windows/controls is required
|
||||
|
@ -1966,7 +1966,7 @@ RealDefWindowProcA(HWND hWnd,
|
|||
|
||||
if ((GetWindowLongPtrW(hWnd, GWL_STYLE) & WS_CAPTION) == WS_CAPTION)
|
||||
{
|
||||
DefWndNCPaint(hWnd, (HRGN)1, -1);
|
||||
DefWndNCPaint(hWnd, HRGN_WINDOW, -1);
|
||||
}
|
||||
Result = 1;
|
||||
break;
|
||||
|
@ -2112,7 +2112,7 @@ RealDefWindowProcW(HWND hWnd,
|
|||
|
||||
if ((GetWindowLongPtrW(hWnd, GWL_STYLE) & WS_CAPTION) == WS_CAPTION)
|
||||
{
|
||||
DefWndNCPaint(hWnd, (HRGN)1, -1);
|
||||
DefWndNCPaint(hWnd, HRGN_WINDOW, -1);
|
||||
}
|
||||
Result = 1;
|
||||
break;
|
||||
|
|
|
@ -489,7 +489,8 @@ DefWndNCPaint(HWND hWnd, HRGN hRgn, BOOL Active)
|
|||
}
|
||||
|
||||
ReleaseDC(hWnd, hDC);
|
||||
DeleteObject(hRgn); // We use DCX_KEEPCLIPRGN
|
||||
if (hRgn != HRGN_WINDOW)
|
||||
DeleteObject(hRgn); // We use DCX_KEEPCLIPRGN
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -650,7 +651,7 @@ DefWndNCCalcSize(HWND hWnd, BOOL CalcSizeStruct, RECT *Rect)
|
|||
LRESULT
|
||||
DefWndNCActivate(HWND hWnd, WPARAM wParam)
|
||||
{
|
||||
DefWndNCPaint(hWnd, (HRGN)1, wParam);
|
||||
DefWndNCPaint(hWnd, HRGN_WINDOW, wParam);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1727,7 +1727,7 @@ SetWindowTextA(HWND hWnd,
|
|||
|
||||
if ((GetWindowLongPtrW(hWnd, GWL_STYLE) & WS_CAPTION) == WS_CAPTION)
|
||||
{
|
||||
DefWndNCPaint(hWnd, (HRGN)1, -1);
|
||||
DefWndNCPaint(hWnd, HRGN_WINDOW, -1);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1757,7 +1757,7 @@ SetWindowTextW(HWND hWnd,
|
|||
|
||||
if ((GetWindowLongPtrW(hWnd, GWL_STYLE) & WS_CAPTION) == WS_CAPTION)
|
||||
{
|
||||
DefWndNCPaint(hWnd, (HRGN)1, -1);
|
||||
DefWndNCPaint(hWnd, HRGN_WINDOW, -1);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -231,6 +231,10 @@ C_ASSERT(sizeof(CLIENTINFO) <= sizeof(((PTEB)0)->Win32ClientInfo));
|
|||
|
||||
#define GetWin32ClientInfo() ((PCLIENTINFO)(NtCurrentTeb()->Win32ClientInfo))
|
||||
|
||||
#define HRGN_NULL ( (HRGN) 0) // NULL empty region
|
||||
#define HRGN_WINDOW ( (HRGN) 1) // region from window rcWindow
|
||||
#define HRGN_MONITOR ( (HRGN) 2) // region from monitor region.
|
||||
|
||||
/* Menu Item fType. */
|
||||
#define MFT_RTOL 0x6000
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ IntGetNCUpdateRgn(PWND Window, BOOL Validate)
|
|||
UINT RgnType;
|
||||
|
||||
if (Window->hrgnUpdate != NULL &&
|
||||
Window->hrgnUpdate != (HRGN)1)
|
||||
Window->hrgnUpdate != HRGN_WINDOW)
|
||||
{
|
||||
hRgnNonClient = IntCalcWindowRgn(Window, FALSE);
|
||||
|
||||
|
@ -151,14 +151,14 @@ IntGetNCUpdateRgn(PWND Window, BOOL Validate)
|
|||
*/
|
||||
if (hRgnNonClient == NULL)
|
||||
{
|
||||
return (HRGN)1;
|
||||
return HRGN_WINDOW;
|
||||
}
|
||||
|
||||
hRgnWindow = IntCalcWindowRgn(Window, TRUE);
|
||||
if (hRgnWindow == NULL)
|
||||
{
|
||||
REGION_FreeRgnByHandle(hRgnNonClient);
|
||||
return (HRGN)1;
|
||||
return HRGN_WINDOW;
|
||||
}
|
||||
|
||||
RgnType = NtGdiCombineRgn(hRgnNonClient, hRgnNonClient,
|
||||
|
@ -167,7 +167,7 @@ IntGetNCUpdateRgn(PWND Window, BOOL Validate)
|
|||
{
|
||||
REGION_FreeRgnByHandle(hRgnWindow);
|
||||
REGION_FreeRgnByHandle(hRgnNonClient);
|
||||
return (HRGN)1;
|
||||
return HRGN_WINDOW;
|
||||
}
|
||||
else if (RgnType == NULLREGION)
|
||||
{
|
||||
|
@ -1049,7 +1049,7 @@ NtUserGetUpdateRect(HWND hWnd, LPRECT UnsafeRect, BOOL bErase)
|
|||
else
|
||||
{
|
||||
/* Get the update region bounding box. */
|
||||
if (Window->hrgnUpdate == (HRGN)1)
|
||||
if (Window->hrgnUpdate == HRGN_WINDOW)
|
||||
{
|
||||
Rect = Window->rcClient;
|
||||
}
|
||||
|
|
|
@ -551,7 +551,7 @@ UserGetDCEx(PWND Wnd OPTIONAL, HANDLE ClipRegion, ULONG Flags)
|
|||
ClipRegion = Wnd->hrgnUpdate;
|
||||
}
|
||||
|
||||
if (ClipRegion == (HRGN) 1)
|
||||
if (ClipRegion == HRGN_WINDOW)
|
||||
{
|
||||
if (!(Flags & DCX_WINDOW))
|
||||
{
|
||||
|
|
|
@ -4017,6 +4017,7 @@ CLEANUP:
|
|||
}
|
||||
|
||||
|
||||
// This should be in user32!
|
||||
INT FASTCALL
|
||||
IntGetWindowRgn(PWND Window, HRGN hRgn)
|
||||
{
|
||||
|
@ -4055,6 +4056,7 @@ IntGetWindowRgn(PWND Window, HRGN hRgn)
|
|||
return Ret;
|
||||
}
|
||||
|
||||
// This should be in user32!
|
||||
INT FASTCALL
|
||||
IntGetWindowRgnBox(PWND Window, RECTL *Rect)
|
||||
{
|
||||
|
@ -4104,6 +4106,8 @@ NtUserSetWindowRgn(
|
|||
{
|
||||
HRGN hrgnCopy;
|
||||
PWND Window;
|
||||
INT flags = (SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE);
|
||||
BOOLEAN Ret = FALSE;
|
||||
DECLARE_RETURN(INT);
|
||||
|
||||
DPRINT("Enter NtUserSetWindowRgn\n");
|
||||
|
@ -4119,32 +4123,31 @@ NtUserSetWindowRgn(
|
|||
if (GDIOBJ_ValidateHandle(hRgn, GDI_OBJECT_TYPE_REGION))
|
||||
{
|
||||
hrgnCopy = IntSysCreateRectRgn(0, 0, 0, 0);
|
||||
|
||||
/* Set public ownership */
|
||||
IntGdiSetRegionOwner(hrgnCopy, GDI_OBJ_HMGR_PUBLIC);
|
||||
|
||||
NtGdiCombineRgn(hrgnCopy, hRgn, 0, RGN_COPY);
|
||||
}
|
||||
else
|
||||
RETURN( 0);
|
||||
}
|
||||
else
|
||||
hrgnCopy = (HRGN) 1;
|
||||
{
|
||||
hrgnCopy = IntSysCreateRectRgnIndirect(&Window->rcWindow); //HRGN_WINDOW;
|
||||
}
|
||||
|
||||
if (Window->hrgnClip)
|
||||
{
|
||||
/* Delete no longer needed region handle */
|
||||
GreDeleteObject(Window->hrgnClip);
|
||||
}
|
||||
|
||||
Window->hrgnClip = hrgnCopy;
|
||||
|
||||
/* FIXME - send WM_WINDOWPOSCHANGING and WM_WINDOWPOSCHANGED messages to the window */
|
||||
Ret = co_WinPosSetWindowPos(Window, HWND_TOP, 0, 0, 0, 0, bRedraw ? flags : (flags|SWP_NOREDRAW) );
|
||||
|
||||
if(bRedraw)
|
||||
{
|
||||
USER_REFERENCE_ENTRY Ref;
|
||||
UserRefObjectCo(Window, &Ref);
|
||||
co_UserRedrawWindow(Window, NULL, NULL, RDW_INVALIDATE);
|
||||
UserDerefObjectCo(Window);
|
||||
}
|
||||
|
||||
RETURN( (INT)hRgn);
|
||||
RETURN( (INT)Ret);
|
||||
|
||||
CLEANUP:
|
||||
DPRINT("Leave NtUserSetWindowRgn, ret=%i\n",_ret_);
|
||||
|
|
|
@ -1120,7 +1120,7 @@ co_WinPosSetWindowPos(
|
|||
Window->style |= WS_VISIBLE;
|
||||
}
|
||||
|
||||
if (Window->hrgnUpdate != NULL && Window->hrgnUpdate != (HRGN)1)
|
||||
if (Window->hrgnUpdate != NULL && Window->hrgnUpdate != HRGN_WINDOW)
|
||||
{
|
||||
NtGdiOffsetRgn(Window->hrgnUpdate,
|
||||
NewWindowRect.left - OldWindowRect.left,
|
||||
|
|
Loading…
Reference in a new issue