* 06-06-2001 CSH Created
*/
/* INCLUDES ******************************************************************/
+
#include <w32k.h>
+#define NDEBUG
+#include <debug.h>
+
/* FUNCTIONS *****************************************************************/
INT INTERNAL_CALL
ASSERT(SurfObj != NULL);
ppdev = GDIDEV(SurfObj);
-
+
if(ppdev == NULL)
{
return(FALSE);
}
-
+
pgp = &ppdev->Pointer;
if (SPS_ACCEPT_NOEXCLUDE == pgp->Status ||
tmp = HazardY2; HazardY2 = HazardY1; HazardY1 = tmp;
}
+ if (ppdev->SafetyRemoveLevel != 0)
+ {
+ ppdev->SafetyRemoveCount++;
+ return FALSE;
+ }
+
+ ppdev->SafetyRemoveCount++;
+
if (pgp->Exclude.right >= HazardX1
&& pgp->Exclude.left <= HazardX2
&& pgp->Exclude.bottom >= HazardY1
&& pgp->Exclude.top <= HazardY2)
{
- if (0 != pgp->SafetyRemoveCount++)
- {
- return FALSE;
- }
- pgp->SafetySwitch = TRUE;
+ ppdev->SafetyRemoveLevel = ppdev->SafetyRemoveCount;
if (pgp->MovePointer)
pgp->MovePointer(SurfObj, -1, -1, NULL);
else
ASSERT(SurfObj != NULL);
ppdev = GDIDEV(SurfObj);
-
+
if(ppdev == NULL)
{
return(FALSE);
return FALSE;
}
- if (pgp->SafetySwitch)
- {
- if (1 < pgp->SafetyRemoveCount--)
- {
- /* Someone else removed it too, let them restore it */
- return FALSE;
- }
- /* FIXME - this is wrong!!!!!! we must NOT access pgp->Pos from here, it's
- a private field for ENG/driver. This will paint the cursor to the
- wrong screen coordinates when a driver overrides DrvMovePointer()!
- We should store the coordinates before calling Drv/EngMovePointer()
- and Drv/EngSetPointerShape() separately in the GDIDEVICE structure
- or somewhere where ntuser can access it! */
- if (pgp->MovePointer)
- pgp->MovePointer(SurfObj, pgp->Pos.x, pgp->Pos.y, &pgp->Exclude);
- else
- EngMovePointer(SurfObj, pgp->Pos.x, pgp->Pos.y, &pgp->Exclude);
- pgp->SafetySwitch = FALSE;
- }
+ if (--ppdev->SafetyRemoveCount >= ppdev->SafetyRemoveLevel)
+ {
+ return FALSE;
+ }
+ if (pgp->MovePointer)
+ pgp->MovePointer(SurfObj, pgp->Pos.x, pgp->Pos.y, &pgp->Exclude);
+ else
+ EngMovePointer(SurfObj, pgp->Pos.x, pgp->Pos.y, &pgp->Exclude);
+
+ ppdev->SafetyRemoveLevel = 0;
return(TRUE);
}
return;
}
+
+
pgp->Enabled = FALSE;
+ /*
+ * The mouse is hide from ShowCours and it is frist ??
+ */
+ if (pgp->ShowPointer < 0)
+ {
+ return ;
+ }
+
+
+ /*
+ * Hide the cours
+ */
pt.x = pgp->Pos.x - pgp->HotSpot.x;
pt.y = pgp->Pos.y - pgp->HotSpot.y;
+
if (pgp->SaveSurface != NULL)
{
{
if((MaskSurface = EngLockSurface(pgp->MaskSurface)))
{
- EngBitBlt(DestSurface, SaveSurface, MaskSurface, NULL, NULL,
- &DestRect, &SrcPoint, &SrcPoint, NULL, NULL, SRCCOPY);
+ IntEngBitBltEx(DestSurface, SaveSurface, MaskSurface, NULL, NULL,
+ &DestRect, &SrcPoint, &SrcPoint, NULL, NULL,
+ ROP3_TO_ROP4(SRCCOPY), FALSE);
EngUnlockSurface(MaskSurface);
}
EngUnlockSurface(SaveSurface);
{
return;
}
-
+
pgp->Enabled = TRUE;
+ /*
+ * Do not blt the mouse if it in hide
+ */
+ if (pgp->ShowPointer < 0)
+ {
+ return ;
+ }
+
pt.x = pgp->Pos.x - pgp->HotSpot.x;
pt.y = pgp->Pos.y - pgp->HotSpot.y;
pgp->Size.cy,
DestSurface->sizlBitmap.cy - pt.y);
- EngBitBlt(SaveSurface, DestSurface, NULL, NULL, NULL,
- &DestRect, &SrcPoint, NULL, NULL, NULL, SRCCOPY);
+ IntEngBitBltEx(SaveSurface, DestSurface, 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 *ColorSurf;
- SURFOBJ *MaskSurf;
+ SURFOBJ *MaskSurf = NULL;
DestRect.left = max(pt.x, 0);
DestRect.top = max(pt.y, 0);
SrcPoint.x = max(-pt.x, 0);
SrcPoint.y = max(-pt.y, 0);
- MaskSurf = EngLockSurface(pgp->MaskSurface);
+
+ if (pgp->MaskSurface)
+ MaskSurf = EngLockSurface(pgp->MaskSurface);
+
if (MaskSurf != NULL)
{
if (pgp->ColorSurface != NULL)
{
if((ColorSurf = EngLockSurface(pgp->ColorSurface)))
{
- EngBitBlt(DestSurface, ColorSurf, MaskSurf, NULL, pgp->XlateObject,
- &DestRect, &SrcPoint, &SrcPoint, NULL, NULL, 0xAACC);
- EngUnlockSurface(ColorSurf);
+ IntEngBitBltEx(DestSurface, ColorSurf, MaskSurf, NULL,
+ pgp->XlateObject, &DestRect, &SrcPoint, &SrcPoint,
+ NULL, NULL, R4_MASK, FALSE);
+ EngUnlockSurface(ColorSurf);
}
}
else
- {
- EngBitBlt(DestSurface, MaskSurf, NULL, NULL, pgp->XlateObject,
- &DestRect, &SrcPoint, NULL, NULL, NULL, SRCAND);
+ {
+ IntEngBitBltEx(DestSurface, MaskSurf, NULL, NULL, pgp->XlateObject,
+ &DestRect, &SrcPoint, NULL, NULL, NULL,
+ ROP3_TO_ROP4(SRCAND), FALSE);
SrcPoint.y += pgp->Size.cy;
- EngBitBlt(DestSurface, MaskSurf, NULL, NULL, pgp->XlateObject,
- &DestRect, &SrcPoint, NULL, NULL, NULL, SRCINVERT);
+ IntEngBitBltEx(DestSurface, MaskSurf, NULL, NULL, pgp->XlateObject,
+ &DestRect, &SrcPoint, NULL, NULL, NULL,
+ ROP3_TO_ROP4(SRCINVERT), FALSE);
}
EngUnlockSurface(MaskSurf);
}
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)
{
pgp->Pos.x = x;
pgp->Pos.y = y;
}
-
+
pgp->Size.cx = abs(psoMask->lDelta) << 3;
pgp->Size.cy = (psoMask->cjBits / abs(psoMask->lDelta)) >> 1;
PBYTE Bits;
Bits = EngAllocMem(0, psoColor->cjBits, TAG_MOUSE);
+ if (Bits == NULL)
+ {
+ return SPS_ERROR;
+ }
+
memcpy(Bits, psoColor->pvBits, psoColor->cjBits);
pgp->ColorSurface = (HSURF)EngCreateBitmap(pgp->Size,
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,
if(x != -1)
{
IntShowMousePointer(ppdev, pso);
-
+
if (prcl != NULL)
{
- prcl->left = pgp->Pos.x - pgp->HotSpot.x;
- prcl->top = pgp->Pos.y - pgp->HotSpot.x;
+ prcl->left = x - pgp->HotSpot.x;
+ prcl->top = y - pgp->HotSpot.x;
prcl->right = prcl->left + pgp->Size.cx;
prcl->bottom = prcl->top + pgp->Size.cy;
}
- }
-
- /* FIXME - touch prcl when x == -1? */
+ } else if (prcl != NULL)
+ prcl->left = prcl->top = prcl->right = prcl->bottom = -1;
return SPS_ACCEPT_EXCLUDE;
}
ppdev = GDIDEV(pso);
ASSERT(ppdev);
-
+
pgp = &ppdev->Pointer;
-
+
IntHideMousePointer(ppdev, pso);
if (x != -1)
{
+ /* Actually this should be set by 'the other side', but it would be
+ * done right after this. It helps IntShowMousePointer. */
pgp->Pos.x = x;
pgp->Pos.y = y;
IntShowMousePointer(ppdev, pso);
if (prcl != NULL)
{
- prcl->left = pgp->Pos.x - pgp->HotSpot.x;
- prcl->top = pgp->Pos.y - pgp->HotSpot.x;
+ prcl->left = x - pgp->HotSpot.x;
+ prcl->top = y - pgp->HotSpot.x;
prcl->right = prcl->left + pgp->Size.cx;
prcl->bottom = prcl->top + pgp->Size.cy;
}
- }
-
- /* FIXME - touch prcl when x == -1? */
+ } else if (prcl != NULL)
+ prcl->left = prcl->top = prcl->right = prcl->bottom = -1;
+
+}
+
+VOID STDCALL
+IntEngMovePointer(
+ IN SURFOBJ *SurfObj,
+ IN LONG x,
+ IN LONG y,
+ IN RECTL *prcl)
+{
+ BITMAPOBJ *BitmapObj = CONTAINING_RECORD(SurfObj, BITMAPOBJ, SurfObj);
+
+ BITMAPOBJ_LockBitmapBits(BitmapObj);
+ if (GDIDEV(SurfObj)->Pointer.MovePointer)
+ {
+ GDIDEV(SurfObj)->Pointer.MovePointer(SurfObj, x, y, prcl);
+ }
+ else
+ {
+ EngMovePointer(SurfObj, x, y, prcl);
+ }
+ BITMAPOBJ_UnlockBitmapBits(BitmapObj);
}
/* EOF */