Window = UserGetWindowObject(hWnd);
if (Window)
{
- ASSERT(USER_BODY_TO_HEADER(Window)->RefCount >= 0);
+ ASSERT(Window->head.cLockObj >= 0);
- USER_BODY_TO_HEADER(Window)->RefCount++;
+ Window->head.cLockObj++;
}
return Window;
}
return NULL;
}
- ASSERT(USER_BODY_TO_HEADER(Window)->RefCount >= 0);
+ ASSERT(Window->head.cLockObj >= 0);
return Window;
}
Window->SystemMenu = (HMENU)0;
}
+ DceFreeWindowDCE(Window); /* Always do this to catch orphaned DCs */
#if 0 /* FIXME */
WINPROC_FreeProc(Window->winproc, WIN_PROC_WINDOW);
/* Create the window object. */
Window = (PWINDOW_OBJECT) UserCreateObject( gHandleTable,
+ pti->rpdesk,
(PHANDLE)&hWnd,
otWindow,
sizeof(WINDOW_OBJECT));
}
else if ( Wnd->pcls->style & CS_OWNDC)
{ /* Allocate a DCE for this window. */
- PDCE pDce = DceAllocDCE(Window, DCE_WINDOW_DC);
- if (!Wnd->pcls->pdce)
- Wnd->pcls->pdce = pDce;
+ DceAllocDCE(Window, DCE_WINDOW_DC);
}
Pos.x = x;
Wnd = Window->Wnd;
/* Create a new window region using the window rectangle */
- VisRgn = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->rcWindow);
+ VisRgn = IntSysCreateRectRgnIndirect(&Window->Wnd->rcWindow);
NtGdiOffsetRgn(VisRgn, -Window->Wnd->rcWindow.left, -Window->Wnd->rcWindow.top);
/* if there's a region assigned to the window, combine them both */
if(Window->hrgnClip && !(Wnd->style & WS_MINIMIZE))
else
Ret = ERROR;
- GreDeleteObject(VisRgn);
+ REGION_FreeRgnByHandle(VisRgn);
return Ret;
}
Wnd = Window->Wnd;
/* Create a new window region using the window rectangle */
- VisRgn = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->rcWindow);
+ VisRgn = IntSysCreateRectRgnIndirect(&Window->Wnd->rcWindow);
NtGdiOffsetRgn(VisRgn, -Window->Wnd->rcWindow.left, -Window->Wnd->rcWindow.top);
/* if there's a region assigned to the window, combine them both */
if(Window->hrgnClip && !(Wnd->style & WS_MINIMIZE))
else
Ret = ERROR;
- GreDeleteObject(VisRgn);
+ REGION_FreeRgnByHandle(VisRgn);
return Ret;
}
HRGN hRgn,
BOOL bRedraw)
{
+ HRGN hrgnCopy;
PWINDOW_OBJECT Window;
DECLARE_RETURN(INT);
RETURN( 0);
}
- /* FIXME - Verify if hRgn is a valid handle!!!!
- Propably make this operation thread-safe, but maybe it's not necessary */
+ if (hRgn) // The region will be deleted in user32.
+ {
+ if (GDIOBJ_ValidateHandle(hRgn, GDI_OBJECT_TYPE_REGION))
+ {
+ hrgnCopy = IntSysCreateRectRgn(0, 0, 0, 0);
+ NtGdiCombineRgn(hrgnCopy, hRgn, 0, RGN_COPY);
+ }
+ else
+ RETURN( 0);
+ }
+ else
+ hrgnCopy = (HRGN) 1;
- if(Window->hrgnClip)
+ if (Window->hrgnClip)
{
/* Delete no longer needed region handle */
GreDeleteObject(Window->hrgnClip);
}
- Window->hrgnClip = hRgn;
+ Window->hrgnClip = hrgnCopy;
/* FIXME - send WM_WINDOWPOSCHANGING and WM_WINDOWPOSCHANGED messages to the window */