[WIN32SS] mouse: use pointer flags in PDEVOBJ

When changing pointer cursor:
- use PDEV_HARDWARE_POINTER flag if using hardware pointer
- use PDEV_SOFTWARE_POINTER flag if using software pointer
- keep pfnMovePointer as an accelerator to driver function (if available) and never change it
- fix bug (2 pointers) when switching between hardware and software pointer

When moving pointer:
- check PDEV_HARDWARE_POINTER flag to know if we need to call the driver
- check PDEV_SOFTWARE_POINTER flag to know if we need to call EngMovePointer
This commit is contained in:
Hervé Poussineau 2022-05-14 15:37:29 +02:00 committed by hpoussin
parent 37c2bb3985
commit 57c07ba117

View file

@ -618,6 +618,8 @@ IntEngSetPointerShape(
ULONG ulResult = SPS_DECLINE;
PFN_DrvSetPointerShape pfnSetPointerShape;
PPDEVOBJ ppdev = GDIDEV(pso);
BOOL bHardwarePointer = FALSE;
BOOL bSoftwarePointer = TRUE;
pfnSetPointerShape = GDIDEVFUNCS(pso).SetPointerShape;
@ -638,15 +640,15 @@ IntEngSetPointerShape(
y,
prcl,
fl);
/* Check if the driver accepted it */
if (ulResult == SPS_ACCEPT_NOEXCLUDE)
bHardwarePointer = TRUE;
bSoftwarePointer = !bHardwarePointer;
}
/* Check if the driver accepted it */
if (ulResult == SPS_ACCEPT_NOEXCLUDE)
{
/* Set MovePointer to the driver function */
ppdev->pfnMovePointer = GDIDEVFUNCS(pso).MovePointer;
}
else
if (bSoftwarePointer)
{
/* Set software pointer */
ulResult = EngSetPointerShape(pso,
@ -659,10 +661,31 @@ IntEngSetPointerShape(
y,
prcl,
fl);
/* Set MovePointer to the eng function */
ppdev->pfnMovePointer = EngMovePointer;
}
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;
return ulResult;
}
@ -787,11 +810,16 @@ GreMovePointer(
/* Check if we need to move it */
if(pdc->ppdev->SafetyRemoveLevel == 0)
{
SURFOBJ* pso = &pdc->ppdev->pSurface->SurfObj;
/* Store the cursor exclude position in the PDEV */
prcl = &pdc->ppdev->Pointer.Exclude;
/* Call Eng/Drv function */
pdc->ppdev->pfnMovePointer(&pdc->ppdev->pSurface->SurfObj, x, y, prcl);
/* 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);
}
/* Release PDEV lock */