Author: jimtabor Date: Tue Jan 12 06:25:22 2010 New Revision: 45051
URL: http://svn.reactos.org/svn/reactos?rev=45051&view=rev Log: [Win32k] - More movement to WND with updates to related files. Removed unused code rewritten others. Review patch.
Modified: trunk/reactos/subsystems/win32/win32k/eng/engwindow.c trunk/reactos/subsystems/win32/win32k/include/dce.h trunk/reactos/subsystems/win32/win32k/include/engobjects.h trunk/reactos/subsystems/win32/win32k/include/window.h trunk/reactos/subsystems/win32/win32k/ntuser/caret.c trunk/reactos/subsystems/win32/win32k/ntuser/focus.c trunk/reactos/subsystems/win32/win32k/ntuser/hotkey.c trunk/reactos/subsystems/win32/win32k/ntuser/monitor.c trunk/reactos/subsystems/win32/win32k/ntuser/ntuser.c trunk/reactos/subsystems/win32/win32k/ntuser/timer.c trunk/reactos/subsystems/win32/win32k/ntuser/windc.c trunk/reactos/subsystems/win32/win32k/ntuser/window.c trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c
Modified: trunk/reactos/subsystems/win32/win32k/eng/engwindow.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/eng... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/eng/engwindow.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/eng/engwindow.c [iso-8859-1] Tue Jan 12 06:25:22 2010 @@ -16,26 +16,25 @@ * 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>
#define NDEBUG #include <debug.h> + +INT gcountPWO = 0;
/* * Calls the WNDOBJCHANGEPROC of the given WNDOBJ @@ -153,44 +152,41 @@ 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); - - 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; - - 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; - } - } - + hWnd = Window->hSelf; // pWnd->head.h; + Current = (WNDGDI *)IntGetProp(Window, AtomWndObj); + + 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; + } + + /* 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 @@ 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 @@ /* 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();
Modified: trunk/reactos/subsystems/win32/win32k/include/dce.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/dce.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/dce.h [iso-8859-1] Tue Jan 12 06:25:22 2010 @@ -28,11 +28,16 @@ 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 @@ 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);
Modified: trunk/reactos/subsystems/win32/win32k/include/engobjects.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/engobjects.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/engobjects.h [iso-8859-1] Tue Jan 12 06:25:22 2010 @@ -89,7 +89,6 @@
typedef struct _WNDGDI { WNDOBJ WndObj; - LIST_ENTRY ListEntry; HWND Hwnd; CLIPOBJ *ClientClipObj; WNDOBJCHANGEPROC ChangeProc;
Modified: trunk/reactos/subsystems/win32/win32k/include/window.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/window.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/window.h [iso-8859-1] Tue Jan 12 06:25:22 2010 @@ -14,6 +14,7 @@ #include <include/scroll.h>
extern ATOM AtomMessage; +extern ATOM AtomWndObj; /* WNDOBJ list */
BOOL FASTCALL UserUpdateUiState(PWND Wnd, WPARAM wParam);
@@ -29,8 +30,6 @@ 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 @@ 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 @@
#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
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/caret.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/caret.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/caret.c [iso-8859-1] Tue Jan 12 06:25:22 2010 @@ -245,7 +245,7 @@
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 @@
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 @@ RETURN(FALSE); }
- if(Window->OwnerThread != PsGetCurrentThread()) + if(Window->pti->pEThread != PsGetCurrentThread()) { SetLastWin32Error(ERROR_ACCESS_DENIED); RETURN(FALSE);
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/focus.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/focus.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/focus.c [iso-8859-1] Tue Jan 12 06:25:22 2010 @@ -217,7 +217,7 @@ }
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 @@ { 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;
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/hotkey.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/hotkey.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/hotkey.c [iso-8859-1] Tue Jan 12 06:25:22 2010 @@ -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 @@ { RETURN( FALSE); } - HotKeyThread = Window->OwnerThread; + HotKeyThread = Window->pti->pEThread; }
/* Check for existing hotkey */
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/monitor.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/monitor.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/monitor.c [iso-8859-1] Tue Jan 12 06:25:22 2010 @@ -191,6 +191,14 @@ 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");
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/ntuser.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/ntuser.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/ntuser.c [iso-8859-1] Tue Jan 12 06:25:22 2010 @@ -20,6 +20,7 @@
ERESOURCE UserLock; ATOM AtomMessage; // Window Message atom. +ATOM AtomWndObj; // Window Object atom. BOOL gbInitialized; HINSTANCE hModClient = NULL; BOOL ClientPfnInit = FALSE; @@ -44,6 +45,8 @@
/* System Context Help Id Atom */ gpsi->atomContextHelpIdProp = IntAddGlobalAtom(L"SysCH", TRUE); + + AtomWndObj = IntAddGlobalAtom(L"SysWNDO", TRUE);
return STATUS_SUCCESS; }
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/timer.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/timer.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/timer.c [iso-8859-1] Tue Jan 12 06:25:22 2010 @@ -199,7 +199,7 @@ 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 @@ 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 @@ 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);
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/windc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/windc.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/windc.c [iso-8859-1] Tue Jan 12 06:25:22 2010 @@ -89,8 +89,13 @@ }
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 @@ 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 @@ { Dce->DCXFlags &= ~DCX_KEEPCLIPRGN; } - else if (Dce->hClipRgn != NULL) - { - GreDeleteObject(Dce->hClipRgn); - } - - Dce->hClipRgn = NULL; + else if (Dce->hrgnClip != NULL) + { + GreDeleteObject(Dce->hrgnClip); + } + + Dce->hrgnClip = NULL;
/* make it dirty so that the vis rgn gets recomputed next time */ Dce->DCXFlags |= DCX_DCEDIRTY; @@ -225,7 +231,8 @@ 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 @@ noparent: if (Flags & DCX_INTERSECTRGN) { - if(Dce->hClipRgn != NULL) - { - NtGdiCombineRgn(hRgnVisible, hRgnVisible, Dce->hClipRgn, RGN_AND); + if(Dce->hrgnClip != NULL) + { + NtGdiCombineRgn(hRgnVisible, hRgnVisible, Dce->hrgnClip, RGN_AND); } else { @@ -296,9 +303,9 @@ } }
- if (Flags & DCX_EXCLUDERGN && Dce->hClipRgn != NULL) - { - NtGdiCombineRgn(hRgnVisible, hRgnVisible, Dce->hClipRgn, RGN_DIFF); + if (Flags & DCX_EXCLUDERGN && Dce->hrgnClip != NULL) + { + NtGdiCombineRgn(hRgnVisible, hRgnVisible, Dce->hrgnClip, RGN_DIFF); }
Dce->DCXFlags &= ~DCX_DCEDIRTY; @@ -495,7 +502,7 @@ 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 @@ }
#if 0 - if (NULL != Dce->hClipRgn) + if (NULL != Dce->hrgnClip) { DceDeleteClipRgn(Dce); } @@ -543,17 +550,17 @@ { 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 @@ 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 @@
if (!Hit) IntGdiDeleteDC(pdce->hDC, TRUE);
- if (pdce->hClipRgn && ! (pdce->DCXFlags & DCX_KEEPCLIPRGN)) - { - GreDeleteObject(pdce->hClipRgn); + if (pdce->hrgnClip && ! (pdce->DCXFlags & DCX_KEEPCLIPRGN)) + { + GreDeleteObject(pdce->hrgnClip); }
RemoveEntryList(&pdce->List); @@ -624,73 +632,6 @@ ExFreePoolWithTag(pdce, TAG_PDCE);
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 @@ -789,9 +730,9 @@ 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 @@ 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; }
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] Tue Jan 12 06:25:22 2010 @@ -478,7 +478,6 @@ 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 @@ // 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 @@ } }
- Window->OwnerThread = PsGetCurrentThread(); Window->spwndChild = NULL; Window->spwndPrev = NULL; Window->spwndNext = NULL; @@ -1960,7 +1958,6 @@ Wnd->cbwndExtra = Wnd->pcls->cbwndExtra;
InitializeListHead(&Wnd->PropListHead); - InitializeListHead(&Window->WndObjListHead);
if ( NULL != WindowName->Buffer && WindowName->Length > 0 ) { @@ -2052,11 +2049,16 @@ 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 @@ 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 @@ 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 @@ * 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 @@ /* * 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)
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c [iso-8859-1] Tue Jan 12 06:25:22 2010 @@ -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 @@ 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 @@ * Only allow CSRSS to mess with the desktop window */ if (Window->hSelf == IntGetDesktopWindow() && - Window->OwnerThread->ThreadsProcess != PsGetCurrentProcess()) + Window->pti->pEThread->ThreadsProcess != PsGetCurrentProcess()) { return FALSE; }