2009-07-10 17:01:12 +00:00
|
|
|
/*
|
2011-09-20 19:41:33 +00:00
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
2009-04-06 03:20:25 +00:00
|
|
|
* PROJECT: ReactOS win32 subsystem
|
|
|
|
* PURPOSE: Mouse pointer functions
|
2015-11-10 17:41:55 +00:00
|
|
|
* FILE: win32ss/gdi/eng/mouse.c
|
2002-10-31 00:03:31 +00:00
|
|
|
* PROGRAMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
2009-04-07 01:36:22 +00:00
|
|
|
* Timo Kreuzer (timo.kreuzer@reactos.org)
|
2002-10-31 00:03:31 +00:00
|
|
|
*/
|
|
|
|
/* INCLUDES ******************************************************************/
|
2005-06-29 07:09:25 +00:00
|
|
|
|
2010-04-26 13:58:46 +00:00
|
|
|
#include <win32k.h>
|
2003-02-15 19:16:34 +00:00
|
|
|
|
2005-06-29 07:09:25 +00:00
|
|
|
#define NDEBUG
|
|
|
|
#include <debug.h>
|
|
|
|
|
2002-10-31 00:03:31 +00:00
|
|
|
/* FUNCTIONS *****************************************************************/
|
|
|
|
|
2015-03-10 00:13:29 +00:00
|
|
|
__drv_preferredFunction("(see documentation)", "Obsolete, always returns false. ")
|
2009-08-10 20:19:33 +00:00
|
|
|
BOOL
|
|
|
|
APIENTRY
|
|
|
|
EngSetPointerTag(
|
2015-03-10 00:13:29 +00:00
|
|
|
_In_ HDEV hdev,
|
|
|
|
_In_opt_ SURFOBJ *psoMask,
|
|
|
|
_In_opt_ SURFOBJ *psoColor,
|
|
|
|
_Reserved_ XLATEOBJ *pxlo,
|
|
|
|
_In_ FLONG fl)
|
2009-08-10 20:19:33 +00:00
|
|
|
{
|
|
|
|
// This function is obsolete for Windows 2000 and later.
|
|
|
|
// This function is still supported, but always returns FALSE.
|
|
|
|
// www.osr.com/ddk/graphics/gdifncs_4yav.htm
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2002-10-31 00:03:31 +00:00
|
|
|
/*
|
|
|
|
* FUNCTION: Notify the mouse driver that drawing is about to begin in
|
|
|
|
* a rectangle on a particular surface.
|
|
|
|
*/
|
2015-03-10 00:13:29 +00:00
|
|
|
_Requires_lock_held_(*ppdev->hsemDevLock)
|
|
|
|
BOOL
|
|
|
|
NTAPI
|
2009-04-06 03:20:25 +00:00
|
|
|
MouseSafetyOnDrawStart(
|
2015-03-10 00:13:29 +00:00
|
|
|
_Inout_ PPDEVOBJ ppdev,
|
|
|
|
_In_ LONG HazardX1,
|
|
|
|
_In_ LONG HazardY1,
|
|
|
|
_In_ LONG HazardX2,
|
|
|
|
_In_ LONG HazardY2)
|
2001-06-03 10:47:29 +00:00
|
|
|
{
|
2009-04-06 03:20:25 +00:00
|
|
|
LONG tmp;
|
|
|
|
GDIPOINTER *pgp;
|
2001-06-03 10:47:29 +00:00
|
|
|
|
2010-04-19 13:52:37 +00:00
|
|
|
ASSERT(ppdev != NULL);
|
|
|
|
ASSERT(ppdev->pSurface != NULL);
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2009-04-06 03:20:25 +00:00
|
|
|
pgp = &ppdev->Pointer;
|
2001-06-03 10:47:29 +00:00
|
|
|
|
2009-04-07 01:36:22 +00:00
|
|
|
if (pgp->Exclude.right == -1)
|
2003-03-11 00:21:41 +00:00
|
|
|
{
|
2009-04-07 01:36:22 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ppdev->SafetyRemoveCount++;
|
|
|
|
|
|
|
|
if (ppdev->SafetyRemoveLevel != 0)
|
|
|
|
{
|
|
|
|
return FALSE;
|
2003-03-11 00:21:41 +00:00
|
|
|
}
|
|
|
|
|
2009-04-06 03:20:25 +00:00
|
|
|
if (HazardX1 > HazardX2)
|
2003-01-24 23:25:34 +00:00
|
|
|
{
|
2009-04-06 03:20:25 +00:00
|
|
|
tmp = HazardX2;
|
|
|
|
HazardX2 = HazardX1;
|
|
|
|
HazardX1 = tmp;
|
2002-10-31 00:03:31 +00:00
|
|
|
}
|
2009-04-06 03:20:25 +00:00
|
|
|
if (HazardY1 > HazardY2)
|
2003-01-24 23:25:34 +00:00
|
|
|
{
|
2009-04-06 03:20:25 +00:00
|
|
|
tmp = HazardY2;
|
|
|
|
HazardY2 = HazardY1;
|
|
|
|
HazardY1 = tmp;
|
2002-10-31 00:03:31 +00:00
|
|
|
}
|
2001-06-03 10:47:29 +00:00
|
|
|
|
2009-04-06 03:20:25 +00:00
|
|
|
if (pgp->Exclude.right >= HazardX1
|
2010-10-23 17:05:34 +00:00
|
|
|
&& pgp->Exclude.left <= HazardX2
|
|
|
|
&& pgp->Exclude.bottom >= HazardY1
|
|
|
|
&& pgp->Exclude.top <= HazardY2)
|
2002-10-31 00:03:31 +00:00
|
|
|
{
|
2009-04-06 03:20:25 +00:00
|
|
|
ppdev->SafetyRemoveLevel = ppdev->SafetyRemoveCount;
|
2022-10-11 16:56:04 +00:00
|
|
|
if (ppdev->flFlags & PDEV_HARDWARE_POINTER)
|
|
|
|
ppdev->pfnMovePointer(&ppdev->pSurface->SurfObj, -1, -1, NULL);
|
|
|
|
else if (ppdev->flFlags & PDEV_SOFTWARE_POINTER)
|
|
|
|
EngMovePointer(&ppdev->pSurface->SurfObj, -1, -1, NULL);
|
2002-10-31 00:03:31 +00:00
|
|
|
}
|
2001-06-03 10:47:29 +00:00
|
|
|
|
2015-03-10 00:13:29 +00:00
|
|
|
return TRUE;
|
2004-01-16 15:39:28 +00:00
|
|
|
}
|
|
|
|
|
2002-10-31 00:03:31 +00:00
|
|
|
/*
|
|
|
|
* FUNCTION: Notify the mouse driver that drawing has finished on a surface.
|
|
|
|
*/
|
2015-03-10 00:13:29 +00:00
|
|
|
_Requires_lock_held_(*ppdev->hsemDevLock)
|
|
|
|
BOOL
|
|
|
|
NTAPI
|
2009-04-06 03:20:25 +00:00
|
|
|
MouseSafetyOnDrawEnd(
|
2015-03-10 00:13:29 +00:00
|
|
|
_Inout_ PPDEVOBJ ppdev)
|
2001-06-03 10:47:29 +00:00
|
|
|
{
|
2009-04-06 03:20:25 +00:00
|
|
|
GDIPOINTER *pgp;
|
2004-12-12 01:40:39 +00:00
|
|
|
|
2010-04-19 13:52:37 +00:00
|
|
|
ASSERT(ppdev != NULL);
|
|
|
|
ASSERT(ppdev->pSurface != NULL);
|
2003-03-11 00:21:41 +00:00
|
|
|
|
2009-04-06 03:20:25 +00:00
|
|
|
pgp = &ppdev->Pointer;
|
2004-12-12 01:40:39 +00:00
|
|
|
|
2009-04-07 01:36:22 +00:00
|
|
|
if (pgp->Exclude.right == -1)
|
2009-04-06 03:20:25 +00:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
2004-12-12 01:40:39 +00:00
|
|
|
|
2009-04-06 03:20:25 +00:00
|
|
|
if (--ppdev->SafetyRemoveCount >= ppdev->SafetyRemoveLevel)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
2009-04-07 01:36:22 +00:00
|
|
|
|
2022-10-11 16:56:04 +00:00
|
|
|
if (ppdev->flFlags & PDEV_HARDWARE_POINTER)
|
|
|
|
ppdev->pfnMovePointer(&ppdev->pSurface->SurfObj,
|
|
|
|
gpsi->ptCursor.x,
|
|
|
|
gpsi->ptCursor.y,
|
|
|
|
&pgp->Exclude);
|
|
|
|
else if (ppdev->flFlags & PDEV_SOFTWARE_POINTER)
|
|
|
|
EngMovePointer(&ppdev->pSurface->SurfObj,
|
|
|
|
gpsi->ptCursor.x,
|
|
|
|
gpsi->ptCursor.y,
|
|
|
|
&pgp->Exclude);
|
2005-01-19 14:25:10 +00:00
|
|
|
|
2009-04-06 03:20:25 +00:00
|
|
|
ppdev->SafetyRemoveLevel = 0;
|
2004-01-15 16:29:10 +00:00
|
|
|
|
2015-03-10 00:13:29 +00:00
|
|
|
return TRUE;
|
2001-06-03 10:47:29 +00:00
|
|
|
}
|
2001-05-26 08:15:40 +00:00
|
|
|
|
2004-01-24 19:47:05 +00:00
|
|
|
/* SOFTWARE MOUSE POINTER IMPLEMENTATION **************************************/
|
|
|
|
|
2009-04-07 01:36:22 +00:00
|
|
|
VOID
|
2011-08-27 12:38:23 +00:00
|
|
|
NTAPI
|
2009-04-06 03:20:25 +00:00
|
|
|
IntHideMousePointer(
|
2015-03-10 00:13:29 +00:00
|
|
|
_Inout_ PDEVOBJ *ppdev,
|
|
|
|
_Inout_ SURFOBJ *psoDest)
|
2004-01-24 19:47:05 +00:00
|
|
|
{
|
2009-04-06 03:20:25 +00:00
|
|
|
GDIPOINTER *pgp;
|
|
|
|
POINTL pt;
|
2009-04-07 01:36:22 +00:00
|
|
|
RECTL rclDest;
|
|
|
|
POINTL ptlSave;
|
2004-12-12 01:40:39 +00:00
|
|
|
|
2009-04-06 03:20:25 +00:00
|
|
|
ASSERT(ppdev);
|
|
|
|
ASSERT(psoDest);
|
2004-12-12 01:40:39 +00:00
|
|
|
|
2009-04-06 03:20:25 +00:00
|
|
|
pgp = &ppdev->Pointer;
|
2004-12-12 01:40:39 +00:00
|
|
|
|
2009-04-06 03:20:25 +00:00
|
|
|
if (!pgp->Enabled)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2004-01-24 19:47:05 +00:00
|
|
|
|
2009-04-06 03:20:25 +00:00
|
|
|
pgp->Enabled = FALSE;
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2009-04-07 01:36:22 +00:00
|
|
|
if (!pgp->psurfSave)
|
2009-04-06 03:20:25 +00:00
|
|
|
{
|
2012-02-19 02:24:52 +00:00
|
|
|
DPRINT("No SaveSurface!\n");
|
2009-04-07 01:36:22 +00:00
|
|
|
return;
|
2009-04-06 03:20:25 +00:00
|
|
|
}
|
2009-04-07 01:36:22 +00:00
|
|
|
|
|
|
|
/* 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;
|
|
|
|
|
2010-04-19 15:08:03 +00:00
|
|
|
IntEngBitBlt(psoDest,
|
2010-10-23 17:05:34 +00:00
|
|
|
&pgp->psurfSave->SurfObj,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
&rclDest,
|
|
|
|
&ptlSave,
|
|
|
|
&ptlSave,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
2011-03-01 01:03:58 +00:00
|
|
|
ROP4_FROM_INDEX(R3_OPINDEX_SRCCOPY));
|
2009-04-06 03:20:25 +00:00
|
|
|
}
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2009-04-07 01:36:22 +00:00
|
|
|
VOID
|
2011-08-27 12:38:23 +00:00
|
|
|
NTAPI
|
2015-03-10 00:13:29 +00:00
|
|
|
IntShowMousePointer(
|
|
|
|
_Inout_ PDEVOBJ *ppdev,
|
|
|
|
_Inout_ SURFOBJ *psoDest)
|
2009-04-06 03:20:25 +00:00
|
|
|
{
|
|
|
|
GDIPOINTER *pgp;
|
|
|
|
POINTL pt;
|
2009-04-07 01:36:22 +00:00
|
|
|
RECTL rclSurf, rclPointer;
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2009-04-06 03:20:25 +00:00
|
|
|
ASSERT(ppdev);
|
|
|
|
ASSERT(psoDest);
|
2004-02-06 21:12:55 +00:00
|
|
|
|
2009-04-06 03:20:25 +00:00
|
|
|
pgp = &ppdev->Pointer;
|
2004-01-24 19:47:05 +00:00
|
|
|
|
2009-04-06 03:20:25 +00:00
|
|
|
if (pgp->Enabled)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2004-01-24 19:47:05 +00:00
|
|
|
|
2009-04-06 03:20:25 +00:00
|
|
|
pgp->Enabled = TRUE;
|
2004-01-24 19:47:05 +00:00
|
|
|
|
2010-08-27 10:57:54 +00:00
|
|
|
/* Check if we have any mouse pointer */
|
|
|
|
if (!pgp->psurfSave) return;
|
|
|
|
|
2009-04-07 01:36:22 +00:00
|
|
|
/* Calculate pointer coordinates */
|
|
|
|
pt.x = ppdev->ptlPointer.x - pgp->HotSpot.x;
|
|
|
|
pt.y = ppdev->ptlPointer.y - pgp->HotSpot.y;
|
2009-04-06 03:20:25 +00:00
|
|
|
|
2009-04-07 01:36:22 +00:00
|
|
|
/* 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);
|
2004-01-24 19:47:05 +00:00
|
|
|
|
2009-04-07 01:36:22 +00:00
|
|
|
/* 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);
|
2009-04-06 03:20:25 +00:00
|
|
|
|
2009-04-07 01:36:22 +00:00
|
|
|
/* Copy the pixels under the cursor to temporary surface. */
|
2010-04-19 15:08:03 +00:00
|
|
|
IntEngBitBlt(&pgp->psurfSave->SurfObj,
|
2010-10-23 17:05:34 +00:00
|
|
|
psoDest,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
&rclPointer,
|
|
|
|
(POINTL*)&rclSurf,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
2011-03-01 01:03:58 +00:00
|
|
|
ROP4_FROM_INDEX(R3_OPINDEX_SRCCOPY));
|
2009-04-07 01:36:22 +00:00
|
|
|
|
|
|
|
/* Blt the pointer on the screen. */
|
|
|
|
if (pgp->psurfColor)
|
|
|
|
{
|
2012-11-10 15:56:42 +00:00
|
|
|
if(!(pgp->flags & SPS_ALPHA))
|
|
|
|
{
|
|
|
|
IntEngBitBlt(psoDest,
|
|
|
|
&pgp->psurfMask->SurfObj,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
&rclSurf,
|
|
|
|
(POINTL*)&rclPointer,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
ROP4_SRCAND);
|
|
|
|
|
|
|
|
IntEngBitBlt(psoDest,
|
|
|
|
&pgp->psurfColor->SurfObj,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
&rclSurf,
|
|
|
|
(POINTL*)&rclPointer,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
ROP4_SRCINVERT);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
BLENDOBJ blendobj = { {AC_SRC_OVER, 0, 255, AC_SRC_ALPHA } };
|
|
|
|
EXLATEOBJ exlo;
|
|
|
|
EXLATEOBJ_vInitialize(&exlo,
|
2014-10-25 18:11:31 +00:00
|
|
|
&gpalRGB,
|
2012-11-10 15:56:42 +00:00
|
|
|
ppdev->ppalSurf,
|
2014-10-25 18:11:31 +00:00
|
|
|
0, 0, 0);
|
2012-11-10 15:56:42 +00:00
|
|
|
IntEngAlphaBlend(psoDest,
|
|
|
|
&pgp->psurfColor->SurfObj,
|
|
|
|
NULL,
|
|
|
|
&exlo.xlo,
|
|
|
|
&rclSurf,
|
|
|
|
&rclPointer,
|
|
|
|
&blendobj);
|
|
|
|
EXLATEOBJ_vCleanup(&exlo);
|
|
|
|
}
|
2009-04-07 01:36:22 +00:00
|
|
|
}
|
|
|
|
else
|
2009-04-06 03:20:25 +00:00
|
|
|
{
|
2010-04-19 15:08:03 +00:00
|
|
|
IntEngBitBlt(psoDest,
|
2010-10-23 17:05:34 +00:00
|
|
|
&pgp->psurfMask->SurfObj,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
&rclSurf,
|
|
|
|
(POINTL*)&rclPointer,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
2011-03-01 01:03:58 +00:00
|
|
|
ROP4_FROM_INDEX(R3_OPINDEX_SRCAND));
|
2009-04-07 01:36:22 +00:00
|
|
|
|
|
|
|
rclPointer.top += pgp->Size.cy;
|
|
|
|
|
2010-04-19 15:08:03 +00:00
|
|
|
IntEngBitBlt(psoDest,
|
2010-10-23 17:05:34 +00:00
|
|
|
&pgp->psurfMask->SurfObj,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
&rclSurf,
|
|
|
|
(POINTL*)&rclPointer,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
2011-03-01 01:03:58 +00:00
|
|
|
ROP4_FROM_INDEX(R3_OPINDEX_SRCINVERT));
|
2009-04-06 03:20:25 +00:00
|
|
|
}
|
2004-01-24 19:47:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
2015-03-10 00:13:29 +00:00
|
|
|
ULONG
|
|
|
|
APIENTRY
|
2004-01-17 15:21:09 +00:00
|
|
|
EngSetPointerShape(
|
2015-03-10 00:13:29 +00:00
|
|
|
_In_ SURFOBJ *pso,
|
|
|
|
_In_opt_ SURFOBJ *psoMask,
|
|
|
|
_In_opt_ SURFOBJ *psoColor,
|
|
|
|
_In_opt_ XLATEOBJ *pxlo,
|
|
|
|
_In_ LONG xHot,
|
|
|
|
_In_ LONG yHot,
|
|
|
|
_In_ LONG x,
|
|
|
|
_In_ LONG y,
|
|
|
|
_In_ RECTL *prcl,
|
|
|
|
_In_ FLONG fl)
|
2004-01-17 15:21:09 +00:00
|
|
|
{
|
2009-04-06 03:20:25 +00:00
|
|
|
PDEVOBJ *ppdev;
|
|
|
|
GDIPOINTER *pgp;
|
2010-08-27 10:57:54 +00:00
|
|
|
LONG lDelta = 0;
|
|
|
|
HBITMAP hbmSave = NULL, hbmColor = NULL, hbmMask = NULL;
|
|
|
|
PSURFACE psurfSave = NULL, psurfColor = NULL, psurfMask = NULL;
|
|
|
|
RECTL rectl;
|
|
|
|
SIZEL sizel = {0, 0};
|
2009-04-06 03:20:25 +00:00
|
|
|
|
|
|
|
ASSERT(pso);
|
|
|
|
|
|
|
|
ppdev = GDIDEV(pso);
|
|
|
|
pgp = &ppdev->Pointer;
|
|
|
|
|
2015-03-10 00:13:29 +00:00
|
|
|
/* Handle the case where we have no XLATEOBJ */
|
|
|
|
if (pxlo == NULL)
|
|
|
|
pxlo = &gexloTrivial.xlo;
|
|
|
|
|
2010-08-27 10:57:54 +00:00
|
|
|
/* Do we have any bitmap at all? */
|
|
|
|
if (psoColor || psoMask)
|
2009-08-07 01:44:38 +00:00
|
|
|
{
|
2010-08-27 10:57:54 +00:00
|
|
|
/* Get the size of the new pointer */
|
2010-10-23 17:05:34 +00:00
|
|
|
if (psoColor)
|
|
|
|
{
|
2010-08-27 10:57:54 +00:00
|
|
|
sizel.cx = psoColor->sizlBitmap.cx;
|
|
|
|
sizel.cy = psoColor->sizlBitmap.cy;
|
2010-10-23 17:05:34 +00:00
|
|
|
}
|
2010-08-27 10:57:54 +00:00
|
|
|
else// if (psoMask)
|
2010-10-23 17:05:34 +00:00
|
|
|
{
|
2010-08-27 10:57:54 +00:00
|
|
|
sizel.cx = psoMask->sizlBitmap.cx;
|
|
|
|
sizel.cy = psoMask->sizlBitmap.cy / 2;
|
2010-10-23 17:05:34 +00:00
|
|
|
}
|
2009-08-07 01:44:38 +00:00
|
|
|
|
2010-08-27 10:57:54 +00:00
|
|
|
rectl.left = 0;
|
|
|
|
rectl.top = 0;
|
|
|
|
rectl.right = sizel.cx;
|
|
|
|
rectl.bottom = sizel.cy;
|
|
|
|
|
|
|
|
/* Calculate lDelta for our surfaces. */
|
2011-03-01 01:03:58 +00:00
|
|
|
lDelta = WIDTH_BYTES_ALIGN32(sizel.cx,
|
2012-03-24 17:19:34 +00:00
|
|
|
BitsPerFormat(pso->iBitmapFormat));
|
2010-08-27 10:57:54 +00:00
|
|
|
|
|
|
|
/* Create a bitmap for saving the pixels under the cursor. */
|
|
|
|
hbmSave = EngCreateBitmap(sizel,
|
|
|
|
lDelta,
|
|
|
|
pso->iBitmapFormat,
|
|
|
|
BMF_TOPDOWN | BMF_NOZEROINIT,
|
|
|
|
NULL);
|
|
|
|
psurfSave = SURFACE_ShareLockSurface(hbmSave);
|
|
|
|
if (!psurfSave) goto failure;
|
2009-04-06 03:20:25 +00:00
|
|
|
}
|
|
|
|
|
2010-08-27 10:57:54 +00:00
|
|
|
if (psoColor)
|
2009-04-06 03:20:25 +00:00
|
|
|
{
|
2014-10-25 18:11:31 +00:00
|
|
|
if (fl & SPS_ALPHA)
|
2012-11-10 15:56:42 +00:00
|
|
|
{
|
2014-10-25 18:11:31 +00:00
|
|
|
/* Always store the alpha cursor in RGB. */
|
|
|
|
EXLATEOBJ exloSrcRGB;
|
|
|
|
PEXLATEOBJ pexlo;
|
|
|
|
|
|
|
|
pexlo = CONTAINING_RECORD(pxlo, EXLATEOBJ, xlo);
|
|
|
|
EXLATEOBJ_vInitialize(&exloSrcRGB, pexlo->ppalSrc, &gpalRGB, 0, 0, 0);
|
|
|
|
|
|
|
|
hbmColor = EngCreateBitmap(psoColor->sizlBitmap,
|
|
|
|
WIDTH_BYTES_ALIGN32(sizel.cx, 32),
|
|
|
|
BMF_32BPP,
|
|
|
|
BMF_TOPDOWN | BMF_NOZEROINIT,
|
|
|
|
NULL);
|
|
|
|
psurfColor = SURFACE_ShareLockSurface(hbmColor);
|
|
|
|
if (!psurfColor) goto failure;
|
|
|
|
|
|
|
|
/* Now copy the given bitmap. */
|
|
|
|
rectl.bottom = psoColor->sizlBitmap.cy;
|
|
|
|
IntEngCopyBits(&psurfColor->SurfObj,
|
|
|
|
psoColor,
|
|
|
|
NULL,
|
|
|
|
&exloSrcRGB.xlo,
|
|
|
|
&rectl,
|
|
|
|
(POINTL*)&rectl);
|
|
|
|
|
|
|
|
EXLATEOBJ_vCleanup(&exloSrcRGB);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Color bitmap must have the same format as the dest surface */
|
|
|
|
if (psoColor->iBitmapFormat != pso->iBitmapFormat)
|
2012-11-10 15:56:42 +00:00
|
|
|
{
|
|
|
|
DPRINT1("Screen surface and cursor color bitmap format don't match!.\n");
|
|
|
|
goto failure;
|
|
|
|
}
|
2014-10-25 18:11:31 +00:00
|
|
|
|
|
|
|
/* Create a bitmap to copy the color bitmap to */
|
|
|
|
hbmColor = EngCreateBitmap(psoColor->sizlBitmap,
|
|
|
|
lDelta,
|
|
|
|
pso->iBitmapFormat,
|
|
|
|
BMF_TOPDOWN | BMF_NOZEROINIT,
|
|
|
|
NULL);
|
|
|
|
psurfColor = SURFACE_ShareLockSurface(hbmColor);
|
|
|
|
if (!psurfColor) goto failure;
|
|
|
|
|
|
|
|
/* Now copy the given bitmap. */
|
|
|
|
rectl.bottom = psoColor->sizlBitmap.cy;
|
|
|
|
IntEngCopyBits(&psurfColor->SurfObj,
|
|
|
|
psoColor,
|
|
|
|
NULL,
|
|
|
|
pxlo,
|
|
|
|
&rectl,
|
|
|
|
(POINTL*)&rectl);
|
2012-11-10 15:56:42 +00:00
|
|
|
}
|
2009-04-06 03:20:25 +00:00
|
|
|
|
2009-08-07 01:44:38 +00:00
|
|
|
}
|
2009-04-06 03:20:25 +00:00
|
|
|
|
2009-08-04 20:37:10 +00:00
|
|
|
/* Create a mask surface */
|
|
|
|
if (psoMask)
|
|
|
|
{
|
|
|
|
EXLATEOBJ exlo;
|
|
|
|
PPALETTE ppal;
|
|
|
|
|
2014-10-25 18:11:31 +00:00
|
|
|
lDelta = WIDTH_BYTES_ALIGN32(sizel.cx, BitsPerFormat(pso->iBitmapFormat));
|
|
|
|
|
2010-08-27 10:57:54 +00:00
|
|
|
/* Create a bitmap for the mask */
|
|
|
|
hbmMask = EngCreateBitmap(psoMask->sizlBitmap,
|
2010-10-23 17:05:34 +00:00
|
|
|
lDelta,
|
|
|
|
pso->iBitmapFormat,
|
|
|
|
BMF_TOPDOWN | BMF_NOZEROINIT,
|
|
|
|
NULL);
|
2010-08-27 10:57:54 +00:00
|
|
|
psurfMask = SURFACE_ShareLockSurface(hbmMask);
|
|
|
|
if (!psurfMask) goto failure;
|
2009-08-04 20:37:10 +00:00
|
|
|
|
2010-08-27 10:57:54 +00:00
|
|
|
/* Initialize an EXLATEOBJ */
|
2011-04-15 15:20:17 +00:00
|
|
|
ppal = PALETTE_ShareLockPalette(ppdev->devinfo.hpalDefault);
|
2010-10-23 17:05:34 +00:00
|
|
|
EXLATEOBJ_vInitialize(&exlo,
|
2012-05-08 23:21:09 +00:00
|
|
|
gppalMono,
|
2010-10-23 17:05:34 +00:00
|
|
|
ppal,
|
|
|
|
0,
|
|
|
|
RGB(0xff,0xff,0xff),
|
|
|
|
RGB(0,0,0));
|
2009-08-07 01:44:38 +00:00
|
|
|
|
2010-08-27 10:57:54 +00:00
|
|
|
/* Copy the mask bitmap */
|
|
|
|
rectl.bottom = psoMask->sizlBitmap.cy;
|
|
|
|
IntEngCopyBits(&psurfMask->SurfObj,
|
2010-10-23 17:05:34 +00:00
|
|
|
psoMask,
|
|
|
|
NULL,
|
|
|
|
&exlo.xlo,
|
2010-08-27 10:57:54 +00:00
|
|
|
&rectl,
|
|
|
|
(POINTL*)&rectl);
|
2009-08-07 01:44:38 +00:00
|
|
|
|
2010-08-27 10:57:54 +00:00
|
|
|
/* Cleanup */
|
2010-10-23 17:05:34 +00:00
|
|
|
EXLATEOBJ_vCleanup(&exlo);
|
2011-04-15 15:20:17 +00:00
|
|
|
if (ppal) PALETTE_ShareUnlockPalette(ppal);
|
2010-10-23 17:05:34 +00:00
|
|
|
}
|
2009-08-07 01:44:38 +00:00
|
|
|
|
2010-08-27 10:57:54 +00:00
|
|
|
/* Hide mouse pointer */
|
2009-04-06 03:20:25 +00:00
|
|
|
IntHideMousePointer(ppdev, pso);
|
|
|
|
|
2010-08-27 10:57:54 +00:00
|
|
|
/* Free old color bitmap */
|
2009-04-07 01:36:22 +00:00
|
|
|
if (pgp->psurfColor)
|
2009-04-06 03:20:25 +00:00
|
|
|
{
|
2009-04-07 01:36:22 +00:00
|
|
|
EngDeleteSurface(pgp->psurfColor->BaseObject.hHmgr);
|
|
|
|
SURFACE_ShareUnlockSurface(pgp->psurfColor);
|
|
|
|
pgp->psurfColor = NULL;
|
2009-08-04 20:37:10 +00:00
|
|
|
}
|
2009-04-06 03:20:25 +00:00
|
|
|
|
2010-08-27 10:57:54 +00:00
|
|
|
/* Free old mask bitmap */
|
2009-04-07 01:36:22 +00:00
|
|
|
if (pgp->psurfMask)
|
2009-08-04 20:37:10 +00:00
|
|
|
{
|
2009-04-07 01:36:22 +00:00
|
|
|
EngDeleteSurface(pgp->psurfMask->BaseObject.hHmgr);
|
|
|
|
SURFACE_ShareUnlockSurface(pgp->psurfMask);
|
2009-08-04 20:37:10 +00:00
|
|
|
pgp->psurfMask = NULL;
|
|
|
|
}
|
|
|
|
|
2010-08-27 10:57:54 +00:00
|
|
|
/* Free old save bitmap */
|
|
|
|
if (pgp->psurfSave)
|
2009-08-04 20:37:10 +00:00
|
|
|
{
|
2009-04-07 01:36:22 +00:00
|
|
|
EngDeleteSurface(pgp->psurfSave->BaseObject.hHmgr);
|
|
|
|
SURFACE_ShareUnlockSurface(pgp->psurfSave);
|
|
|
|
pgp->psurfSave = NULL;
|
2010-10-23 17:05:34 +00:00
|
|
|
}
|
2009-04-06 03:20:25 +00:00
|
|
|
|
|
|
|
/* See if we are being asked to hide the pointer. */
|
2009-08-07 01:44:38 +00:00
|
|
|
if (psoMask == NULL && psoColor == NULL)
|
2009-08-04 20:37:10 +00:00
|
|
|
{
|
2010-08-27 10:57:54 +00:00
|
|
|
/* We're done */
|
2009-04-06 03:20:25 +00:00
|
|
|
return SPS_ACCEPT_NOEXCLUDE;
|
2009-08-04 20:37:10 +00:00
|
|
|
}
|
|
|
|
|
2010-08-27 10:57:54 +00:00
|
|
|
/* Now set the new cursor */
|
|
|
|
pgp->psurfColor = psurfColor;
|
|
|
|
pgp->psurfMask = psurfMask;
|
|
|
|
pgp->psurfSave = psurfSave;
|
2009-04-06 03:20:25 +00:00
|
|
|
pgp->HotSpot.x = xHot;
|
|
|
|
pgp->HotSpot.y = yHot;
|
2010-08-27 10:57:54 +00:00
|
|
|
pgp->Size = sizel;
|
2012-11-10 15:56:42 +00:00
|
|
|
pgp->flags = fl;
|
2009-08-04 20:37:10 +00:00
|
|
|
|
2009-04-06 03:20:25 +00:00
|
|
|
if (x != -1)
|
|
|
|
{
|
2009-08-07 01:44:38 +00:00
|
|
|
ppdev->ptlPointer.x = x;
|
|
|
|
ppdev->ptlPointer.y = y;
|
|
|
|
|
2009-04-06 03:20:25 +00:00
|
|
|
IntShowMousePointer(ppdev, pso);
|
|
|
|
|
|
|
|
if (prcl != NULL)
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
2009-08-04 20:37:10 +00:00
|
|
|
}
|
|
|
|
else if (prcl != NULL)
|
|
|
|
{
|
2009-04-06 03:20:25 +00:00
|
|
|
prcl->left = prcl->top = prcl->right = prcl->bottom = -1;
|
2009-08-04 20:37:10 +00:00
|
|
|
}
|
2009-04-06 03:20:25 +00:00
|
|
|
|
2009-04-07 01:36:22 +00:00
|
|
|
return SPS_ACCEPT_NOEXCLUDE;
|
2010-08-27 10:57:54 +00:00
|
|
|
|
|
|
|
failure:
|
|
|
|
/* Cleanup surfaces */
|
2012-05-02 19:29:33 +00:00
|
|
|
if (hbmMask) EngDeleteSurface((HSURF)hbmMask);
|
2010-08-27 10:57:54 +00:00
|
|
|
if (psurfMask) SURFACE_ShareUnlockSurface(psurfMask);
|
2012-05-02 19:29:33 +00:00
|
|
|
if (hbmColor) EngDeleteSurface((HSURF)hbmColor);
|
2010-08-27 10:57:54 +00:00
|
|
|
if (psurfColor) SURFACE_ShareUnlockSurface(psurfColor);
|
2012-05-02 19:29:33 +00:00
|
|
|
if (hbmSave) EngDeleteSurface((HSURF)hbmSave);
|
2010-08-27 10:57:54 +00:00
|
|
|
if (psurfSave) SURFACE_ShareUnlockSurface(psurfSave);
|
|
|
|
|
|
|
|
return SPS_ERROR;
|
2004-01-17 15:21:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2004-01-24 19:47:05 +00:00
|
|
|
* @implemented
|
2004-01-17 15:21:09 +00:00
|
|
|
*/
|
2015-03-10 00:13:29 +00:00
|
|
|
VOID
|
|
|
|
APIENTRY
|
2004-01-17 15:21:09 +00:00
|
|
|
EngMovePointer(
|
2015-03-10 00:13:29 +00:00
|
|
|
_In_ SURFOBJ *pso,
|
|
|
|
_In_ LONG x,
|
|
|
|
_In_ LONG y,
|
|
|
|
_In_ RECTL *prcl)
|
2004-01-17 15:21:09 +00:00
|
|
|
{
|
2009-04-06 03:20:25 +00:00
|
|
|
PDEVOBJ *ppdev;
|
|
|
|
GDIPOINTER *pgp;
|
|
|
|
|
|
|
|
ASSERT(pso);
|
|
|
|
|
|
|
|
ppdev = GDIDEV(pso);
|
|
|
|
ASSERT(ppdev);
|
|
|
|
|
|
|
|
pgp = &ppdev->Pointer;
|
|
|
|
|
|
|
|
IntHideMousePointer(ppdev, pso);
|
2009-04-07 01:36:22 +00:00
|
|
|
|
|
|
|
ppdev->ptlPointer.x = x;
|
|
|
|
ppdev->ptlPointer.y = y;
|
|
|
|
|
2009-04-06 03:20:25 +00:00
|
|
|
if (x != -1)
|
|
|
|
{
|
|
|
|
IntShowMousePointer(ppdev, pso);
|
|
|
|
if (prcl != NULL)
|
|
|
|
{
|
|
|
|
prcl->left = x - pgp->HotSpot.x;
|
2009-07-31 19:55:16 +00:00
|
|
|
prcl->top = y - pgp->HotSpot.y;
|
2009-04-06 03:20:25 +00:00
|
|
|
prcl->right = prcl->left + pgp->Size.cx;
|
|
|
|
prcl->bottom = prcl->top + pgp->Size.cy;
|
|
|
|
}
|
2010-04-19 00:11:30 +00:00
|
|
|
}
|
2010-01-06 12:44:31 +00:00
|
|
|
else if (prcl != NULL)
|
|
|
|
{
|
2009-04-06 03:20:25 +00:00
|
|
|
prcl->left = prcl->top = prcl->right = prcl->bottom = -1;
|
2010-01-06 12:44:31 +00:00
|
|
|
}
|
2004-01-17 15:21:09 +00:00
|
|
|
}
|
|
|
|
|
2015-03-10 00:13:29 +00:00
|
|
|
ULONG
|
|
|
|
NTAPI
|
2009-04-07 01:36:22 +00:00
|
|
|
IntEngSetPointerShape(
|
2015-03-10 00:13:29 +00:00
|
|
|
_In_ SURFOBJ *pso,
|
|
|
|
_In_opt_ SURFOBJ *psoMask,
|
|
|
|
_In_opt_ SURFOBJ *psoColor,
|
|
|
|
_In_opt_ XLATEOBJ *pxlo,
|
|
|
|
_In_ LONG xHot,
|
|
|
|
_In_ LONG yHot,
|
|
|
|
_In_ LONG x,
|
|
|
|
_In_ LONG y,
|
|
|
|
_In_ RECTL *prcl,
|
|
|
|
_In_ FLONG fl)
|
2009-04-07 01:36:22 +00:00
|
|
|
{
|
|
|
|
ULONG ulResult = SPS_DECLINE;
|
|
|
|
PFN_DrvSetPointerShape pfnSetPointerShape;
|
|
|
|
PPDEVOBJ ppdev = GDIDEV(pso);
|
2022-05-14 13:37:29 +00:00
|
|
|
BOOL bHardwarePointer = FALSE;
|
|
|
|
BOOL bSoftwarePointer = TRUE;
|
2009-04-07 01:36:22 +00:00
|
|
|
|
|
|
|
pfnSetPointerShape = GDIDEVFUNCS(pso).SetPointerShape;
|
|
|
|
|
|
|
|
if (pfnSetPointerShape)
|
|
|
|
{
|
2015-03-10 00:13:29 +00:00
|
|
|
/* Drivers expect to get an XLATEOBJ */
|
|
|
|
if (pxlo == NULL)
|
|
|
|
pxlo = &gexloTrivial.xlo;
|
|
|
|
|
|
|
|
/* Call the driver */
|
2009-04-07 01:36:22 +00:00
|
|
|
ulResult = pfnSetPointerShape(pso,
|
|
|
|
psoMask,
|
|
|
|
psoColor,
|
|
|
|
pxlo,
|
|
|
|
xHot,
|
|
|
|
yHot,
|
|
|
|
x,
|
|
|
|
y,
|
|
|
|
prcl,
|
|
|
|
fl);
|
|
|
|
|
2022-05-14 13:37:29 +00:00
|
|
|
/* Check if the driver accepted it */
|
|
|
|
if (ulResult == SPS_ACCEPT_NOEXCLUDE)
|
|
|
|
bHardwarePointer = TRUE;
|
|
|
|
|
|
|
|
bSoftwarePointer = !bHardwarePointer;
|
2005-06-20 08:31:48 +00:00
|
|
|
}
|
2022-05-14 13:37:29 +00:00
|
|
|
|
|
|
|
if (bSoftwarePointer)
|
2005-06-20 08:31:48 +00:00
|
|
|
{
|
2009-04-07 01:36:22 +00:00
|
|
|
/* Set software pointer */
|
|
|
|
ulResult = EngSetPointerShape(pso,
|
|
|
|
psoMask,
|
|
|
|
psoColor,
|
|
|
|
pxlo,
|
|
|
|
xHot,
|
|
|
|
yHot,
|
|
|
|
x,
|
|
|
|
y,
|
|
|
|
prcl,
|
|
|
|
fl);
|
2005-06-20 08:31:48 +00:00
|
|
|
}
|
2009-04-07 01:36:22 +00:00
|
|
|
|
2022-05-14 13:37:29 +00:00
|
|
|
if (!bSoftwarePointer && ppdev->flFlags & PDEV_SOFTWARE_POINTER)
|
|
|
|
{
|
|
|
|
/* Disable software pointer */
|
|
|
|
EngMovePointer(pso, -1, -1, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!bHardwarePointer && ppdev->flFlags & PDEV_HARDWARE_POINTER)
|
|
|
|
{
|
|
|
|
/* Disable hardware pointer */
|
|
|
|
ppdev->pfnMovePointer(pso, -1, -1, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Update flags */
|
|
|
|
if (bSoftwarePointer)
|
|
|
|
ppdev->flFlags |= PDEV_SOFTWARE_POINTER;
|
|
|
|
else
|
|
|
|
ppdev->flFlags &= ~PDEV_SOFTWARE_POINTER;
|
|
|
|
|
|
|
|
if (bHardwarePointer)
|
|
|
|
ppdev->flFlags |= PDEV_HARDWARE_POINTER;
|
|
|
|
else
|
|
|
|
ppdev->flFlags &= ~PDEV_HARDWARE_POINTER;
|
|
|
|
|
2009-04-07 01:36:22 +00:00
|
|
|
return ulResult;
|
2005-06-20 08:31:48 +00:00
|
|
|
}
|
|
|
|
|
2009-08-07 01:44:38 +00:00
|
|
|
ULONG
|
|
|
|
NTAPI
|
|
|
|
GreSetPointerShape(
|
2015-03-10 00:13:29 +00:00
|
|
|
_In_ HDC hdc,
|
|
|
|
_In_opt_ HBITMAP hbmMask,
|
|
|
|
_In_opt_ HBITMAP hbmColor,
|
|
|
|
_In_ LONG xHot,
|
|
|
|
_In_ LONG yHot,
|
|
|
|
_In_ LONG x,
|
|
|
|
_In_ LONG y,
|
|
|
|
_In_ FLONG fl)
|
2009-08-07 01:44:38 +00:00
|
|
|
{
|
|
|
|
PDC pdc;
|
|
|
|
PSURFACE psurf, psurfMask, psurfColor;
|
|
|
|
EXLATEOBJ exlo;
|
|
|
|
ULONG ulResult = 0;
|
|
|
|
|
|
|
|
pdc = DC_LockDc(hdc);
|
|
|
|
if (!pdc)
|
|
|
|
{
|
|
|
|
DPRINT1("Failed to lock the DC.\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-04-19 13:52:37 +00:00
|
|
|
ASSERT(pdc->dctype == DCTYPE_DIRECT);
|
2010-04-19 14:17:26 +00:00
|
|
|
EngAcquireSemaphore(pdc->ppdev->hsemDevLock);
|
2010-04-19 13:52:37 +00:00
|
|
|
/* We're not sure DC surface is the good one */
|
|
|
|
psurf = pdc->ppdev->pSurface;
|
2009-08-07 01:44:38 +00:00
|
|
|
if (!psurf)
|
|
|
|
{
|
|
|
|
DPRINT1("DC has no surface.\n");
|
2010-04-19 14:17:26 +00:00
|
|
|
EngReleaseSemaphore(pdc->ppdev->hsemDevLock);
|
2009-08-07 01:44:38 +00:00
|
|
|
DC_UnlockDc(pdc);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Lock the mask bitmap */
|
|
|
|
if (hbmMask)
|
2015-03-10 00:13:29 +00:00
|
|
|
{
|
2009-08-07 01:44:38 +00:00
|
|
|
psurfMask = SURFACE_ShareLockSurface(hbmMask);
|
2015-03-10 00:13:29 +00:00
|
|
|
}
|
2009-08-07 01:44:38 +00:00
|
|
|
else
|
2012-11-10 15:56:42 +00:00
|
|
|
{
|
2013-02-04 12:39:40 +00:00
|
|
|
//ASSERT(fl & SPS_ALPHA);
|
2009-08-07 01:44:38 +00:00
|
|
|
psurfMask = NULL;
|
2012-11-10 15:56:42 +00:00
|
|
|
}
|
2009-08-07 01:44:38 +00:00
|
|
|
|
|
|
|
/* Check for color bitmap */
|
|
|
|
if (hbmColor)
|
|
|
|
{
|
|
|
|
/* We have one, lock it */
|
|
|
|
psurfColor = SURFACE_ShareLockSurface(hbmColor);
|
2010-04-19 00:11:30 +00:00
|
|
|
|
2009-08-07 01:44:38 +00:00
|
|
|
if (psurfColor)
|
|
|
|
{
|
|
|
|
/* Create an XLATEOBJ, no mono support */
|
|
|
|
EXLATEOBJ_vInitialize(&exlo, psurfColor->ppal, psurf->ppal, 0, 0, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
psurfColor = NULL;
|
2015-03-10 00:13:29 +00:00
|
|
|
|
2012-11-10 15:56:42 +00:00
|
|
|
/* We must have a valid surface in case of alpha bitmap */
|
2015-03-10 00:13:29 +00:00
|
|
|
ASSERT(((fl & SPS_ALPHA) && psurfColor) || !(fl & SPS_ALPHA));
|
2009-08-07 01:44:38 +00:00
|
|
|
|
|
|
|
/* Call the driver or eng function */
|
|
|
|
ulResult = IntEngSetPointerShape(&psurf->SurfObj,
|
|
|
|
psurfMask ? &psurfMask->SurfObj : NULL,
|
|
|
|
psurfColor ? &psurfColor->SurfObj : NULL,
|
|
|
|
psurfColor ? &exlo.xlo : NULL,
|
|
|
|
xHot,
|
|
|
|
yHot,
|
|
|
|
x,
|
|
|
|
y,
|
|
|
|
&pdc->ppdev->Pointer.Exclude,
|
2009-08-08 02:42:41 +00:00
|
|
|
fl | SPS_CHANGE);
|
2009-08-07 01:44:38 +00:00
|
|
|
|
|
|
|
/* Cleanup */
|
|
|
|
if (psurfColor)
|
2009-08-11 18:42:30 +00:00
|
|
|
{
|
|
|
|
EXLATEOBJ_vCleanup(&exlo);
|
2009-08-07 01:44:38 +00:00
|
|
|
SURFACE_ShareUnlockSurface(psurfColor);
|
2009-08-11 18:42:30 +00:00
|
|
|
}
|
2009-08-07 01:44:38 +00:00
|
|
|
|
|
|
|
if (psurfMask)
|
|
|
|
SURFACE_ShareUnlockSurface(psurfMask);
|
|
|
|
|
2010-04-19 14:17:26 +00:00
|
|
|
EngReleaseSemaphore(pdc->ppdev->hsemDevLock);
|
|
|
|
|
2009-08-07 01:44:38 +00:00
|
|
|
/* Unlock the DC */
|
|
|
|
DC_UnlockDc(pdc);
|
|
|
|
|
|
|
|
/* Return result */
|
|
|
|
return ulResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
GreMovePointer(
|
2015-03-10 00:13:29 +00:00
|
|
|
_In_ HDC hdc,
|
|
|
|
_In_ LONG x,
|
|
|
|
_In_ LONG y)
|
2009-08-07 01:44:38 +00:00
|
|
|
{
|
|
|
|
PDC pdc;
|
|
|
|
PRECTL prcl;
|
|
|
|
|
|
|
|
/* Lock the DC */
|
|
|
|
pdc = DC_LockDc(hdc);
|
|
|
|
if (!pdc)
|
|
|
|
{
|
|
|
|
DPRINT1("Failed to lock the DC.\n");
|
|
|
|
return;
|
|
|
|
}
|
2010-04-19 13:52:37 +00:00
|
|
|
ASSERT(pdc->dctype == DCTYPE_DIRECT);
|
2009-08-07 01:44:38 +00:00
|
|
|
|
2010-04-21 13:44:06 +00:00
|
|
|
/* Acquire PDEV lock */
|
2010-04-19 14:17:26 +00:00
|
|
|
EngAcquireSemaphore(pdc->ppdev->hsemDevLock);
|
2009-08-07 01:44:38 +00:00
|
|
|
|
2010-04-21 13:44:06 +00:00
|
|
|
/* Check if we need to move it */
|
|
|
|
if(pdc->ppdev->SafetyRemoveLevel == 0)
|
|
|
|
{
|
2022-05-14 13:37:29 +00:00
|
|
|
SURFOBJ* pso = &pdc->ppdev->pSurface->SurfObj;
|
|
|
|
|
2010-04-21 13:44:06 +00:00
|
|
|
/* Store the cursor exclude position in the PDEV */
|
|
|
|
prcl = &pdc->ppdev->Pointer.Exclude;
|
|
|
|
|
2022-05-14 13:37:29 +00:00
|
|
|
/* Send new position of the hot spot of the pointer (will likely redraw cursor) */
|
|
|
|
if (pdc->ppdev->flFlags & PDEV_HARDWARE_POINTER)
|
|
|
|
pdc->ppdev->pfnMovePointer(pso, x, y, prcl);
|
|
|
|
else if (pdc->ppdev->flFlags & PDEV_SOFTWARE_POINTER)
|
|
|
|
EngMovePointer(pso, x, y, prcl);
|
2022-05-14 13:41:44 +00:00
|
|
|
|
|
|
|
/* If panning device, and we're not hiding the cursor, notify cursor's current position.
|
|
|
|
* (driver may already have been called if it also supports hardware pointers) */
|
|
|
|
if (pdc->ppdev->devinfo.flGraphicsCaps & GCAPS_PANNING && y >= 0)
|
|
|
|
pdc->ppdev->pfnMovePointer(pso, x, y - pso->sizlBitmap.cy, NULL);
|
2010-04-21 13:44:06 +00:00
|
|
|
}
|
2009-08-07 01:44:38 +00:00
|
|
|
|
2010-04-21 13:44:06 +00:00
|
|
|
/* Release PDEV lock */
|
2010-04-19 14:17:26 +00:00
|
|
|
EngReleaseSemaphore(pdc->ppdev->hsemDevLock);
|
2010-04-21 13:44:06 +00:00
|
|
|
|
2009-08-07 01:44:38 +00:00
|
|
|
/* Unlock the DC */
|
|
|
|
DC_UnlockDc(pdc);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-05-18 17:16:18 +00:00
|
|
|
/* EOF */
|