mirror of
https://github.com/reactos/reactos.git
synced 2024-09-28 21:44:31 +00:00
[Win32k]
- More movement to WND with updates to related files. Removed unused code rewritten others. Review patch. svn path=/trunk/; revision=45051
This commit is contained in:
parent
1f21afc098
commit
66c33fe237
|
@ -16,20 +16,17 @@
|
|||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/* $Id$
|
||||
*
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: GDI WNDOBJ Functions
|
||||
* FILE: subsys/win32k/eng/window.c
|
||||
* FILE: subsystems/win32/win32k/eng/engwindow.c
|
||||
* PROGRAMER: Gregor Anich
|
||||
* REVISION HISTORY:
|
||||
* 16/11/2004: Created
|
||||
*/
|
||||
|
||||
/* TODO: Check how the WNDOBJ implementation should behave with a driver on windows.
|
||||
|
||||
Simple! Use Prop's!
|
||||
*/
|
||||
|
||||
#include <w32k.h>
|
||||
|
@ -37,6 +34,8 @@
|
|||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
INT gcountPWO = 0;
|
||||
|
||||
/*
|
||||
* Calls the WNDOBJCHANGEPROC of the given WNDOBJ
|
||||
*/
|
||||
|
@ -153,44 +152,41 @@ IntEngWindowChanged(
|
|||
PWINDOW_OBJECT Window,
|
||||
FLONG flChanged)
|
||||
{
|
||||
PLIST_ENTRY CurrentEntry;
|
||||
WNDGDI *Current;
|
||||
HWND hWnd;
|
||||
|
||||
ASSERT_IRQL_LESS_OR_EQUAL(PASSIVE_LEVEL);
|
||||
|
||||
CurrentEntry = Window->WndObjListHead.Flink;
|
||||
while (CurrentEntry != &Window->WndObjListHead)
|
||||
{
|
||||
Current = CONTAINING_RECORD(CurrentEntry, WNDGDI, ListEntry);
|
||||
hWnd = Window->hSelf; // pWnd->head.h;
|
||||
Current = (WNDGDI *)IntGetProp(Window, AtomWndObj);
|
||||
|
||||
if (Current->WndObj.pvConsumer != NULL)
|
||||
{
|
||||
/* Update the WNDOBJ */
|
||||
switch (flChanged)
|
||||
{
|
||||
case WOC_RGN_CLIENT:
|
||||
/* Update the clipobj and client rect of the WNDOBJ */
|
||||
IntEngWndUpdateClipObj(Current, Window);
|
||||
break;
|
||||
if ( gcountPWO &&
|
||||
Current &&
|
||||
Current->Hwnd == hWnd &&
|
||||
Current->WndObj.pvConsumer != NULL )
|
||||
{
|
||||
/* Update the WNDOBJ */
|
||||
switch (flChanged)
|
||||
{
|
||||
case WOC_RGN_CLIENT:
|
||||
/* Update the clipobj and client rect of the WNDOBJ */
|
||||
IntEngWndUpdateClipObj(Current, Window);
|
||||
break;
|
||||
|
||||
case WOC_DELETE:
|
||||
/* FIXME: Should the WNDOBJs be deleted by win32k or by the driver? */
|
||||
break;
|
||||
}
|
||||
case WOC_DELETE:
|
||||
/* FIXME: Should the WNDOBJs be deleted by win32k or by the driver? */
|
||||
break;
|
||||
}
|
||||
|
||||
/* Call the change proc */
|
||||
IntEngWndCallChangeProc(&Current->WndObj, flChanged);
|
||||
|
||||
/* HACK: Send WOC_CHANGED after WOC_RGN_CLIENT */
|
||||
if (flChanged == WOC_RGN_CLIENT)
|
||||
{
|
||||
IntEngWndCallChangeProc(&Current->WndObj, WOC_CHANGED);
|
||||
}
|
||||
|
||||
CurrentEntry = CurrentEntry->Flink;
|
||||
}
|
||||
}
|
||||
/* Call the change proc */
|
||||
IntEngWndCallChangeProc(&Current->WndObj, flChanged);
|
||||
|
||||
/* HACK: Send WOC_CHANGED after WOC_RGN_CLIENT */
|
||||
if (flChanged == WOC_RGN_CLIENT)
|
||||
{
|
||||
IntEngWndCallChangeProc(&Current->WndObj, WOC_CHANGED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -254,7 +250,8 @@ EngCreateWnd(
|
|||
WndObjInt->PixelFormat = iPixelFormat;
|
||||
|
||||
/* associate object with window */
|
||||
InsertTailList(&Window->WndObjListHead, &WndObjInt->ListEntry);
|
||||
IntSetProp(Window, AtomWndObj, WndObjInt);
|
||||
++gcountPWO;
|
||||
|
||||
DPRINT("EngCreateWnd: SUCCESS!\n");
|
||||
|
||||
|
@ -292,15 +289,15 @@ EngDeleteWnd(
|
|||
/* Get window object */
|
||||
Window = UserGetWindowObject(WndObjInt->Hwnd);
|
||||
if (Window == NULL)
|
||||
{
|
||||
DPRINT1("Warning: Couldnt get window object for WndObjInt->Hwnd!!!\n");
|
||||
RemoveEntryList(&WndObjInt->ListEntry);
|
||||
}
|
||||
{
|
||||
DPRINT1("Warning: Couldnt get window object for WndObjInt->Hwnd!!!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Remove object from window */
|
||||
RemoveEntryList(&WndObjInt->ListEntry);
|
||||
}
|
||||
{
|
||||
/* Remove object from window */
|
||||
IntRemoveProp(Window, AtomWndObj);
|
||||
--gcountPWO;
|
||||
}
|
||||
|
||||
if (!calledFromUser){
|
||||
UserLeave();
|
||||
|
|
|
@ -28,11 +28,16 @@ typedef struct tagDCE
|
|||
LIST_ENTRY List;
|
||||
HDC hDC;
|
||||
HWND hwndCurrent;
|
||||
HWND hwndDC;
|
||||
HRGN hClipRgn;
|
||||
PWND pwndOrg;
|
||||
PWND pwndClip;
|
||||
PWND pwndRedirect;
|
||||
HRGN hrgnClip;
|
||||
HRGN hrgnClipPublic;
|
||||
HRGN hrgnSavedVis;
|
||||
DWORD DCXFlags;
|
||||
PEPROCESS pProcess;
|
||||
HANDLE Self;
|
||||
PTHREADINFO ptiOwner;
|
||||
PPROCESSINFO ppiOwner;
|
||||
struct _MONITOR* pMonitor;
|
||||
} DCE; /* PDCE already declared at top of file */
|
||||
|
||||
/* internal DCX flags, see psdk/winuser.h for the rest */
|
||||
|
@ -52,7 +57,6 @@ INT FASTCALL DCE_ExcludeRgn(HDC, HWND, HRGN);
|
|||
BOOL FASTCALL DCE_InvalidateDCE(HWND, const PRECTL);
|
||||
HWND FASTCALL IntWindowFromDC(HDC hDc);
|
||||
PDCE FASTCALL DceFreeDCE(PDCE dce, BOOLEAN Force);
|
||||
void FASTCALL DceFreeWindowDCE(PWINDOW_OBJECT Window);
|
||||
void FASTCALL DceEmptyCache(void);
|
||||
VOID FASTCALL DceResetActiveDCEs(PWINDOW_OBJECT Window);
|
||||
void FASTCALL DceFreeClassDCE(HDC);
|
||||
|
|
|
@ -89,7 +89,6 @@ typedef struct _PATHGDI {
|
|||
|
||||
typedef struct _WNDGDI {
|
||||
WNDOBJ WndObj;
|
||||
LIST_ENTRY ListEntry;
|
||||
HWND Hwnd;
|
||||
CLIPOBJ *ClientClipObj;
|
||||
WNDOBJCHANGEPROC ChangeProc;
|
||||
|
|
|
@ -14,6 +14,7 @@ typedef struct _WINDOW_OBJECT *PWINDOW_OBJECT;
|
|||
#include <include/scroll.h>
|
||||
|
||||
extern ATOM AtomMessage;
|
||||
extern ATOM AtomWndObj; /* WNDOBJ list */
|
||||
|
||||
BOOL FASTCALL UserUpdateUiState(PWND Wnd, WPARAM wParam);
|
||||
|
||||
|
@ -29,8 +30,6 @@ typedef struct _WINDOW_OBJECT
|
|||
PTHREADINFO pti; // Use Wnd->head.pti
|
||||
/* system menu handle. */
|
||||
HMENU SystemMenu;
|
||||
/* Entry in the thread's list of windows. */
|
||||
LIST_ENTRY ListEntry;
|
||||
/* Handle for the window. */
|
||||
HWND hSelf; // Use Wnd->head.h
|
||||
/* Window flags. */
|
||||
|
@ -42,19 +41,16 @@ typedef struct _WINDOW_OBJECT
|
|||
struct _WINDOW_OBJECT* spwndChild;
|
||||
struct _WINDOW_OBJECT* spwndNext;
|
||||
struct _WINDOW_OBJECT* spwndPrev;
|
||||
/* Entry in the list of thread windows. */
|
||||
LIST_ENTRY ThreadListEntry;
|
||||
/* Handle to the parent window. */
|
||||
struct _WINDOW_OBJECT* spwndParent;
|
||||
/* Handle to the owner window. */
|
||||
HWND hOwner; // Use spwndOwner
|
||||
/* DC Entries (DCE) */
|
||||
PDCE Dce;
|
||||
|
||||
|
||||
/* Scrollbar info */
|
||||
PSBINFOEX pSBInfo; // convert to PSBINFO
|
||||
PETHREAD OwnerThread; // Use Wnd->head.pti->pEThread
|
||||
/* WNDOBJ list */
|
||||
LIST_ENTRY WndObjListHead; // Use Props
|
||||
/* Entry in the list of thread windows. */
|
||||
LIST_ENTRY ThreadListEntry;
|
||||
} WINDOW_OBJECT; /* PWINDOW_OBJECT already declared at top of file */
|
||||
|
||||
/* Window flags. */
|
||||
|
@ -86,16 +82,16 @@ typedef struct _WINDOW_OBJECT
|
|||
|
||||
|
||||
#define IntWndBelongsToThread(WndObj, W32Thread) \
|
||||
(((WndObj->OwnerThread && WndObj->OwnerThread->Tcb.Win32Thread)) && \
|
||||
(WndObj->OwnerThread->Tcb.Win32Thread == W32Thread))
|
||||
(((WndObj->pti->pEThread && WndObj->pti->pEThread->Tcb.Win32Thread)) && \
|
||||
(WndObj->pti->pEThread->Tcb.Win32Thread == W32Thread))
|
||||
// ((WndObj->head.pti) && (WndObj->head.pti == W32Thread))
|
||||
|
||||
#define IntGetWndThreadId(WndObj) \
|
||||
WndObj->OwnerThread->Cid.UniqueThread
|
||||
WndObj->pti->pEThread->Cid.UniqueThread
|
||||
// WndObj->head.pti->pEThread->Cid.UniqueThread
|
||||
|
||||
#define IntGetWndProcessId(WndObj) \
|
||||
WndObj->OwnerThread->ThreadsProcess->UniqueProcessId
|
||||
WndObj->pti->pEThread->ThreadsProcess->UniqueProcessId
|
||||
// WndObj->head.pti->pEThread->ThreadsProcess->UniqueProcessId
|
||||
|
||||
BOOL FASTCALL
|
||||
|
|
|
@ -245,7 +245,7 @@ BOOL FASTCALL co_UserHideCaret(PWINDOW_OBJECT Window OPTIONAL)
|
|||
|
||||
if (Window) ASSERT_REFS_CO(Window);
|
||||
|
||||
if(Window && Window->OwnerThread != PsGetCurrentThread())
|
||||
if(Window && Window->pti->pEThread != PsGetCurrentThread())
|
||||
{
|
||||
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
||||
return FALSE;
|
||||
|
@ -280,7 +280,7 @@ BOOL FASTCALL co_UserShowCaret(PWINDOW_OBJECT Window OPTIONAL)
|
|||
|
||||
if (Window) ASSERT_REFS_CO(Window);
|
||||
|
||||
if(Window && Window->OwnerThread != PsGetCurrentThread())
|
||||
if(Window && Window->pti->pEThread != PsGetCurrentThread())
|
||||
{
|
||||
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
||||
return FALSE;
|
||||
|
@ -332,7 +332,7 @@ NtUserCreateCaret(
|
|||
RETURN(FALSE);
|
||||
}
|
||||
|
||||
if(Window->OwnerThread != PsGetCurrentThread())
|
||||
if(Window->pti->pEThread != PsGetCurrentThread())
|
||||
{
|
||||
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
||||
RETURN(FALSE);
|
||||
|
|
|
@ -217,7 +217,7 @@ co_IntSetForegroundAndFocusWindow(PWINDOW_OBJECT Window, PWINDOW_OBJECT FocusWin
|
|||
}
|
||||
|
||||
if (0 == (Wnd->style & WS_VISIBLE) &&
|
||||
Window->OwnerThread->ThreadsProcess != CsrProcess)
|
||||
Window->pti->pEThread->ThreadsProcess != CsrProcess)
|
||||
{
|
||||
DPRINT("Failed - Invisible\n");
|
||||
return FALSE;
|
||||
|
@ -339,7 +339,7 @@ co_IntSetActiveWindow(PWINDOW_OBJECT Window OPTIONAL)
|
|||
{
|
||||
Wnd = Window->Wnd;
|
||||
if ((!(Wnd->style & WS_VISIBLE) &&
|
||||
Window->OwnerThread->ThreadsProcess != CsrProcess) ||
|
||||
Window->pti->pEThread->ThreadsProcess != CsrProcess) ||
|
||||
(Wnd->style & (WS_POPUP | WS_CHILD)) == WS_CHILD)
|
||||
{
|
||||
return ThreadQueue ? 0 : ThreadQueue->ActiveWindow;
|
||||
|
|
|
@ -16,8 +16,7 @@
|
|||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/* $Id$
|
||||
*
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: HotKey support
|
||||
|
@ -182,7 +181,7 @@ NtUserRegisterHotKey(HWND hWnd,
|
|||
{
|
||||
RETURN( FALSE);
|
||||
}
|
||||
HotKeyThread = Window->OwnerThread;
|
||||
HotKeyThread = Window->pti->pEThread;
|
||||
}
|
||||
|
||||
/* Check for existing hotkey */
|
||||
|
|
|
@ -191,6 +191,14 @@ IntAttachMonitor(IN PDEVOBJ *pGdiDevice,
|
|||
Monitor->rcWork = Monitor->rcMonitor;
|
||||
Monitor->cWndStack = 0;
|
||||
|
||||
Monitor->hrgnMonitor= NtGdiCreateRectRgn( Monitor->rcMonitor.left,
|
||||
Monitor->rcMonitor.top,
|
||||
Monitor->rcMonitor.right,
|
||||
Monitor->rcMonitor.bottom );
|
||||
|
||||
// Replace with IntGdiSetRegeionOwner(Monitor->hrgnMonitor, GDI_OBJ_HMGR_PUBLIC);
|
||||
GDIOBJ_SetOwnership(Monitor->hrgnMonitor, NULL);
|
||||
|
||||
if (gMonitorList == NULL)
|
||||
{
|
||||
DPRINT("Primary monitor is beeing attached\n");
|
||||
|
|
|
@ -20,6 +20,7 @@ BOOL InitSysParams();
|
|||
|
||||
ERESOURCE UserLock;
|
||||
ATOM AtomMessage; // Window Message atom.
|
||||
ATOM AtomWndObj; // Window Object atom.
|
||||
BOOL gbInitialized;
|
||||
HINSTANCE hModClient = NULL;
|
||||
BOOL ClientPfnInit = FALSE;
|
||||
|
@ -45,6 +46,8 @@ InitUserAtoms(VOID)
|
|||
/* System Context Help Id Atom */
|
||||
gpsi->atomContextHelpIdProp = IntAddGlobalAtom(L"SysCH", TRUE);
|
||||
|
||||
AtomWndObj = IntAddGlobalAtom(L"SysWNDO", TRUE);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -199,7 +199,7 @@ InternalSetTimer( PWINDOW_OBJECT Window,
|
|||
if (!pTmr) return 0;
|
||||
|
||||
if (Window && (Type & TMRF_TIFROMWND))
|
||||
pTmr->pti = Window->OwnerThread->Tcb.Win32Thread;
|
||||
pTmr->pti = Window->pti->pEThread->Tcb.Win32Thread;
|
||||
else
|
||||
{
|
||||
if (Type & TMRF_RIT)
|
||||
|
@ -253,7 +253,7 @@ SetSystemTimer( PWINDOW_OBJECT Window,
|
|||
UINT uElapse,
|
||||
TIMERPROC lpTimerFunc)
|
||||
{
|
||||
if (Window && Window->OwnerThread->ThreadsProcess != PsGetCurrentProcess())
|
||||
if (Window && Window->pti->pEThread->ThreadsProcess != PsGetCurrentProcess())
|
||||
{
|
||||
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
||||
return 0;
|
||||
|
@ -419,7 +419,7 @@ IntSetTimer(HWND Wnd, UINT_PTR IDEvent, UINT Elapse, TIMERPROC TimerFunc, BOOL S
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (Window->OwnerThread->ThreadsProcess != PsGetCurrentProcess())
|
||||
if (Window->pti->pEThread->ThreadsProcess != PsGetCurrentProcess())
|
||||
{
|
||||
DPRINT1("Trying to set timer for window in another process (shatter attack?)\n");
|
||||
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
||||
|
|
|
@ -89,8 +89,13 @@ DceAllocDCE(PWINDOW_OBJECT Window OPTIONAL, DCE_TYPE Type)
|
|||
}
|
||||
|
||||
pDce->hwndCurrent = (Window ? Window->hSelf : NULL);
|
||||
pDce->hClipRgn = NULL;
|
||||
pDce->pProcess = NULL;
|
||||
pDce->pwndOrg = Wnd;
|
||||
pDce->pwndClip = Wnd;
|
||||
pDce->hrgnClip = NULL;
|
||||
pDce->hrgnClipPublic = NULL;
|
||||
pDce->hrgnSavedVis = NULL;
|
||||
pDce->ptiOwner = NULL;
|
||||
pDce->ppiOwner = NULL;
|
||||
|
||||
KeEnterCriticalRegion();
|
||||
if (FirstDce == NULL)
|
||||
|
@ -105,8 +110,9 @@ DceAllocDCE(PWINDOW_OBJECT Window OPTIONAL, DCE_TYPE Type)
|
|||
DCU_SetDcUndeletable(pDce->hDC);
|
||||
|
||||
if (Type == DCE_WINDOW_DC || Type == DCE_CLASS_DC) //Window DCE have ownership.
|
||||
{ // Process should already own it.
|
||||
pDce->pProcess = PsGetCurrentProcess();
|
||||
{
|
||||
pDce->ptiOwner = GetW32ThreadInfo();
|
||||
pDce->ppiOwner = pDce->ptiOwner->ppi;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -174,12 +180,12 @@ DceDeleteClipRgn(DCE* Dce)
|
|||
{
|
||||
Dce->DCXFlags &= ~DCX_KEEPCLIPRGN;
|
||||
}
|
||||
else if (Dce->hClipRgn != NULL)
|
||||
else if (Dce->hrgnClip != NULL)
|
||||
{
|
||||
GreDeleteObject(Dce->hClipRgn);
|
||||
GreDeleteObject(Dce->hrgnClip);
|
||||
}
|
||||
|
||||
Dce->hClipRgn = NULL;
|
||||
Dce->hrgnClip = NULL;
|
||||
|
||||
/* make it dirty so that the vis rgn gets recomputed next time */
|
||||
Dce->DCXFlags |= DCX_DCEDIRTY;
|
||||
|
@ -225,7 +231,8 @@ DceReleaseDC(DCE* dce, BOOL EndPaint)
|
|||
DPRINT("Exit!!!!! DCX_CACHE!!!!!! hDC-> %x \n", dce->hDC);
|
||||
if (!IntGdiSetDCOwnerEx( dce->hDC, GDI_OBJ_HMGR_NONE, FALSE))
|
||||
return 0;
|
||||
dce->pProcess = NULL; // Reset ownership.
|
||||
dce->ptiOwner = NULL; // Reset ownership.
|
||||
dce->ppiOwner = NULL;
|
||||
}
|
||||
return 1; // Released!
|
||||
}
|
||||
|
@ -282,9 +289,9 @@ DceUpdateVisRgn(DCE *Dce, PWINDOW_OBJECT Window, ULONG Flags)
|
|||
noparent:
|
||||
if (Flags & DCX_INTERSECTRGN)
|
||||
{
|
||||
if(Dce->hClipRgn != NULL)
|
||||
if(Dce->hrgnClip != NULL)
|
||||
{
|
||||
NtGdiCombineRgn(hRgnVisible, hRgnVisible, Dce->hClipRgn, RGN_AND);
|
||||
NtGdiCombineRgn(hRgnVisible, hRgnVisible, Dce->hrgnClip, RGN_AND);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -296,9 +303,9 @@ noparent:
|
|||
}
|
||||
}
|
||||
|
||||
if (Flags & DCX_EXCLUDERGN && Dce->hClipRgn != NULL)
|
||||
if (Flags & DCX_EXCLUDERGN && Dce->hrgnClip != NULL)
|
||||
{
|
||||
NtGdiCombineRgn(hRgnVisible, hRgnVisible, Dce->hClipRgn, RGN_DIFF);
|
||||
NtGdiCombineRgn(hRgnVisible, hRgnVisible, Dce->hrgnClip, RGN_DIFF);
|
||||
}
|
||||
|
||||
Dce->DCXFlags &= ~DCX_DCEDIRTY;
|
||||
|
@ -495,7 +502,7 @@ UserGetDCEx(PWINDOW_OBJECT Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
|
|||
DPRINT("Owned/Class DCE\n");
|
||||
/* we should free dce->clip_rgn here, but Windows apparently doesn't */
|
||||
Dce->DCXFlags &= ~(DCX_EXCLUDERGN | DCX_INTERSECTRGN);
|
||||
Dce->hClipRgn = NULL;
|
||||
Dce->hrgnClip = NULL;
|
||||
}
|
||||
|
||||
#if 1 /* FIXME */
|
||||
|
@ -524,7 +531,7 @@ UserGetDCEx(PWINDOW_OBJECT Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
|
|||
}
|
||||
|
||||
#if 0
|
||||
if (NULL != Dce->hClipRgn)
|
||||
if (NULL != Dce->hrgnClip)
|
||||
{
|
||||
DceDeleteClipRgn(Dce);
|
||||
}
|
||||
|
@ -543,17 +550,17 @@ UserGetDCEx(PWINDOW_OBJECT Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
|
|||
{
|
||||
if (!(Flags & DCX_WINDOW))
|
||||
{
|
||||
Dce->hClipRgn = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->rcClient);
|
||||
Dce->hrgnClip = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->rcClient);
|
||||
}
|
||||
else
|
||||
{
|
||||
Dce->hClipRgn = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->rcWindow);
|
||||
Dce->hrgnClip = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->rcWindow);
|
||||
}
|
||||
Dce->DCXFlags &= ~DCX_KEEPCLIPRGN;
|
||||
}
|
||||
else if (ClipRegion != NULL)
|
||||
{
|
||||
Dce->hClipRgn = ClipRegion;
|
||||
Dce->hrgnClip = ClipRegion;
|
||||
}
|
||||
|
||||
DceSetDrawable(Window, Dce->hDC, Flags, UpdateClipOrigin);
|
||||
|
@ -568,7 +575,8 @@ UserGetDCEx(PWINDOW_OBJECT Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
|
|||
DPRINT("ENTER!!!!!! DCX_CACHE!!!!!! hDC-> %x\n", Dce->hDC);
|
||||
// Need to set ownership so Sync dcattr will work.
|
||||
IntGdiSetDCOwnerEx( Dce->hDC, GDI_OBJ_HMGR_POWNED, FALSE);
|
||||
Dce->pProcess = PsGetCurrentProcess(); // Set the temp owning process
|
||||
Dce->ptiOwner = GetW32ThreadInfo(); // Set the temp owning
|
||||
Dce->ppiOwner = Dce->ptiOwner->ppi;
|
||||
}
|
||||
return(Dce->hDC);
|
||||
}
|
||||
|
@ -607,9 +615,9 @@ DceFreeDCE(PDCE pdce, BOOLEAN Force)
|
|||
|
||||
if (!Hit) IntGdiDeleteDC(pdce->hDC, TRUE);
|
||||
|
||||
if (pdce->hClipRgn && ! (pdce->DCXFlags & DCX_KEEPCLIPRGN))
|
||||
if (pdce->hrgnClip && ! (pdce->DCXFlags & DCX_KEEPCLIPRGN))
|
||||
{
|
||||
GreDeleteObject(pdce->hClipRgn);
|
||||
GreDeleteObject(pdce->hrgnClip);
|
||||
}
|
||||
|
||||
RemoveEntryList(&pdce->List);
|
||||
|
@ -626,73 +634,6 @@ DceFreeDCE(PDCE pdce, BOOLEAN Force)
|
|||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* DceFreeWindowDCE
|
||||
*
|
||||
* Remove owned DCE and reset unreleased cache DCEs.
|
||||
*/
|
||||
void FASTCALL
|
||||
DceFreeWindowDCE(PWINDOW_OBJECT Window)
|
||||
{
|
||||
PDCE pDCE;
|
||||
|
||||
pDCE = FirstDce;
|
||||
KeEnterCriticalRegion();
|
||||
do
|
||||
{
|
||||
if (!pDCE) break;
|
||||
if (pDCE->hwndCurrent == Window->hSelf)
|
||||
{
|
||||
if (!(pDCE->DCXFlags & DCX_CACHE)) /* owned or Class DCE*/
|
||||
{
|
||||
if (Window->Wnd->pcls->style & CS_CLASSDC ||
|
||||
Window->Wnd->style & CS_CLASSDC) /* Test Class first */
|
||||
{
|
||||
if (pDCE->DCXFlags & (DCX_INTERSECTRGN | DCX_EXCLUDERGN)) /* Class DCE*/
|
||||
DceDeleteClipRgn(pDCE);
|
||||
// Update and reset Vis Rgn and clear the dirty bit.
|
||||
// Should release VisRgn than reset it to default.
|
||||
DceUpdateVisRgn(pDCE, Window, pDCE->DCXFlags);
|
||||
pDCE->DCXFlags = DCX_DCEEMPTY;
|
||||
pDCE->hwndCurrent = 0;
|
||||
}
|
||||
else if (Window->Wnd->pcls->style & CS_OWNDC ||
|
||||
Window->Wnd->style & CS_OWNDC) /* owned DCE*/
|
||||
{
|
||||
pDCE = DceFreeDCE(pDCE, FALSE);
|
||||
if (!pDCE) break;
|
||||
Window->Dce = NULL;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT(FALSE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pDCE->DCXFlags & DCX_DCEBUSY) /* shared cache DCE */
|
||||
{
|
||||
/* FIXME: AFAICS we are doing the right thing here so
|
||||
* this should be a DPRINT. But this is best left as an ERR
|
||||
* because the 'application error' is likely to come from
|
||||
* another part of Wine (i.e. it's our fault after all).
|
||||
* We should change this to DPRINT when ReactOS is more stable
|
||||
* (for 1.0?).
|
||||
*/
|
||||
DPRINT1("[%p] GetDC() without ReleaseDC()!\n", Window->hSelf);
|
||||
DceReleaseDC(pDCE, FALSE);
|
||||
}
|
||||
pDCE->DCXFlags |= DCX_DCEEMPTY;
|
||||
pDCE->hwndCurrent = 0;
|
||||
}
|
||||
}
|
||||
pDCE = (PDCE) pDCE->List.Flink;
|
||||
} while (pDCE != FirstDce);
|
||||
KeLeaveCriticalRegion();
|
||||
}
|
||||
|
||||
void FASTCALL
|
||||
DceFreeClassDCE(HDC hDC)
|
||||
{
|
||||
|
@ -789,9 +730,9 @@ DceResetActiveDCEs(PWINDOW_OBJECT Window)
|
|||
NtGdiOffsetRgn(dc->rosdc.hClipRgn, DeltaX, DeltaY);
|
||||
CLIPPING_UpdateGCRegion(dc);
|
||||
}
|
||||
if (NULL != pDCE->hClipRgn)
|
||||
if (NULL != pDCE->hrgnClip)
|
||||
{
|
||||
NtGdiOffsetRgn(pDCE->hClipRgn, DeltaX, DeltaY);
|
||||
NtGdiOffsetRgn(pDCE->hrgnClip, DeltaX, DeltaY);
|
||||
}
|
||||
}
|
||||
DC_UnlockDc(dc);
|
||||
|
@ -869,29 +810,20 @@ UserGetWindowDC(PWINDOW_OBJECT Wnd)
|
|||
HWND FASTCALL
|
||||
UserGethWnd( HDC hdc, PWNDOBJ *pwndo)
|
||||
{
|
||||
PWNDGDI pWndgdi = NULL;
|
||||
PWINDOW_OBJECT Wnd = NULL;
|
||||
PWNDGDI pWndgdi;
|
||||
PWINDOW_OBJECT Wnd;
|
||||
HWND hWnd;
|
||||
BOOL Hit = FALSE;
|
||||
PLIST_ENTRY Entry;
|
||||
|
||||
hWnd = IntWindowFromDC(hdc);
|
||||
|
||||
if (hWnd && !(Wnd = UserGetWindowObject(hWnd)))
|
||||
{
|
||||
KeEnterCriticalRegion();
|
||||
Entry = Wnd->WndObjListHead.Flink;
|
||||
while (Entry != &Wnd->WndObjListHead)
|
||||
pWndgdi = (WNDGDI *)IntGetProp(Wnd, AtomWndObj);
|
||||
|
||||
if ( pWndgdi && pWndgdi->Hwnd == hWnd )
|
||||
{
|
||||
pWndgdi = (PWNDGDI)Entry;
|
||||
if (pWndgdi->Hwnd == hWnd)
|
||||
{
|
||||
Hit = TRUE;
|
||||
break;
|
||||
}
|
||||
Entry = Entry->Flink;
|
||||
if (pwndo) *pwndo = (PWNDOBJ)pWndgdi;
|
||||
}
|
||||
if (pwndo && Hit) *pwndo = (PWNDOBJ)pWndgdi;
|
||||
KeLeaveCriticalRegion();
|
||||
}
|
||||
return hWnd;
|
||||
}
|
||||
|
|
|
@ -478,7 +478,6 @@ static LRESULT co_UserFreeWindow(PWINDOW_OBJECT Window,
|
|||
Window->SystemMenu = (HMENU)0;
|
||||
}
|
||||
|
||||
DceFreeWindowDCE(Window); /* Always do this to catch orphaned DCs */
|
||||
#if 0 /* FIXME */
|
||||
|
||||
WINPROC_FreeProc(Window->winproc, WIN_PROC_WINDOW);
|
||||
|
@ -1150,7 +1149,7 @@ co_IntSetParent(PWINDOW_OBJECT Wnd, PWINDOW_OBJECT WndNewParent)
|
|||
// return NULL;
|
||||
|
||||
/* Window must belong to current process */
|
||||
if (Wnd->OwnerThread->ThreadsProcess != PsGetCurrentProcess())
|
||||
if (Wnd->pti->pEThread->ThreadsProcess != PsGetCurrentProcess())
|
||||
return NULL;
|
||||
|
||||
WndOldParent = Wnd->spwndParent;
|
||||
|
@ -1948,7 +1947,6 @@ AllocErr:
|
|||
}
|
||||
}
|
||||
|
||||
Window->OwnerThread = PsGetCurrentThread();
|
||||
Window->spwndChild = NULL;
|
||||
Window->spwndPrev = NULL;
|
||||
Window->spwndNext = NULL;
|
||||
|
@ -1960,7 +1958,6 @@ AllocErr:
|
|||
Wnd->cbwndExtra = Wnd->pcls->cbwndExtra;
|
||||
|
||||
InitializeListHead(&Wnd->PropListHead);
|
||||
InitializeListHead(&Window->WndObjListHead);
|
||||
|
||||
if ( NULL != WindowName->Buffer && WindowName->Length > 0 )
|
||||
{
|
||||
|
@ -2052,11 +2049,16 @@ AllocErr:
|
|||
InsertTailList (&pti->WindowListHead, &Window->ThreadListEntry);
|
||||
|
||||
/* Handle "CS_CLASSDC", it is tested first. */
|
||||
if ((Wnd->pcls->style & CS_CLASSDC) && !(Wnd->pcls->pdce)) // One DCE per class to have CLASS.
|
||||
Wnd->pcls->pdce = DceAllocDCE(Window, DCE_CLASS_DC);
|
||||
/* Allocate a DCE for this window. */
|
||||
if ( (Wnd->pcls->style & CS_CLASSDC) && !(Wnd->pcls->pdce) )
|
||||
{ /* One DCE per class to have CLASS. */
|
||||
Wnd->pcls->pdce = DceAllocDCE( Window, DCE_CLASS_DC );
|
||||
}
|
||||
else if ( Wnd->pcls->style & CS_OWNDC)
|
||||
Window->Dce = DceAllocDCE(Window, DCE_WINDOW_DC);
|
||||
{ /* Allocate a DCE for this window. */
|
||||
PDCE pDce = DceAllocDCE(Window, DCE_WINDOW_DC);
|
||||
if (!Wnd->pcls->pdce)
|
||||
Wnd->pcls->pdce = pDce;
|
||||
}
|
||||
|
||||
Pos.x = x;
|
||||
Pos.y = y;
|
||||
|
@ -2107,7 +2109,7 @@ AllocErr:
|
|||
PRTL_USER_PROCESS_PARAMETERS ProcessParams;
|
||||
BOOL CalculatedDefPosSize = FALSE;
|
||||
|
||||
IntGetDesktopWorkArea(((PTHREADINFO)Window->OwnerThread->Tcb.Win32Thread)->Desktop, &WorkArea);
|
||||
IntGetDesktopWorkArea(((PTHREADINFO)Window->pti->pEThread->Tcb.Win32Thread)->Desktop, &WorkArea);
|
||||
|
||||
rc = WorkArea;
|
||||
ProcessParams = PsGetCurrentProcess()->Peb->ProcessParameters;
|
||||
|
@ -2624,7 +2626,7 @@ BOOLEAN FASTCALL co_UserDestroyWindow(PWINDOW_OBJECT Window)
|
|||
DPRINT("co_UserDestroyWindow \n");
|
||||
|
||||
/* Check for owner thread */
|
||||
if ( (Window->OwnerThread != PsGetCurrentThread()) ||
|
||||
if ( (Window->pti->pEThread != PsGetCurrentThread()) ||
|
||||
Wnd->head.pti != PsGetCurrentThreadWin32Thread() )
|
||||
{
|
||||
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
||||
|
@ -3765,7 +3767,7 @@ UserGetWindowLong(HWND hWnd, DWORD Index, BOOL Ansi)
|
|||
* WndProc is only available to the owner process
|
||||
*/
|
||||
if (GWL_WNDPROC == Index
|
||||
&& Window->OwnerThread->ThreadsProcess != PsGetCurrentProcess())
|
||||
&& Window->pti->pEThread->ThreadsProcess != PsGetCurrentProcess())
|
||||
{
|
||||
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
||||
return 0;
|
||||
|
@ -3886,7 +3888,7 @@ co_UserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
|
|||
/*
|
||||
* Remove extended window style bit WS_EX_TOPMOST for shell windows.
|
||||
*/
|
||||
WindowStation = ((PTHREADINFO)Window->OwnerThread->Tcb.Win32Thread)->Desktop->WindowStation;
|
||||
WindowStation = Window->pti->Desktop->WindowStation;
|
||||
if(WindowStation)
|
||||
{
|
||||
if (hWnd == WindowStation->ShellWindow || hWnd == WindowStation->ShellListView)
|
||||
|
|
|
@ -16,8 +16,7 @@
|
|||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/* $Id$
|
||||
*
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: Windows
|
||||
|
@ -120,7 +119,7 @@ BOOL FASTCALL can_activate_window( PWINDOW_OBJECT Wnd OPTIONAL)
|
|||
if (!Wnd->Wnd) return FALSE;
|
||||
style = Wnd->Wnd->style;
|
||||
if (!(style & WS_VISIBLE) &&
|
||||
Wnd->OwnerThread->ThreadsProcess != CsrProcess) return FALSE;
|
||||
Wnd->pti->pEThread->ThreadsProcess != CsrProcess) return FALSE;
|
||||
if ((style & (WS_POPUP|WS_CHILD)) == WS_CHILD) return FALSE;
|
||||
return !(style & WS_DISABLED);
|
||||
}
|
||||
|
@ -905,7 +904,7 @@ co_WinPosSetWindowPos(
|
|||
* Only allow CSRSS to mess with the desktop window
|
||||
*/
|
||||
if (Window->hSelf == IntGetDesktopWindow() &&
|
||||
Window->OwnerThread->ThreadsProcess != PsGetCurrentProcess())
|
||||
Window->pti->pEThread->ThreadsProcess != PsGetCurrentProcess())
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue