Author: jimtabor
Date: Sun Jan 24 00:55:32 2010
New Revision: 45221
URL:
http://svn.reactos.org/svn/reactos?rev=45221&view=rev
Log:
[Win32k]
- Fixed DCE masks, clipping and added support for mirror and process owned dce.
- Reference:
http://www.reactos.org/archives/public/ros-dev/2008-July/010498.html
http://www.reactos.org/archives/public/ros-dev/2008-July/010499.html
Modified:
trunk/reactos/include/reactos/win32k/ntuser.h
trunk/reactos/subsystems/win32/win32k/ntuser/windc.c
Modified: trunk/reactos/include/reactos/win32k/ntuser.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntu…
==============================================================================
--- trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] Sun Jan 24 00:55:32 2010
@@ -775,6 +775,8 @@
//
#define DCX_USESTYLE 0x00010000
#define DCX_KEEPCLIPRGN 0x00040000
+#define DCX_KEEPLAYOUT 0x40000000
+#define DCX_PROCESSOWNED 0x80000000
//
// Non SDK Queue message types.
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/windc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/windc.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/windc.c [iso-8859-1] Sun Jan 24 00:55:32
2010
@@ -14,6 +14,8 @@
#define NDEBUG
#include <debug.h>
+int FASTCALL CLIPPING_UpdateGCRegion(DC* Dc);
+
/* GLOBALS *******************************************************************/
/* NOTE - I think we should store this per window station (including gdi objects) */
@@ -22,7 +24,9 @@
//static INT DCECount = 0; // Count of DCE in system.
#define DCX_CACHECOMPAREMASK (DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN | \
- DCX_CACHE | DCX_WINDOW | DCX_PARENTCLIP)
+ DCX_NORESETATTRS | DCX_LOCKWINDOWUPDATE | \
+ DCX_LAYEREDWIN | DCX_CACHE | DCX_WINDOW | \
+ DCX_PARENTCLIP)
/* FUNCTIONS *****************************************************************/
@@ -58,16 +62,15 @@
HRGN VisRgn;
VisRgn = VIS_ComputeVisibleRegion( Window,
- 0 == (Flags & DCX_WINDOW),
- 0 != (Flags & DCX_CLIPCHILDREN),
- 0 != (Flags & DCX_CLIPSIBLINGS));
+ 0 == (Flags & DCX_WINDOW),
+ 0 != (Flags & DCX_CLIPCHILDREN),
+ 0 != (Flags & DCX_CLIPSIBLINGS));
if (VisRgn == NULL)
VisRgn = IntSysCreateRectRgn(0, 0, 0, 0);
return VisRgn;
}
-
PDCE FASTCALL
DceAllocDCE(PWINDOW_OBJECT Window OPTIONAL, DCE_TYPE Type)
@@ -94,7 +97,6 @@
pDce->hrgnClip = NULL;
pDce->hrgnClipPublic = NULL;
pDce->hrgnSavedVis = NULL;
- pDce->ptiOwner = NULL;
pDce->ppiOwner = NULL;
KeEnterCriticalRegion();
@@ -111,13 +113,13 @@
if (Type == DCE_WINDOW_DC || Type == DCE_CLASS_DC) //Window DCE have ownership.
{
- pDce->ptiOwner = GetW32ThreadInfo();
- pDce->ppiOwner = pDce->ptiOwner->ppi;
+ pDce->ptiOwner = GetW32ThreadInfo();
}
else
{
DPRINT("FREE DCATTR!!!! NOT DCE_WINDOW_DC!!!!! hDC-> %x\n",
pDce->hDC);
IntGdiSetDCOwnerEx( pDce->hDC, GDI_OBJ_HMGR_NONE, FALSE);
+ pDce->ptiOwner = NULL;
}
if (Type == DCE_CACHE_DC)
@@ -140,8 +142,10 @@
}
static VOID APIENTRY
-DceSetDrawable(PWINDOW_OBJECT Window OPTIONAL, HDC hDC, ULONG Flags,
- BOOL SetClipOrigin)
+DceSetDrawable( PWINDOW_OBJECT Window OPTIONAL,
+ HDC hDC,
+ ULONG Flags,
+ BOOL SetClipOrigin)
{
PWND Wnd;
DC *dc = DC_LockDc(hDC);
@@ -302,8 +306,7 @@
hRgnVisible = IntSysCreateRectRgn(0, 0, 0, 0);
}
}
-
- if (Flags & DCX_EXCLUDERGN && Dce->hrgnClip != NULL)
+ else if (Flags & DCX_EXCLUDERGN && Dce->hrgnClip != NULL)
{
NtGdiCombineRgn(hRgnVisible, hRgnVisible, Dce->hrgnClip, RGN_DIFF);
}
@@ -328,10 +331,10 @@
PWINDOW_OBJECT Parent;
ULONG DcxFlags;
DCE* Dce = NULL;
- BOOL UpdateVisRgn = TRUE;
BOOL UpdateClipOrigin = FALSE;
PWND Wnd = NULL;
- HDC hDC = NULL;
+ HDC hDC = NULL;
+ PPROCESSINFO ppi;
if (NULL == Window)
{
@@ -381,6 +384,12 @@
!(Wnd->style & WS_MINIMIZE))
{
Flags |= DCX_CLIPCHILDREN;
+ }
+ /* If minized with icon in the set, we are forced to be cheap! */
+ if (Wnd->style & WS_MINIMIZE &&
+ Wnd->pcls->hIcon)
+ {
+ Flags |= DCX_CACHE;
}
}
else
@@ -458,9 +467,6 @@
else if (Dce->hwndCurrent == (Window ? Window->hSelf : NULL)
&&
((Dce->DCXFlags & DCX_CACHECOMPAREMASK) == DcxFlags))
{
-#if 0 /* FIXME */
- UpdateVisRgn = FALSE;
-#endif
UpdateClipOrigin = TRUE;
break;
}
@@ -485,31 +491,19 @@
Dce = FirstDce;
do
{ // Check for Window handle than HDC match for CLASS.
- if ((Dce->hwndCurrent == Window->hSelf) || (Dce->hDC == hDC)) break;
+ if ((Dce->hwndCurrent == Window->hSelf) ||
+ (Dce->hDC == hDC))
+ break;
Dce = (PDCE)Dce->List.Flink;
} while (Dce != FirstDce);
KeLeaveCriticalRegion();
- DPRINT("DCX:Flags -> %x:%x\n",Dce->DCXFlags & DCX_CACHE, Flags
& DCX_CACHE);
-
- if (Dce->hwndCurrent == Window->hSelf)
- {
- DPRINT("Owned DCE!\n");
- UpdateVisRgn = FALSE; /* updated automatically, via DCHook() */
- }
- else
- {
- DPRINT("Owned/Class DCE\n");
- /* we should free dce->clip_rgn here, but Windows apparently doesn't */
- Dce->DCXFlags &= ~(DCX_EXCLUDERGN | DCX_INTERSECTRGN);
- Dce->hrgnClip = NULL;
- }
-
-#if 1 /* FIXME */
- UpdateVisRgn = TRUE;
-#endif
- }
-
+ if ( (Flags & (DCX_INTERSECTRGN|DCX_EXCLUDERGN)) &&
+ (Dce->DCXFlags & (DCX_INTERSECTRGN|DCX_EXCLUDERGN)) )
+ {
+ DceDeleteClipRgn(Dce);
+ }
+ }
// First time use hax, need to use DceAllocDCE during window display init.
if (NULL == Dce)
{
@@ -523,23 +517,24 @@
/* FIXME: Handle error */
}
- if (!(Flags & (DCX_EXCLUDERGN | DCX_INTERSECTRGN)) && ClipRegion)
- {
- if (!(Flags & DCX_KEEPCLIPRGN))
- REGION_FreeRgnByHandle(ClipRegion);
- ClipRegion = NULL;
- }
-
-#if 0
- if (NULL != Dce->hrgnClip)
- {
- DceDeleteClipRgn(Dce);
- }
-#endif
-
Dce->DCXFlags = Flags | DCX_DCEBUSY;
- if (0 != (Flags & DCX_INTERSECTUPDATE) && NULL == ClipRegion)
+ /*
+ Bump it up! This prevents the random errors in wine dce tests and with
+ proper bits set in DCX_CACHECOMPAREMASK.
+ Reference:
+
http://www.reactos.org/archives/public/ros-dev/2008-July/010498.html
+
http://www.reactos.org/archives/public/ros-dev/2008-July/010499.html
+ */
+ if ((Dce != FirstDce))
+ {
+ RemoveEntryList(&Dce->List);
+ InsertHeadList(&FirstDce->List, &Dce->List);
+ FirstDce = Dce;
+ }
+
+ /* Introduced in rev 6691 and modified later. */
+ if ( (Flags & DCX_INTERSECTUPDATE) && !ClipRegion )
{
Flags |= DCX_INTERSECTRGN | DCX_KEEPCLIPRGN;
Dce->DCXFlags |= DCX_INTERSECTRGN | DCX_KEEPCLIPRGN;
@@ -565,10 +560,7 @@
DceSetDrawable(Window, Dce->hDC, Flags, UpdateClipOrigin);
- // if (UpdateVisRgn)
- {
- DceUpdateVisRgn(Dce, Window, Flags);
- }
+ DceUpdateVisRgn(Dce, Window, Flags);
if (Dce->DCXFlags & DCX_CACHE)
{
@@ -576,8 +568,23 @@
// Need to set ownership so Sync dcattr will work.
IntGdiSetDCOwnerEx( Dce->hDC, GDI_OBJ_HMGR_POWNED, FALSE);
Dce->ptiOwner = GetW32ThreadInfo(); // Set the temp owning
- Dce->ppiOwner = Dce->ptiOwner->ppi;
- }
+ }
+
+ if ( Wnd &&
+ Wnd->ExStyle & WS_EX_LAYOUTRTL &&
+ !(Flags & DCX_KEEPLAYOUT) )
+ {
+ NtGdiSetLayout(Dce->hDC, -1, LAYOUT_RTL);
+ }
+
+ if (Dce->DCXFlags & DCX_PROCESSOWNED)
+ {
+ ppi = PsGetCurrentProcessWin32Process();
+ ppi->W32PF_flags |= W32PF_OWNDCCLEANUP;
+ Dce->ptiOwner = NULL;
+ Dce->ppiOwner = ppi;
+ }
+
return(Dce->hDC);
}
@@ -726,7 +733,6 @@
}
if (NULL != dc->rosdc.hClipRgn)
{
- int FASTCALL CLIPPING_UpdateGCRegion(DC* Dc);
NtGdiOffsetRgn(dc->rosdc.hClipRgn, DeltaX, DeltaY);
CLIPPING_UpdateGCRegion(dc);
}