Author: jgardou Date: Mon Apr 19 15:52:37 2010 New Revision: 46937
URL: http://svn.reactos.org/svn/reactos?rev=46937&view=rev Log: [WIN32K] - Update direct DCs surface before blit if needed - call directly ppdev in MouseSafetyOnDraw{Start,End} - use directly the PDEVOBJ surface in mouse operations - Add some mouse-related sanity checks
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/mouse.c branches/reactos-yarotows/subsystems/win32/win32k/include/mouse.h branches/reactos-yarotows/subsystems/win32/win32k/objects/dclife.c
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/mouse.c URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/eng/mouse.c [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/eng/mouse.c [iso-8859-1] Mon Apr 19 15:52:37 2010 @@ -37,23 +37,17 @@ */ INT INTERNAL_CALL MouseSafetyOnDrawStart( - SURFOBJ *pso, + PPDEVOBJ ppdev, LONG HazardX1, LONG HazardY1, LONG HazardX2, LONG HazardY2) { LONG tmp; - PDEVOBJ *ppdev; GDIPOINTER *pgp;
- ASSERT(pso != NULL); - - ppdev = GDIDEV(pso); - if (ppdev == NULL) - { - return FALSE; - } + ASSERT(ppdev != NULL); + ASSERT(ppdev->pSurface != NULL);
pgp = &ppdev->Pointer;
@@ -88,7 +82,7 @@ && pgp->Exclude.top <= HazardY2) { ppdev->SafetyRemoveLevel = ppdev->SafetyRemoveCount; - ppdev->pfnMovePointer(pso, -1, -1, NULL); + ppdev->pfnMovePointer(&ppdev->pSurface->SurfObj, -1, -1, NULL); }
return(TRUE); @@ -99,19 +93,12 @@ */ INT INTERNAL_CALL MouseSafetyOnDrawEnd( - SURFOBJ *pso) -{ - PDEVOBJ *ppdev; + PPDEVOBJ ppdev) +{ GDIPOINTER *pgp;
- ASSERT(pso != NULL); - - ppdev = (PDEVOBJ*)pso->hdev; - - if (ppdev == NULL) - { - return(FALSE); - } + ASSERT(ppdev != NULL); + ASSERT(ppdev->pSurface != NULL);
pgp = &ppdev->Pointer;
@@ -125,7 +112,7 @@ return FALSE; }
- ppdev->pfnMovePointer(pso, gpsi->ptCursor.x, gpsi->ptCursor.y, &pgp->Exclude); + ppdev->pfnMovePointer(&ppdev->pSurface->SurfObj, gpsi->ptCursor.x, gpsi->ptCursor.y, &pgp->Exclude);
ppdev->SafetyRemoveLevel = 0;
@@ -635,7 +622,9 @@ return 0; }
- psurf = pdc->dclevel.pSurface; + ASSERT(pdc->dctype == DCTYPE_DIRECT); + /* We're not sure DC surface is the good one */ + psurf = pdc->ppdev->pSurface; if (!psurf) { DPRINT1("DC has no surface.\n"); @@ -710,12 +699,13 @@ DPRINT1("Failed to lock the DC.\n"); return; } + ASSERT(pdc->dctype == DCTYPE_DIRECT);
/* Store the cursor exclude position in the PDEV */ prcl = &pdc->ppdev->Pointer.Exclude;
/* Call Eng/Drv function */ - IntEngMovePointer(&pdc->dclevel.pSurface->SurfObj, x, y, prcl); + IntEngMovePointer(&pdc->ppdev->pSurface->SurfObj, x, y, prcl);
/* Unlock the DC */ DC_UnlockDc(pdc);
Modified: branches/reactos-yarotows/subsystems/win32/win32k/include/mouse.h URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/include/mouse.h [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/include/mouse.h [iso-8859-1] Mon Apr 19 15:52:37 2010 @@ -2,8 +2,8 @@
#include <include/winsta.h>
-INT INTERNAL_CALL MouseSafetyOnDrawStart(SURFOBJ *SurfObj, LONG HazardX1, LONG HazardY1, LONG HazardX2, LONG HazardY2); -INT INTERNAL_CALL MouseSafetyOnDrawEnd(SURFOBJ *SurfObj); +INT INTERNAL_CALL MouseSafetyOnDrawStart(PPDEVOBJ ppdev, LONG HazardX1, LONG HazardY1, LONG HazardX2, LONG HazardY2); +INT INTERNAL_CALL MouseSafetyOnDrawEnd(PPDEVOBJ ppdev);
#ifndef XBUTTON1 #define XBUTTON1 (0x01)
Modified: branches/reactos-yarotows/subsystems/win32/win32k/objects/dclife.c URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] Mon Apr 19 15:52:37 2010 @@ -493,20 +493,32 @@ if(pdcFirst && pdcFirst->dctype == DCTYPE_DIRECT) { EngAcquireSemaphore(pdcFirst->ppdev->hsemDevLock); - MouseSafetyOnDrawStart(&pdcFirst->dclevel.pSurface->SurfObj, + MouseSafetyOnDrawStart(pdcFirst->ppdev, prcFirst->left, prcFirst->top, prcFirst->right, prcFirst->bottom) ; + /* Update surface if needed */ + if(pdcFirst->ppdev->pSurface != pdcFirst->dclevel.pSurface) + { + SURFACE_ShareUnlockSurface(pdcFirst->dclevel.pSurface); + pdcFirst->dclevel.pSurface = PDEVOBJ_pSurface(pdcFirst->ppdev); + } } if(pdcSecond && pdcSecond->dctype == DCTYPE_DIRECT) { EngAcquireSemaphore(pdcSecond->ppdev->hsemDevLock); - MouseSafetyOnDrawStart(&pdcSecond->dclevel.pSurface->SurfObj, + MouseSafetyOnDrawStart(pdcSecond->ppdev, prcSecond->left, prcSecond->top, prcSecond->right, prcSecond->bottom) ; + /* Update surface if needed */ + if(pdcSecond->ppdev->pSurface != pdcSecond->dclevel.pSurface) + { + SURFACE_ShareUnlockSurface(pdcSecond->dclevel.pSurface); + pdcSecond->dclevel.pSurface = PDEVOBJ_pSurface(pdcSecond->ppdev); + } } }
@@ -517,7 +529,7 @@ { if(pdc1->dctype == DCTYPE_DIRECT) { - MouseSafetyOnDrawEnd(&pdc1->dclevel.pSurface->SurfObj); + MouseSafetyOnDrawEnd(pdc1->ppdev); EngReleaseSemaphore(pdc1->ppdev->hsemDevLock); }
@@ -525,7 +537,7 @@ { if(pdc2->dctype == DCTYPE_DIRECT) { - MouseSafetyOnDrawEnd(&pdc2->dclevel.pSurface->SurfObj); + MouseSafetyOnDrawEnd(pdc2->ppdev); EngReleaseSemaphore(pdc2->ppdev->hsemDevLock); } }