From: Jérôme Gardou Date: Mon, 19 Apr 2010 13:52:37 +0000 (+0000) Subject: [WIN32K] X-Git-Tag: backups/reactos-yarotows@57446~164 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=e918eb7c296b0af0743ed0d06292ed35272cbccf [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 svn path=/branches/reactos-yarotows/; revision=46937 --- diff --git a/subsystems/win32/win32k/eng/mouse.c b/subsystems/win32/win32k/eng/mouse.c index ab65381ac2b..ec6c3b4d3c9 100644 --- a/subsystems/win32/win32k/eng/mouse.c +++ b/subsystems/win32/win32k/eng/mouse.c @@ -37,23 +37,17 @@ EngSetPointerTag( */ 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 @@ MouseSafetyOnDrawStart( && 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 @@ MouseSafetyOnDrawStart( */ INT INTERNAL_CALL MouseSafetyOnDrawEnd( - SURFOBJ *pso) + PPDEVOBJ ppdev) { - PDEVOBJ *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 @@ MouseSafetyOnDrawEnd( 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 @@ GreSetPointerShape( 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 @@ GreMovePointer( 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); diff --git a/subsystems/win32/win32k/include/mouse.h b/subsystems/win32/win32k/include/mouse.h index 0e5f68b9626..306148bef30 100644 --- a/subsystems/win32/win32k/include/mouse.h +++ b/subsystems/win32/win32k/include/mouse.h @@ -2,8 +2,8 @@ #include -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) diff --git a/subsystems/win32/win32k/objects/dclife.c b/subsystems/win32/win32k/objects/dclife.c index 56fb2fa7696..d2304b566f1 100644 --- a/subsystems/win32/win32k/objects/dclife.c +++ b/subsystems/win32/win32k/objects/dclife.c @@ -493,20 +493,32 @@ DC_vPrepareDCsForBlit(PDC pdc1, 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 @@ DC_vFinishBlit(PDC pdc1, PDC pdc2) { if(pdc1->dctype == DCTYPE_DIRECT) { - MouseSafetyOnDrawEnd(&pdc1->dclevel.pSurface->SurfObj); + MouseSafetyOnDrawEnd(pdc1->ppdev); EngReleaseSemaphore(pdc1->ppdev->hsemDevLock); } @@ -525,7 +537,7 @@ DC_vFinishBlit(PDC pdc1, PDC pdc2) { if(pdc2->dctype == DCTYPE_DIRECT) { - MouseSafetyOnDrawEnd(&pdc2->dclevel.pSurface->SurfObj); + MouseSafetyOnDrawEnd(pdc2->ppdev); EngReleaseSemaphore(pdc2->ppdev->hsemDevLock); } }