Author: tkreuzer
Date: Tue Apr 7 05:36:22 2009
New Revision: 40409
URL:
http://svn.reactos.org/svn/reactos?rev=40409&view=rev
Log:
Mouse pointer fix:
- Remove useless Status from the GDIPOINTER struct
- Remove MovePointer and use PDEVOBJ.pfnMovePointer instead, which is always set to a
valid function.
- Implement IntEngSetPointerShape, calling either the Eng or the Drv function if
available, set pfnMovePointer according to the result.
- Use IntEngSetPointerShape instead of doing the atuff in IntSetCursor.
- Don't misuse gpsi->ptCursor in IntShow/HideMousePointer and EngMovePointer, use
ppdev->ptlPointer instead.
- Dont Lock and unlock the surface evertime the pointer is drwn, instead keep a shared
lock.
- Implement IntEngCopyBits, that does the MouseSafety stuff and calls EngCopyBits.
Fixes the broken mouse cursor with VBox display driver and improves mouse performance
Modified:
trunk/reactos/subsystems/win32/win32k/eng/copybits.c
trunk/reactos/subsystems/win32/win32k/eng/mouse.c
trunk/reactos/subsystems/win32/win32k/include/inteng.h
trunk/reactos/subsystems/win32/win32k/include/pdevobj.h
trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c
trunk/reactos/subsystems/win32/win32k/objects/device.c
trunk/reactos/subsystems/win32/win32k/objects/dibobj.c
Modified: trunk/reactos/subsystems/win32/win32k/eng/copybits.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/en…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/eng/copybits.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/eng/copybits.c [iso-8859-1] Tue Apr 7 05:36:22
2009
@@ -54,17 +54,12 @@
psurfSource = CONTAINING_RECORD(psoSource, SURFACE, SurfObj);
SURFACE_LockBitmapBits(psurfSource);
- MouseSafetyOnDrawStart(psoSource, SourcePoint->x, SourcePoint->y,
- (SourcePoint->x + abs(DestRect->right -
DestRect->left)),
- (SourcePoint->y + abs(DestRect->bottom -
DestRect->top)));
psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
if (psoDest != psoSource)
{
SURFACE_LockBitmapBits(psurfDest);
}
-
- MouseSafetyOnDrawStart(psoDest, DestRect->left, DestRect->top,
DestRect->right, DestRect->bottom);
// FIXME: Don't punt to the driver's DrvCopyBits immediately. Instead,
// mark the copy block function to be DrvCopyBits instead of the
@@ -83,12 +78,10 @@
ret = GDIDEVFUNCS(psoDest).CopyBits(
psoDest, psoSource, Clip, ColorTranslation, DestRect, SourcePoint);
- MouseSafetyOnDrawEnd(psoDest);
- if (psoDest != psoSource)
- {
- SURFACE_UnlockBitmapBits(psurfDest);
- }
- MouseSafetyOnDrawEnd(psoSource);
+ if (psoDest != psoSource)
+ {
+ SURFACE_UnlockBitmapBits(psurfDest);
+ }
SURFACE_UnlockBitmapBits(psurfSource);
return ret;
@@ -104,12 +97,10 @@
ret = GDIDEVFUNCS(psoSource).CopyBits(
psoDest, psoSource, Clip, ColorTranslation, DestRect, SourcePoint);
- MouseSafetyOnDrawEnd(psoDest);
- if (psoDest != psoSource)
- {
- SURFACE_UnlockBitmapBits(psurfDest);
- }
- MouseSafetyOnDrawEnd(psoSource);
+ if (psoDest != psoSource)
+ {
+ SURFACE_UnlockBitmapBits(psurfDest);
+ }
SURFACE_UnlockBitmapBits(psurfSource);
return ret;
@@ -121,12 +112,10 @@
NULL, Clip, ColorTranslation, DestRect, SourcePoint,
NULL, NULL, NULL, ROP3_TO_ROP4(SRCCOPY));
- MouseSafetyOnDrawEnd(psoDest);
if (psoDest != psoSource)
{
SURFACE_UnlockBitmapBits(psurfDest);
}
- MouseSafetyOnDrawEnd(psoSource);
SURFACE_UnlockBitmapBits(psurfSource);
return ret;
@@ -160,7 +149,6 @@
{
SURFACE_UnlockBitmapBits(psurfDest);
}
- MouseSafetyOnDrawEnd(psoSource);
SURFACE_UnlockBitmapBits(psurfSource);
return(TRUE);
@@ -174,12 +162,10 @@
DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_BitBltSrcCopy(&BltInfo);
- MouseSafetyOnDrawEnd(psoDest);
- if (psoDest != psoSource)
- {
- SURFACE_UnlockBitmapBits(psurfDest);
- }
- MouseSafetyOnDrawEnd(psoSource);
+ if (psoDest != psoSource)
+ {
+ SURFACE_UnlockBitmapBits(psurfDest);
+ }
SURFACE_UnlockBitmapBits(psurfSource);
return(TRUE);
@@ -212,26 +198,48 @@
} while(EnumMore);
- MouseSafetyOnDrawEnd(psoDest);
if (psoDest != psoSource)
{
SURFACE_UnlockBitmapBits(psurfDest);
}
- MouseSafetyOnDrawEnd(psoSource);
SURFACE_UnlockBitmapBits(psurfSource);
return(TRUE);
}
- MouseSafetyOnDrawEnd(psoDest);
if (psoDest != psoSource)
{
SURFACE_UnlockBitmapBits(psurfDest);
}
- MouseSafetyOnDrawEnd(psoSource);
SURFACE_UnlockBitmapBits(psurfSource);
return FALSE;
}
+BOOL APIENTRY
+IntEngCopyBits(
+ SURFOBJ *psoDest,
+ SURFOBJ *psoSource,
+ CLIPOBJ *pco,
+ XLATEOBJ *pxlo,
+ RECTL *prclDest,
+ POINTL *ptlSource)
+{
+ BOOL bResult;
+
+ MouseSafetyOnDrawStart(psoSource, ptlSource->x, ptlSource->y,
+ (ptlSource->x + abs(prclDest->right -
prclDest->left)),
+ (ptlSource->y + abs(prclDest->bottom -
prclDest->top)));
+
+ MouseSafetyOnDrawStart(psoDest, prclDest->left, prclDest->top,
prclDest->right, prclDest->bottom);
+
+ bResult = EngCopyBits(psoDest, psoSource, pco, pxlo, prclDest, ptlSource);
+
+ MouseSafetyOnDrawEnd(psoDest);
+ MouseSafetyOnDrawEnd(psoSource);
+
+ return bResult;
+}
+
+
/* EOF */
Modified: trunk/reactos/subsystems/win32/win32k/eng/mouse.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/en…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/eng/mouse.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/eng/mouse.c [iso-8859-1] Tue Apr 7 05:36:22
2009
@@ -3,6 +3,7 @@
* PURPOSE: Mouse pointer functions
* FILE: subsystems/win32k/eng/mouse.c
* PROGRAMER: Casper S. Hornstrup (chorns(a)users.sourceforge.net)
+ * Timo Kreuzer (timo.kreuzer(a)reactos.org)
* REVISION HISTORY:
* 06-06-2001 CSH Created
*/
@@ -21,7 +22,7 @@
*/
INT INTERNAL_CALL
MouseSafetyOnDrawStart(
- SURFOBJ *SurfObj,
+ SURFOBJ *pso,
LONG HazardX1,
LONG HazardY1,
LONG HazardX2,
@@ -31,20 +32,26 @@
PDEVOBJ *ppdev;
GDIPOINTER *pgp;
- ASSERT(SurfObj != NULL);
-
- ppdev = GDIDEV(SurfObj);
+ ASSERT(pso != NULL);
+
+ ppdev = GDIDEV(pso);
if (ppdev == NULL)
{
- return(FALSE);
+ return FALSE;
}
pgp = &ppdev->Pointer;
- if (SPS_ACCEPT_NOEXCLUDE == pgp->Status ||
- pgp->Exclude.right == -1)
- {
- return(FALSE);
+ if (pgp->Exclude.right == -1)
+ {
+ return FALSE;
+ }
+
+ ppdev->SafetyRemoveCount++;
+
+ if (ppdev->SafetyRemoveLevel != 0)
+ {
+ return FALSE;
}
if (HazardX1 > HazardX2)
@@ -59,14 +66,6 @@
HazardY2 = HazardY1;
HazardY1 = tmp;
}
-
- if (ppdev->SafetyRemoveLevel != 0)
- {
- ppdev->SafetyRemoveCount++;
- return FALSE;
- }
-
- ppdev->SafetyRemoveCount++;
if (pgp->Exclude.right >= HazardX1
&& pgp->Exclude.left <= HazardX2
@@ -74,10 +73,7 @@
&& pgp->Exclude.top <= HazardY2)
{
ppdev->SafetyRemoveLevel = ppdev->SafetyRemoveCount;
- if (pgp->MovePointer)
- pgp->MovePointer(SurfObj, -1, -1, NULL);
- else
- EngMovePointer(SurfObj, -1, -1, NULL);
+ ppdev->pfnMovePointer(pso, -1, -1, NULL);
}
return(TRUE);
@@ -88,14 +84,14 @@
*/
INT INTERNAL_CALL
MouseSafetyOnDrawEnd(
- SURFOBJ *SurfObj)
+ SURFOBJ *pso)
{
PDEVOBJ *ppdev;
GDIPOINTER *pgp;
- ASSERT(SurfObj != NULL);
-
- ppdev = GDIDEV(SurfObj);
+ ASSERT(pso != NULL);
+
+ ppdev = (PDEVOBJ*)pso->hdev;
if (ppdev == NULL)
{
@@ -104,8 +100,7 @@
pgp = &ppdev->Pointer;
- if (SPS_ACCEPT_NOEXCLUDE == pgp->Status ||
- pgp->Exclude.right == -1)
+ if (pgp->Exclude.right == -1)
{
return FALSE;
}
@@ -114,10 +109,8 @@
{
return FALSE;
}
- if (pgp->MovePointer)
- pgp->MovePointer(SurfObj, gpsi->ptCursor.x, gpsi->ptCursor.y,
&pgp->Exclude);
- else
- EngMovePointer(SurfObj, gpsi->ptCursor.x, gpsi->ptCursor.y,
&pgp->Exclude);
+
+ ppdev->pfnMovePointer(pso, gpsi->ptCursor.x, gpsi->ptCursor.y,
&pgp->Exclude);
ppdev->SafetyRemoveLevel = 0;
@@ -126,13 +119,16 @@
/* SOFTWARE MOUSE POINTER IMPLEMENTATION **************************************/
-VOID INTERNAL_CALL
+VOID
+INTERNAL_CALL
IntHideMousePointer(
PDEVOBJ *ppdev,
SURFOBJ *psoDest)
{
GDIPOINTER *pgp;
POINTL pt;
+ RECTL rclDest;
+ POINTL ptlSave;
ASSERT(ppdev);
ASSERT(psoDest);
@@ -149,53 +145,48 @@
/* The mouse is hide from ShowCours and it is frist ?? */
if (pgp->ShowPointer < 0)
{
- return ;
- }
-
- /* Hide the cours */
- pt.x = gpsi->ptCursor.x - pgp->HotSpot.x;
- pt.y = gpsi->ptCursor.y - pgp->HotSpot.y;
-
-
- if (pgp->SaveSurface != NULL)
- {
- RECTL DestRect;
- POINTL SrcPoint;
- SURFOBJ *SaveSurface;
- SURFOBJ *MaskSurface;
-
- DestRect.left = max(pt.x, 0);
- DestRect.top = max(pt.y, 0);
- DestRect.right = min(
- pt.x + pgp->Size.cx,
- psoDest->sizlBitmap.cx);
- DestRect.bottom = min(
- pt.y + pgp->Size.cy,
- psoDest->sizlBitmap.cy);
-
- SrcPoint.x = max(-pt.x, 0);
- SrcPoint.y = max(-pt.y, 0);
-
- if ((SaveSurface = EngLockSurface(pgp->SaveSurface)))
- {
- if ((MaskSurface = EngLockSurface(pgp->MaskSurface)))
- {
- IntEngBitBltEx(psoDest, SaveSurface, MaskSurface, NULL, NULL,
- &DestRect, &SrcPoint, &SrcPoint, NULL, NULL,
- ROP3_TO_ROP4(SRCCOPY), FALSE);
- EngUnlockSurface(MaskSurface);
- }
- EngUnlockSurface(SaveSurface);
- }
- }
-}
-
-VOID INTERNAL_CALL
+ return;
+ }
+
+ if (!pgp->psurfSave)
+ {
+ DPRINT1("No SaveSurface!\n");
+ return;
+ }
+
+ /* Calculate cursor coordinates */
+ pt.x = ppdev->ptlPointer.x - pgp->HotSpot.x;
+ pt.y = ppdev->ptlPointer.y - pgp->HotSpot.y;
+
+ rclDest.left = max(pt.x, 0);
+ rclDest.top = max(pt.y, 0);
+ rclDest.right = min(pt.x + pgp->Size.cx, psoDest->sizlBitmap.cx);
+ rclDest.bottom = min(pt.y + pgp->Size.cy, psoDest->sizlBitmap.cy);
+
+ ptlSave.x = rclDest.left - pt.x;
+ ptlSave.y = rclDest.top - pt.y;
+
+ IntEngBitBltEx(psoDest,
+ &pgp->psurfSave->SurfObj,
+ NULL,
+ NULL,
+ NULL,
+ &rclDest,
+ &ptlSave,
+ &ptlSave,
+ NULL,
+ NULL,
+ ROP3_TO_ROP4(SRCCOPY),
+ FALSE);
+}
+
+VOID
+INTERNAL_CALL
IntShowMousePointer(PDEVOBJ *ppdev, SURFOBJ *psoDest)
{
GDIPOINTER *pgp;
- SURFOBJ *SaveSurface;
POINTL pt;
+ RECTL rclSurf, rclPointer;
ASSERT(ppdev);
ASSERT(psoDest);
@@ -209,87 +200,87 @@
pgp->Enabled = TRUE;
- /* Do not blt the mouse if it in hide */
+ /* Do not blt the pointer, if it is hidden */
if (pgp->ShowPointer < 0)
{
return ;
}
- pt.x = gpsi->ptCursor.x - pgp->HotSpot.x;
- pt.y = gpsi->ptCursor.y - pgp->HotSpot.y;
+ /* Calculate pointer coordinates */
+ pt.x = ppdev->ptlPointer.x - pgp->HotSpot.x;
+ pt.y = ppdev->ptlPointer.y - pgp->HotSpot.y;
+
+ /* Calculate the rect on the surface */
+ rclSurf.left = max(pt.x, 0);
+ rclSurf.top = max(pt.y, 0);
+ rclSurf.right = min(pt.x + pgp->Size.cx, psoDest->sizlBitmap.cx);
+ rclSurf.bottom = min(pt.y + pgp->Size.cy, psoDest->sizlBitmap.cy);
+
+ /* Calculate the rect in the pointer bitmap */
+ rclPointer.left = rclSurf.left - pt.x;
+ rclPointer.top = rclSurf.top - pt.y;
+ rclPointer.right = min(pgp->Size.cx, psoDest->sizlBitmap.cx - pt.x);
+ rclPointer.bottom = min(pgp->Size.cy, psoDest->sizlBitmap.cy - pt.y);
/* Copy the pixels under the cursor to temporary surface. */
- if (pgp->SaveSurface != NULL &&
- (SaveSurface = EngLockSurface(pgp->SaveSurface)))
- {
- RECTL DestRect;
- POINTL SrcPoint;
-
- SrcPoint.x = max(pt.x, 0);
- SrcPoint.y = max(pt.y, 0);
-
- DestRect.left = SrcPoint.x - pt.x;
- DestRect.top = SrcPoint.y - pt.y;
- DestRect.right = min(
- pgp->Size.cx,
- psoDest->sizlBitmap.cx - pt.x);
- DestRect.bottom = min(
- pgp->Size.cy,
- psoDest->sizlBitmap.cy - pt.y);
-
- IntEngBitBltEx(SaveSurface, psoDest, NULL, NULL, NULL,
- &DestRect, &SrcPoint, NULL, NULL, NULL,
- ROP3_TO_ROP4(SRCCOPY), FALSE);
- EngUnlockSurface(SaveSurface);
- }
-
-
- /* Blit the cursor on the screen. */
- {
- RECTL DestRect;
- POINTL SrcPoint;
- SURFOBJ *psoColor;
- SURFOBJ *psoMask = NULL;
-
- DestRect.left = max(pt.x, 0);
- DestRect.top = max(pt.y, 0);
- DestRect.right = min(
- pt.x + pgp->Size.cx,
- psoDest->sizlBitmap.cx);
- DestRect.bottom = min(
- pt.y + pgp->Size.cy,
- psoDest->sizlBitmap.cy);
-
- SrcPoint.x = max(-pt.x, 0);
- SrcPoint.y = max(-pt.y, 0);
-
- if (pgp->MaskSurface)
- psoMask = EngLockSurface(pgp->MaskSurface);
-
- if (psoMask != NULL)
- {
- if (pgp->ColorSurface != NULL)
- {
- if ((psoColor = EngLockSurface(pgp->ColorSurface)))
- {
- IntEngBitBltEx(psoDest, psoColor, psoMask, NULL,
- pgp->XlateObject, &DestRect, &SrcPoint,
&SrcPoint,
- NULL, NULL, R4_MASK, FALSE);
- EngUnlockSurface(psoColor);
- }
- }
- else
- {
- IntEngBitBltEx(psoDest, psoMask, NULL, NULL, pgp->XlateObject,
- &DestRect, &SrcPoint, NULL, NULL, NULL,
- ROP3_TO_ROP4(SRCAND), FALSE);
- SrcPoint.y += pgp->Size.cy;
- IntEngBitBltEx(psoDest, psoMask, NULL, NULL, pgp->XlateObject,
- &DestRect, &SrcPoint, NULL, NULL, NULL,
- ROP3_TO_ROP4(SRCINVERT), FALSE);
- }
- EngUnlockSurface(psoMask);
- }
+ IntEngBitBltEx(&pgp->psurfSave->SurfObj,
+ psoDest,
+ NULL,
+ NULL,
+ NULL,
+ &rclPointer,
+ (POINTL*)&rclSurf,
+ NULL,
+ NULL,
+ NULL,
+ ROP3_TO_ROP4(SRCCOPY),
+ FALSE);
+
+ /* Blt the pointer on the screen. */
+ if (pgp->psurfColor)
+ {
+ IntEngBitBltEx(psoDest,
+ &pgp->psurfColor->SurfObj,
+ &pgp->psurfMask->SurfObj,
+ NULL,
+ pgp->XlateObject,
+ &rclSurf,
+ (POINTL*)&rclPointer,
+ (POINTL*)&rclPointer,
+ NULL,
+ NULL,
+ R4_MASK,
+ FALSE);
+ }
+ else
+ {
+ IntEngBitBltEx(psoDest,
+ &pgp->psurfMask->SurfObj,
+ NULL,
+ NULL,
+ pgp->XlateObject,
+ &rclSurf,
+ (POINTL*)&rclPointer,
+ NULL,
+ NULL,
+ NULL,
+ ROP3_TO_ROP4(SRCAND),
+ FALSE);
+
+ rclPointer.top += pgp->Size.cy;
+
+ IntEngBitBltEx(psoDest,
+ &pgp->psurfMask->SurfObj,
+ NULL,
+ NULL,
+ pgp->XlateObject,
+ &rclSurf,
+ (POINTL*)&rclPointer,
+ NULL,
+ NULL,
+ NULL,
+ ROP3_TO_ROP4(SRCINVERT),
+ FALSE);
}
}
@@ -310,8 +301,11 @@
IN FLONG fl)
{
PDEVOBJ *ppdev;
- SURFOBJ *psoTemp;
GDIPOINTER *pgp;
+ PBYTE Bits;
+ SIZEL Size;
+ LONG lDelta;
+ HBITMAP hbmp;
ASSERT(pso);
@@ -320,38 +314,33 @@
IntHideMousePointer(ppdev, pso);
- if (pgp->ColorSurface != NULL)
- {
- /* FIXME: Is this really needed? */
- if ((psoTemp = EngLockSurface(pgp->ColorSurface)))
- {
- EngFreeMem(psoTemp->pvBits);
- psoTemp->pvBits = 0;
- EngUnlockSurface(psoTemp);
- }
-
- EngDeleteSurface(pgp->ColorSurface);
- pgp->MaskSurface = NULL;
- }
-
- if (pgp->MaskSurface != NULL)
- {
- /* FIXME: Is this really needed? */
- if ((psoTemp = EngLockSurface(pgp->MaskSurface)))
- {
- EngFreeMem(psoTemp->pvBits);
- psoTemp->pvBits = 0;
- EngUnlockSurface(psoTemp);
- }
-
- EngDeleteSurface(pgp->MaskSurface);
- pgp->MaskSurface = NULL;
- }
-
- if (pgp->SaveSurface != NULL)
- {
- EngDeleteSurface(pgp->SaveSurface);
- pgp->SaveSurface = NULL;
+ if (pgp->psurfColor)
+ {
+ /* FIXME: let GDI allocate/free memory */
+ EngFreeMem(pgp->psurfColor->SurfObj.pvBits);
+ pgp->psurfColor->SurfObj.pvBits = 0;
+
+ EngDeleteSurface(pgp->psurfColor->BaseObject.hHmgr);
+ SURFACE_ShareUnlockSurface(pgp->psurfColor);
+ pgp->psurfColor = NULL;
+ }
+
+ if (pgp->psurfMask)
+ {
+ /* FIXME: let GDI allocate/free memory */
+ EngFreeMem(pgp->psurfMask->SurfObj.pvBits);
+ pgp->psurfMask->SurfObj.pvBits = 0;
+
+ EngDeleteSurface(pgp->psurfMask->BaseObject.hHmgr);
+ SURFACE_ShareUnlockSurface(pgp->psurfMask);
+ pgp->psurfMask = NULL;
+ }
+
+ if (pgp->psurfSave != NULL)
+ {
+ EngDeleteSurface(pgp->psurfSave->BaseObject.hHmgr);
+ SURFACE_ShareUnlockSurface(pgp->psurfSave);
+ pgp->psurfSave = NULL;
}
if (pgp->XlateObject != NULL)
@@ -369,12 +358,10 @@
pgp->HotSpot.x = xHot;
pgp->HotSpot.y = yHot;
- /* Actually this should be set by 'the other side', but it would be
- * done right after this. It helps IntShowMousePointer. */
if (x != -1)
{
- gpsi->ptCursor.x = x;
- gpsi->ptCursor.y = y;
+ ppdev->ptlPointer.x = x;
+ ppdev->ptlPointer.y = y;
}
pgp->Size.cx = abs(psoMask->lDelta) << 3;
@@ -382,8 +369,7 @@
if (psoColor != NULL)
{
- PBYTE Bits;
-
+ /* FIXME: let GDI allocate/free memory */
Bits = EngAllocMem(0, psoColor->cjBits, TAG_MOUSE);
if (Bits == NULL)
{
@@ -392,33 +378,36 @@
memcpy(Bits, psoColor->pvBits, psoColor->cjBits);
- pgp->ColorSurface = (HSURF)EngCreateBitmap(pgp->Size,
- psoColor->lDelta, psoColor->iBitmapFormat,
- psoColor->lDelta < 0 ? 0 : BMF_TOPDOWN, Bits);
+ hbmp = EngCreateBitmap(pgp->Size,
+ psoColor->lDelta,
+ psoColor->iBitmapFormat,
+ psoColor->lDelta < 0 ? 0 : BMF_TOPDOWN,
+ Bits);
+
+ pgp->psurfColor = SURFACE_ShareLockSurface(hbmp);
}
else
{
- pgp->ColorSurface = NULL;
- }
-
- {
- SIZEL Size;
- PBYTE Bits;
-
- Size.cx = pgp->Size.cx;
- Size.cy = pgp->Size.cy << 1;
- Bits = EngAllocMem(0, psoMask->cjBits, TAG_MOUSE);
- if (Bits == NULL)
- {
- return SPS_ERROR;
- }
-
- memcpy(Bits, psoMask->pvBits, psoMask->cjBits);
-
- pgp->MaskSurface = (HSURF)EngCreateBitmap(Size,
- psoMask->lDelta, psoMask->iBitmapFormat,
- psoMask->lDelta < 0 ? 0 : BMF_TOPDOWN, Bits);
- }
+ pgp->psurfColor = NULL;
+ }
+
+ Size.cx = pgp->Size.cx;
+ Size.cy = pgp->Size.cy << 1;
+ Bits = EngAllocMem(0, psoMask->cjBits, TAG_MOUSE);
+ if (Bits == NULL)
+ {
+ return SPS_ERROR;
+ }
+
+ memcpy(Bits, psoMask->pvBits, psoMask->cjBits);
+
+ hbmp = EngCreateBitmap(Size,
+ psoMask->lDelta,
+ psoMask->iBitmapFormat,
+ psoMask->lDelta < 0 ? 0 : BMF_TOPDOWN,
+ Bits);
+
+ pgp->psurfMask = SURFACE_ShareLockSurface(hbmp);
/* Create an XLATEOBJ that will be used for drawing masks.
* FIXME: We should get this in pxlo parameter! */
@@ -441,39 +430,38 @@
}
/* Create surface for saving the pixels under the cursor. */
- {
- LONG lDelta;
-
- switch (pso->iBitmapFormat)
- {
- case BMF_1BPP:
- lDelta = pgp->Size.cx >> 3;
- break;
- case BMF_4BPP:
- lDelta = pgp->Size.cx >> 1;
- break;
- case BMF_8BPP:
- lDelta = pgp->Size.cx;
- break;
- case BMF_16BPP:
- lDelta = pgp->Size.cx << 1;
- break;
- case BMF_24BPP:
- lDelta = pgp->Size.cx * 3;
- break;
- case BMF_32BPP:
- lDelta = pgp->Size.cx << 2;
- break;
- default:
- lDelta = 0;
- break;
- }
-
- pgp->SaveSurface = (HSURF)EngCreateBitmap(pgp->Size,
- lDelta,
- pso->iBitmapFormat,
- BMF_TOPDOWN | BMF_NOZEROINIT, NULL);
- }
+ switch (pso->iBitmapFormat)
+ {
+ case BMF_1BPP:
+ lDelta = pgp->Size.cx >> 3;
+ break;
+ case BMF_4BPP:
+ lDelta = pgp->Size.cx >> 1;
+ break;
+ case BMF_8BPP:
+ lDelta = pgp->Size.cx;
+ break;
+ case BMF_16BPP:
+ lDelta = pgp->Size.cx << 1;
+ break;
+ case BMF_24BPP:
+ lDelta = pgp->Size.cx * 3;
+ break;
+ case BMF_32BPP:
+ lDelta = pgp->Size.cx << 2;
+ break;
+ default:
+ lDelta = 0;
+ break;
+ }
+
+ hbmp = EngCreateBitmap(pgp->Size,
+ lDelta,
+ pso->iBitmapFormat,
+ BMF_TOPDOWN | BMF_NOZEROINIT,
+ NULL);
+
+ pgp->psurfSave = SURFACE_ShareLockSurface(hbmp);
if (x != -1)
{
@@ -489,7 +477,7 @@
} else if (prcl != NULL)
prcl->left = prcl->top = prcl->right = prcl->bottom = -1;
- return SPS_ACCEPT_EXCLUDE;
+ return SPS_ACCEPT_NOEXCLUDE;
}
/*
@@ -509,18 +497,17 @@
ASSERT(pso);
ppdev = GDIDEV(pso);
-
ASSERT(ppdev);
pgp = &ppdev->Pointer;
IntHideMousePointer(ppdev, pso);
+
+ ppdev->ptlPointer.x = x;
+ ppdev->ptlPointer.y = y;
+
if (x != -1)
{
- /* Actually this should be set by 'the other side', but it would be
- * done right after this. It helps IntShowMousePointer. */
- gpsi->ptCursor.x = x;
- gpsi->ptCursor.y = y;
IntShowMousePointer(ppdev, pso);
if (prcl != NULL)
{
@@ -531,7 +518,6 @@
}
} else if (prcl != NULL)
prcl->left = prcl->top = prcl->right = prcl->bottom = -1;
-
}
VOID APIENTRY
@@ -542,17 +528,74 @@
IN RECTL *prcl)
{
SURFACE *psurf = CONTAINING_RECORD(pso, SURFACE, SurfObj);
+ PPDEVOBJ ppdev = (PPDEVOBJ)pso->hdev;
SURFACE_LockBitmapBits(psurf);
- if (GDIDEV(pso)->Pointer.MovePointer)
- {
- GDIDEV(pso)->Pointer.MovePointer(pso, x, y, prcl);
+ ppdev->pfnMovePointer(pso, x, y, prcl);
+ SURFACE_UnlockBitmapBits(psurf);
+}
+
+ULONG APIENTRY
+IntEngSetPointerShape(
+ IN SURFOBJ *pso,
+ IN SURFOBJ *psoMask,
+ IN SURFOBJ *psoColor,
+ IN XLATEOBJ *pxlo,
+ IN LONG xHot,
+ IN LONG yHot,
+ IN LONG x,
+ IN LONG y,
+ IN RECTL *prcl,
+ IN FLONG fl)
+{
+ ULONG ulResult = SPS_DECLINE;
+ SURFACE *psurf = CONTAINING_RECORD(pso, SURFACE, SurfObj);
+ PFN_DrvSetPointerShape pfnSetPointerShape;
+ PPDEVOBJ ppdev = GDIDEV(pso);
+
+ pfnSetPointerShape = GDIDEVFUNCS(pso).SetPointerShape;
+
+ SURFACE_LockBitmapBits(psurf);
+ if (pfnSetPointerShape)
+ {
+ ulResult = pfnSetPointerShape(pso,
+ psoMask,
+ psoColor,
+ pxlo,
+ xHot,
+ yHot,
+ x,
+ y,
+ prcl,
+ fl);
+ }
+
+ /* Check if the driver accepted it */
+ if (ulResult == SPS_ACCEPT_NOEXCLUDE)
+ {
+ /* Set MovePointer to the driver function */
+ ppdev->pfnMovePointer = GDIDEVFUNCS(pso).MovePointer;
}
else
{
- EngMovePointer(pso, x, y, prcl);
- }
+ /* Set software pointer */
+ ulResult = EngSetPointerShape(pso,
+ psoMask,
+ psoColor,
+ pxlo,
+ xHot,
+ yHot,
+ x,
+ y,
+ prcl,
+ fl);
+ /* Set MovePointer to the eng function */
+ ppdev->pfnMovePointer = EngMovePointer;
+ }
+
SURFACE_UnlockBitmapBits(psurf);
+
+ return ulResult;
}
/* EOF */
Modified: trunk/reactos/subsystems/win32/win32k/include/inteng.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/inteng.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/inteng.h [iso-8859-1] Tue Apr 7
05:36:22 2009
@@ -156,6 +156,19 @@
IN LONG y,
IN RECTL *prcl);
+ULONG APIENTRY
+IntEngSetPointerShape(
+ IN SURFOBJ *pso,
+ IN SURFOBJ *psoMask,
+ IN SURFOBJ *psoColor,
+ IN XLATEOBJ *pxlo,
+ IN LONG xHot,
+ IN LONG yHot,
+ IN LONG x,
+ IN LONG y,
+ IN RECTL *prcl,
+ IN FLONG fl);
+
BOOL APIENTRY
IntEngAlphaBlend(IN SURFOBJ *Dest,
IN SURFOBJ *Source,
@@ -165,5 +178,12 @@
IN PRECTL SourceRect,
IN BLENDOBJ *BlendObj);
+BOOL APIENTRY
+IntEngCopyBits(SURFOBJ *psoDest,
+ SURFOBJ *psoSource,
+ CLIPOBJ *pco,
+ XLATEOBJ *pxlo,
+ RECTL *prclDest,
+ POINTL *ptlSource);
#endif /* _WIN32K_INTENG_H */
Modified: trunk/reactos/subsystems/win32/win32k/include/pdevobj.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/pdevobj.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/pdevobj.h [iso-8859-1] Tue Apr 7
05:36:22 2009
@@ -28,15 +28,13 @@
SIZEL Size;
POINTL HotSpot;
XLATEOBJ *XlateObject;
- HSURF ColorSurface;
- HSURF MaskSurface;
- HSURF SaveSurface;
+ SURFACE *psurfColor;
+ SURFACE *psurfMask;
+ SURFACE *psurfSave;
int ShowPointer; /* counter negtive do not show the mouse postive show the mouse
*/
/* public pointer information */
RECTL Exclude; /* required publicly for SPS_ACCEPT_EXCLUDE */
- PFN_DrvMovePointer MovePointer;
- ULONG Status;
} GDIPOINTER, *PGDIPOINTER;
typedef struct _GRAPHICS_DEVICE
@@ -59,7 +57,7 @@
// FLONG flAccelerated;
PERESOURCE hsemDevLock; /* Device lock. */
// HSEMAPHORE hsemPointer;
-// POINTL ptlPointer;
+ POINTL ptlPointer;
// SIZEL szlPointer;
// SPRITESTATE SpriteState;
// HFONT hlfntDefault;
@@ -80,7 +78,7 @@
// ULONG ulVertRes;
// PFN_DrvSetPointerShape pfnDrvSetPointerShape;
// PFN_DrvMovePointer pfnDrvMovePointer;
-// PFN_DrvMovePointer pfnMovePointer;
+ PFN_DrvMovePointer pfnMovePointer;
// PFN_DrvSynchronize pfnDrvSynchronize;
// PFN_DrvSynchronizeSurface pfnDrvSynchronizeSurface;
// PFN_DrvSetPalette pfnDrvSetPalette;
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c [iso-8859-1] Tue Apr 7
05:36:22 2009
@@ -95,6 +95,7 @@
XLATEOBJ *XlateObj = NULL;
HDC Screen;
PDC dc;
+ ULONG Status;
CurInfo = IntGetSysCursorInfo(WinSta);
OldCursor = CurInfo->CurrentCursorObject;
@@ -137,13 +138,11 @@
UserDereferenceObject(CurInfo->CurrentCursorObject);
if (CurInfo->ShowingCursor)
{
- DPRINT1("Removing pointer!\n");
+ DPRINT("Removing pointer!\n");
/* Remove the cursor if it was displayed */
IntEngMovePointer(pso, -1, -1, &GDIDEV(pso)->Pointer.Exclude);
}
}
-
- GDIDEV(pso)->Pointer.Status = SPS_ACCEPT_NOEXCLUDE;
CurInfo->CurrentCursorObject = NewCursor; /* i.e. CurrentCursorObject = NULL
*/
CurInfo->ShowingCursor = 0;
@@ -212,7 +211,7 @@
return (HCURSOR)0;
}
soMask = EngLockSurface((HSURF)hMask);
- EngCopyBits(soMask, &MaskBmpObj->SurfObj, NULL, NULL,
+ IntEngCopyBits(soMask, &MaskBmpObj->SurfObj, NULL, NULL,
&DestRect, &SourcePoint);
SURFACE_UnlockSurface(MaskBmpObj);
}
@@ -234,40 +233,20 @@
UserDereferenceObject(OldCursor);
}
- if (GDIDEVFUNCS(pso).SetPointerShape)
- {
- GDIDEV(pso)->Pointer.Status =
- GDIDEVFUNCS(pso).SetPointerShape(
- pso, soMask, soColor, XlateObj,
- NewCursor->IconInfo.xHotspot,
- NewCursor->IconInfo.yHotspot,
- gpsi->ptCursor.x,
- gpsi->ptCursor.y,
- &(GDIDEV(pso)->Pointer.Exclude),
- SPS_CHANGE);
- DPRINT("SetCursor: DrvSetPointerShape() returned %x\n",
- GDIDEV(pso)->Pointer.Status);
- }
- else
- {
- GDIDEV(pso)->Pointer.Status = SPS_DECLINE;
- }
-
- if(GDIDEV(pso)->Pointer.Status == SPS_DECLINE)
- {
- GDIDEV(pso)->Pointer.Status = EngSetPointerShape(
- pso, soMask, soColor, XlateObj,
- NewCursor->IconInfo.xHotspot,
- NewCursor->IconInfo.yHotspot,
- gpsi->ptCursor.x,
- gpsi->ptCursor.y,
- &(GDIDEV(pso)->Pointer.Exclude),
- SPS_CHANGE);
- GDIDEV(pso)->Pointer.MovePointer = NULL;
- }
- else
- {
- GDIDEV(pso)->Pointer.MovePointer = GDIDEVFUNCS(pso).MovePointer;
+ Status = IntEngSetPointerShape(pso,
+ soMask,
+ soColor,
+ XlateObj,
+ NewCursor->IconInfo.xHotspot,
+ NewCursor->IconInfo.yHotspot,
+ gpsi->ptCursor.x,
+ gpsi->ptCursor.y,
+ &(GDIDEV(pso)->Pointer.Exclude),
+ SPS_CHANGE);
+
+ if (Status != SPS_ACCEPT_NOEXCLUDE)
+ {
+ DPRINT1("IntEngSetPointerShape returned %lx\n", Status);
}
SURFACE_UnlockSurface(psurf);
@@ -280,9 +259,6 @@
{
EngDeleteXlate(XlateObj);
}
-
- if(GDIDEV(pso)->Pointer.Status == SPS_ERROR)
- DPRINT1("SetCursor: DrvSetPointerShape() returned SPS_ERROR\n");
return Ret;
}
@@ -1804,7 +1780,7 @@
{
//ppdev->SafetyRemoveCount = 1;
//ppdev->SafetyRemoveLevel = 1;
- EngMovePointer(SurfObj,-1,-1,NULL);
+ IntEngMovePointer(SurfObj,-1,-1,NULL);
CurInfo->ShowingCursor = 0;
}
@@ -1819,7 +1795,7 @@
{
//ppdev->SafetyRemoveCount = 0;
//ppdev->SafetyRemoveLevel = 0;
- EngMovePointer(SurfObj,-1,-1,NULL);
+ IntEngMovePointer(SurfObj,-1,-1,NULL);
CurInfo->ShowingCursor = CURSOR_SHOWING;
}
}
Modified: trunk/reactos/subsystems/win32/win32k/objects/device.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/device.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/device.c [iso-8859-1] Tue Apr 7
05:36:22 2009
@@ -553,6 +553,11 @@
gpsi->ptCursor.x = (SurfaceRect.right - SurfaceRect.left) / 2;
gpsi->ptCursor.y = (SurfaceRect.bottom - SurfaceRect.top) / 2;
+ /* Give the PDEV a MovePointer function */
+ PrimarySurface.pfnMovePointer = PrimarySurface.DriverFunctions.MovePointer;
+ if (!PrimarySurface.pfnMovePointer)
+ PrimarySurface.pfnMovePointer = EngMovePointer;
+
EngUnlockSurface(SurfObj);
co_IntShowDesktop(IntGetActiveDesktop(), SurfSize.cx, SurfSize.cy);
Modified: trunk/reactos/subsystems/win32/win32k/objects/dibobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dibobj.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dibobj.c [iso-8859-1] Tue Apr 7
05:36:22 2009
@@ -329,7 +329,7 @@
DestRect.right = SourceSize.cx;
DestRect.bottom = DestRect.top + ScanLines;
- copyBitsResult = EngCopyBits(DestSurf, SourceSurf, NULL, XlateObj, &DestRect,
&ZeroPoint);
+ copyBitsResult = IntEngCopyBits(DestSurf, SourceSurf, NULL, XlateObj, &DestRect,
&ZeroPoint);
// If it succeeded, return number of scanlines copies
if(copyBitsResult == TRUE)
@@ -952,7 +952,7 @@
DestSurfObj = EngLockSurface((HSURF)hDestBitmap);
- if (EngCopyBits( DestSurfObj,
+ if (IntEngCopyBits( DestSurfObj,
&psurf->SurfObj,
NULL,
XlateObj,