ReactOS 0.4.15-dev-7953-g1f49173
mouse.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

_Requires_lock_held_ ppdev BOOL NTAPI MouseSafetyOnDrawStart (_Inout_ PPDEVOBJ ppdev, _In_ LONG HazardX1, _In_ LONG HazardY1, _In_ LONG HazardX2, _In_ LONG HazardY2)
 
_Requires_lock_held_ ppdev BOOL NTAPI MouseSafetyOnDrawEnd (_Inout_ PPDEVOBJ ppdev)
 
ULONG NTAPI IntEngSetPointerShape (_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)
 
ULONG NTAPI GreSetPointerShape (_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)
 
VOID NTAPI GreMovePointer (_In_ HDC hdc, _In_ LONG x, _In_ LONG y)
 

Function Documentation

◆ GreMovePointer()

VOID NTAPI GreMovePointer ( _In_ HDC  hdc,
_In_ LONG  x,
_In_ LONG  y 
)

Definition at line 799 of file mouse.c.

803{
804 PDC pdc;
805 PRECTL prcl;
806
807 /* Lock the DC */
808 pdc = DC_LockDc(hdc);
809 if (!pdc)
810 {
811 DPRINT1("Failed to lock the DC.\n");
812 return;
813 }
814 ASSERT(pdc->dctype == DCTYPE_DIRECT);
815
816 /* Acquire PDEV lock */
817 EngAcquireSemaphore(pdc->ppdev->hsemDevLock);
818
819 /* Check if we need to move it */
820 if(pdc->ppdev->SafetyRemoveLevel == 0)
821 {
822 SURFOBJ* pso = &pdc->ppdev->pSurface->SurfObj;
823
824 /* Store the cursor exclude position in the PDEV */
825 prcl = &pdc->ppdev->Pointer.Exclude;
826
827 /* Send new position of the hot spot of the pointer (will likely redraw cursor) */
828 if (pdc->ppdev->flFlags & PDEV_HARDWARE_POINTER)
829 pdc->ppdev->pfnMovePointer(pso, x, y, prcl);
830 else if (pdc->ppdev->flFlags & PDEV_SOFTWARE_POINTER)
832
833 /* If panning device, and we're not hiding the cursor, notify cursor's current position.
834 * (driver may already have been called if it also supports hardware pointers) */
835 if (pdc->ppdev->devinfo.flGraphicsCaps & GCAPS_PANNING && y >= 0)
836 pdc->ppdev->pfnMovePointer(pso, x, y - pso->sizlBitmap.cy, NULL);
837 }
838
839 /* Release PDEV lock */
840 EngReleaseSemaphore(pdc->ppdev->hsemDevLock);
841
842 /* Unlock the DC */
843 DC_UnlockDc(pdc);
844}
#define DPRINT1
Definition: precomp.h:8
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:238
@ DCTYPE_DIRECT
Definition: dc.h:41
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:220
#define NULL
Definition: types.h:112
VOID WINAPI EngReleaseSemaphore(IN HSEMAPHORE hsem)
Definition: eng.c:235
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define ASSERT(a)
Definition: mode.c:44
HDC hdc
Definition: main.c:9
@ PDEV_HARDWARE_POINTER
Definition: pdevobj.h:8
@ PDEV_SOFTWARE_POINTER
Definition: pdevobj.h:9
Definition: polytest.cpp:41
VOID APIENTRY EngMovePointer(_In_ SURFOBJ *pso, _In_ LONG x, _In_ LONG y, _In_ RECTL *prcl)
Definition: mouse.c:575
_In_ HANDLE _In_ SURFOBJ * pso
Definition: winddi.h:3665
ENGAPI VOID APIENTRY EngAcquireSemaphore(_Inout_ HSEMAPHORE hsem)
#define GCAPS_PANNING
Definition: winddi.h:339
_In_ ULONG _In_ CLIPOBJ _In_ RECTL * prcl
Definition: winddi.h:3531

Referenced by co_MsqInsertMouseMessage(), MsqCleanupMessageQueue(), UserSetCursor(), and UserShowCursor().

◆ GreSetPointerShape()

ULONG NTAPI GreSetPointerShape ( _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 
)

Definition at line 703 of file mouse.c.

712{
713 PDC pdc;
714 PSURFACE psurf, psurfMask, psurfColor;
715 EXLATEOBJ exlo;
716 ULONG ulResult = 0;
717
718 pdc = DC_LockDc(hdc);
719 if (!pdc)
720 {
721 DPRINT1("Failed to lock the DC.\n");
722 return 0;
723 }
724
725 ASSERT(pdc->dctype == DCTYPE_DIRECT);
726 EngAcquireSemaphore(pdc->ppdev->hsemDevLock);
727 /* We're not sure DC surface is the good one */
728 psurf = pdc->ppdev->pSurface;
729 if (!psurf)
730 {
731 DPRINT1("DC has no surface.\n");
732 EngReleaseSemaphore(pdc->ppdev->hsemDevLock);
733 DC_UnlockDc(pdc);
734 return 0;
735 }
736
737 /* Lock the mask bitmap */
738 if (hbmMask)
739 {
740 psurfMask = SURFACE_ShareLockSurface(hbmMask);
741 }
742 else
743 {
744 //ASSERT(fl & SPS_ALPHA);
745 psurfMask = NULL;
746 }
747
748 /* Check for color bitmap */
749 if (hbmColor)
750 {
751 /* We have one, lock it */
752 psurfColor = SURFACE_ShareLockSurface(hbmColor);
753
754 if (psurfColor)
755 {
756 /* Create an XLATEOBJ, no mono support */
757 EXLATEOBJ_vInitialize(&exlo, psurfColor->ppal, psurf->ppal, 0, 0, 0);
758 }
759 }
760 else
761 psurfColor = NULL;
762
763 /* We must have a valid surface in case of alpha bitmap */
764 ASSERT(((fl & SPS_ALPHA) && psurfColor) || !(fl & SPS_ALPHA));
765
766 /* Call the driver or eng function */
767 ulResult = IntEngSetPointerShape(&psurf->SurfObj,
768 psurfMask ? &psurfMask->SurfObj : NULL,
769 psurfColor ? &psurfColor->SurfObj : NULL,
770 psurfColor ? &exlo.xlo : NULL,
771 xHot,
772 yHot,
773 x,
774 y,
775 &pdc->ppdev->Pointer.Exclude,
776 fl | SPS_CHANGE);
777
778 /* Cleanup */
779 if (psurfColor)
780 {
781 EXLATEOBJ_vCleanup(&exlo);
782 SURFACE_ShareUnlockSurface(psurfColor);
783 }
784
785 if (psurfMask)
787
788 EngReleaseSemaphore(pdc->ppdev->hsemDevLock);
789
790 /* Unlock the DC */
791 DC_UnlockDc(pdc);
792
793 /* Return result */
794 return ulResult;
795}
XLATEOBJ xlo
Definition: xlateobj.h:21
SURFOBJ SurfObj
Definition: surface.h:8
struct _PALETTE *const ppal
Definition: surface.h:11
uint32_t ULONG
Definition: typedefs.h:59
ULONG NTAPI IntEngSetPointerShape(_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)
Definition: mouse.c:615
#define SURFACE_ShareUnlockSurface(pBMObj)
Definition: surface.h:102
#define SURFACE_ShareLockSurface(hBMObj)
Definition: surface.h:91
_In_ FLONG fl
Definition: winddi.h:1279
_In_opt_ SURFOBJ _In_opt_ SURFOBJ _In_ XLATEOBJ _In_ LONG xHot
Definition: winddi.h:4052
_In_opt_ SURFOBJ _In_opt_ SURFOBJ _In_ XLATEOBJ _In_ LONG _In_ LONG yHot
Definition: winddi.h:4053
#define SPS_ALPHA
Definition: winddi.h:4039
#define SPS_CHANGE
Definition: winddi.h:4035
VOID NTAPI EXLATEOBJ_vInitialize(_Out_ PEXLATEOBJ pexlo, _In_opt_ PALETTE *ppalSrc, _In_opt_ PALETTE *ppalDst, _In_ COLORREF crSrcBackColor, _In_ COLORREF crDstBackColor, _In_ COLORREF crDstForeColor)
Definition: xlateobj.c:358
VOID NTAPI EXLATEOBJ_vCleanup(_Inout_ PEXLATEOBJ pexlo)
Definition: xlateobj.c:649

Referenced by co_MsqInsertMouseMessage(), and UserSetCursor().

◆ IntEngSetPointerShape()

ULONG NTAPI IntEngSetPointerShape ( _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 
)

Definition at line 615 of file mouse.c.

626{
627 ULONG ulResult = SPS_DECLINE;
628 PFN_DrvSetPointerShape pfnSetPointerShape;
629 PPDEVOBJ ppdev = GDIDEV(pso);
630 BOOL bHardwarePointer = FALSE;
631 BOOL bSoftwarePointer = TRUE;
632
633 pfnSetPointerShape = GDIDEVFUNCS(pso).SetPointerShape;
634
635 if (pfnSetPointerShape)
636 {
637 /* Drivers expect to get an XLATEOBJ */
638 if (pxlo == NULL)
640
641 /* Call the driver */
642 ulResult = pfnSetPointerShape(pso,
643 psoMask,
644 psoColor,
645 pxlo,
646 xHot,
647 yHot,
648 x,
649 y,
650 prcl,
651 fl);
652
653 /* Check if the driver accepted it */
654 if (ulResult == SPS_ACCEPT_NOEXCLUDE)
655 bHardwarePointer = TRUE;
656
657 bSoftwarePointer = !bHardwarePointer;
658 }
659
660 if (bSoftwarePointer)
661 {
662 /* Set software pointer */
663 ulResult = EngSetPointerShape(pso,
664 psoMask,
665 psoColor,
666 pxlo,
667 xHot,
668 yHot,
669 x,
670 y,
671 prcl,
672 fl);
673 }
674
675 if (!bSoftwarePointer && ppdev->flFlags & PDEV_SOFTWARE_POINTER)
676 {
677 /* Disable software pointer */
678 EngMovePointer(pso, -1, -1, NULL);
679 }
680
681 if (!bHardwarePointer && ppdev->flFlags & PDEV_HARDWARE_POINTER)
682 {
683 /* Disable hardware pointer */
684 ppdev->pfnMovePointer(pso, -1, -1, NULL);
685 }
686
687 /* Update flags */
688 if (bSoftwarePointer)
690 else
691 ppdev->flFlags &= ~PDEV_SOFTWARE_POINTER;
692
693 if (bHardwarePointer)
695 else
696 ppdev->flFlags &= ~PDEV_HARDWARE_POINTER;
697
698 return ulResult;
699}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
FLONG flFlags
Definition: pdevobj.h:87
PFN_DrvMovePointer pfnMovePointer
Definition: pdevobj.h:113
ULONG APIENTRY EngSetPointerShape(_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)
Definition: mouse.c:330
#define GDIDEV(SurfObj)
Definition: surface.h:105
#define GDIDEVFUNCS(SurfObj)
Definition: surface.h:106
FN_DrvSetPointerShape * PFN_DrvSetPointerShape
Definition: winddi.h:4058
#define SPS_ACCEPT_NOEXCLUDE
Definition: winddi.h:4030
_In_ SURFOBJ _In_ CLIPOBJ _In_opt_ XLATEOBJ * pxlo
Definition: winddi.h:3416
_In_opt_ SURFOBJ _In_opt_ SURFOBJ * psoMask
Definition: winddi.h:3434
_In_opt_ SURFOBJ _In_opt_ SURFOBJ * psoColor
Definition: winddi.h:4050
#define SPS_DECLINE
Definition: winddi.h:4029
EXLATEOBJ gexloTrivial

Referenced by GreSetPointerShape().

◆ MouseSafetyOnDrawEnd()

_Requires_lock_held_ ppdev BOOL NTAPI MouseSafetyOnDrawEnd ( _Inout_ PPDEVOBJ  ppdev)

Definition at line 102 of file mouse.c.

104{
105 GDIPOINTER *pgp;
106
107 ASSERT(ppdev != NULL);
108 ASSERT(ppdev->pSurface != NULL);
109
110 pgp = &ppdev->Pointer;
111
112 if (pgp->Exclude.right == -1)
113 {
114 return FALSE;
115 }
116
117 if (--ppdev->SafetyRemoveCount >= ppdev->SafetyRemoveLevel)
118 {
119 return FALSE;
120 }
121
122 if (ppdev->flFlags & PDEV_HARDWARE_POINTER)
123 ppdev->pfnMovePointer(&ppdev->pSurface->SurfObj,
124 gpsi->ptCursor.x,
125 gpsi->ptCursor.y,
126 &pgp->Exclude);
127 else if (ppdev->flFlags & PDEV_SOFTWARE_POINTER)
128 EngMovePointer(&ppdev->pSurface->SurfObj,
129 gpsi->ptCursor.x,
130 gpsi->ptCursor.y,
131 &pgp->Exclude);
132
133 ppdev->SafetyRemoveLevel = 0;
134
135 return TRUE;
136}
PSERVERINFO gpsi
Definition: imm.c:18
long right
Definition: polytest.cpp:53
RECTL Exclude
Definition: pdevobj.h:39

Referenced by DC_vFinishBlit().

◆ MouseSafetyOnDrawStart()

_Requires_lock_held_ ppdev BOOL NTAPI MouseSafetyOnDrawStart ( _Inout_ PPDEVOBJ  ppdev,
_In_ LONG  HazardX1,
_In_ LONG  HazardY1,
_In_ LONG  HazardX2,
_In_ LONG  HazardY2 
)

Definition at line 41 of file mouse.c.

47{
48 LONG tmp;
49 GDIPOINTER *pgp;
50
51 ASSERT(ppdev != NULL);
52 ASSERT(ppdev->pSurface != NULL);
53
54 pgp = &ppdev->Pointer;
55
56 if (pgp->Exclude.right == -1)
57 {
58 return FALSE;
59 }
60
61 ppdev->SafetyRemoveCount++;
62
63 if (ppdev->SafetyRemoveLevel != 0)
64 {
65 return FALSE;
66 }
67
68 if (HazardX1 > HazardX2)
69 {
70 tmp = HazardX2;
71 HazardX2 = HazardX1;
72 HazardX1 = tmp;
73 }
74 if (HazardY1 > HazardY2)
75 {
76 tmp = HazardY2;
77 HazardY2 = HazardY1;
78 HazardY1 = tmp;
79 }
80
81 if (pgp->Exclude.right >= HazardX1
82 && pgp->Exclude.left <= HazardX2
83 && pgp->Exclude.bottom >= HazardY1
84 && pgp->Exclude.top <= HazardY2)
85 {
86 ppdev->SafetyRemoveLevel = ppdev->SafetyRemoveCount;
87 if (ppdev->flFlags & PDEV_HARDWARE_POINTER)
88 ppdev->pfnMovePointer(&ppdev->pSurface->SurfObj, -1, -1, NULL);
89 else if (ppdev->flFlags & PDEV_SOFTWARE_POINTER)
90 EngMovePointer(&ppdev->pSurface->SurfObj, -1, -1, NULL);
91 }
92
93 return TRUE;
94}
long LONG
Definition: pedump.c:60
long bottom
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53

Referenced by DC_vPrepareDCsForBlit().