ReactOS  0.4.15-dev-3173-g40ee59d
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 767 of file mouse.c.

771 {
772  PDC pdc;
773  PRECTL prcl;
774 
775  /* Lock the DC */
776  pdc = DC_LockDc(hdc);
777  if (!pdc)
778  {
779  DPRINT1("Failed to lock the DC.\n");
780  return;
781  }
782  ASSERT(pdc->dctype == DCTYPE_DIRECT);
783 
784  /* Acquire PDEV lock */
785  EngAcquireSemaphore(pdc->ppdev->hsemDevLock);
786 
787  /* Check if we need to move it */
788  if(pdc->ppdev->SafetyRemoveLevel == 0)
789  {
790  /* Store the cursor exclude position in the PDEV */
791  prcl = &pdc->ppdev->Pointer.Exclude;
792 
793  /* Call Eng/Drv function */
794  pdc->ppdev->pfnMovePointer(&pdc->ppdev->pSurface->SurfObj, x, y, prcl);
795  }
796 
797  /* Release PDEV lock */
798  EngReleaseSemaphore(pdc->ppdev->hsemDevLock);
799 
800  /* Unlock the DC */
801  DC_UnlockDc(pdc);
802 }
VOID WINAPI EngReleaseSemaphore(IN HSEMAPHORE hsem)
Definition: eng.c:235
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
ENGAPI VOID APIENTRY EngAcquireSemaphore(_Inout_ HSEMAPHORE hsem)
Definition: polytest.cpp:40
#define ASSERT(a)
Definition: mode.c:44
HDC hdc
Definition: main.c:9
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define DPRINT1
Definition: precomp.h:8
_In_ ULONG _In_ CLIPOBJ _In_ RECTL * prcl
Definition: winddi.h:3529

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 671 of file mouse.c.

680 {
681  PDC pdc;
682  PSURFACE psurf, psurfMask, psurfColor;
683  EXLATEOBJ exlo;
684  ULONG ulResult = 0;
685 
686  pdc = DC_LockDc(hdc);
687  if (!pdc)
688  {
689  DPRINT1("Failed to lock the DC.\n");
690  return 0;
691  }
692 
693  ASSERT(pdc->dctype == DCTYPE_DIRECT);
694  EngAcquireSemaphore(pdc->ppdev->hsemDevLock);
695  /* We're not sure DC surface is the good one */
696  psurf = pdc->ppdev->pSurface;
697  if (!psurf)
698  {
699  DPRINT1("DC has no surface.\n");
700  EngReleaseSemaphore(pdc->ppdev->hsemDevLock);
701  DC_UnlockDc(pdc);
702  return 0;
703  }
704 
705  /* Lock the mask bitmap */
706  if (hbmMask)
707  {
708  psurfMask = SURFACE_ShareLockSurface(hbmMask);
709  }
710  else
711  {
712  //ASSERT(fl & SPS_ALPHA);
713  psurfMask = NULL;
714  }
715 
716  /* Check for color bitmap */
717  if (hbmColor)
718  {
719  /* We have one, lock it */
720  psurfColor = SURFACE_ShareLockSurface(hbmColor);
721 
722  if (psurfColor)
723  {
724  /* Create an XLATEOBJ, no mono support */
725  EXLATEOBJ_vInitialize(&exlo, psurfColor->ppal, psurf->ppal, 0, 0, 0);
726  }
727  }
728  else
729  psurfColor = NULL;
730 
731  /* We must have a valid surface in case of alpha bitmap */
732  ASSERT(((fl & SPS_ALPHA) && psurfColor) || !(fl & SPS_ALPHA));
733 
734  /* Call the driver or eng function */
735  ulResult = IntEngSetPointerShape(&psurf->SurfObj,
736  psurfMask ? &psurfMask->SurfObj : NULL,
737  psurfColor ? &psurfColor->SurfObj : NULL,
738  psurfColor ? &exlo.xlo : NULL,
739  xHot,
740  yHot,
741  x,
742  y,
743  &pdc->ppdev->Pointer.Exclude,
744  fl | SPS_CHANGE);
745 
746  /* Cleanup */
747  if (psurfColor)
748  {
749  EXLATEOBJ_vCleanup(&exlo);
750  SURFACE_ShareUnlockSurface(psurfColor);
751  }
752 
753  if (psurfMask)
754  SURFACE_ShareUnlockSurface(psurfMask);
755 
756  EngReleaseSemaphore(pdc->ppdev->hsemDevLock);
757 
758  /* Unlock the DC */
759  DC_UnlockDc(pdc);
760 
761  /* Return result */
762  return ulResult;
763 }
VOID WINAPI EngReleaseSemaphore(IN HSEMAPHORE hsem)
Definition: eng.c:235
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define SURFACE_ShareUnlockSurface(pBMObj)
Definition: surface.h:102
struct _PALETTE *const ppal
Definition: surface.h:11
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define SURFACE_ShareLockSurface(hBMObj)
Definition: surface.h:91
#define SPS_ALPHA
Definition: winddi.h:4039
XLATEOBJ xlo
Definition: xlateobj.h:21
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
_In_ FLONG fl
Definition: winddi.h:1279
_In_opt_ SURFOBJ _In_opt_ SURFOBJ _In_ XLATEOBJ _In_ LONG _In_ LONG yHot
Definition: winddi.h:4049
SURFOBJ SurfObj
Definition: surface.h:8
ENGAPI VOID APIENTRY EngAcquireSemaphore(_Inout_ HSEMAPHORE hsem)
VOID NTAPI EXLATEOBJ_vCleanup(_Inout_ PEXLATEOBJ pexlo)
Definition: xlateobj.c:649
Definition: polytest.cpp:40
#define ASSERT(a)
Definition: mode.c:44
_In_opt_ SURFOBJ _In_opt_ SURFOBJ _In_ XLATEOBJ _In_ LONG xHot
Definition: winddi.h:4049
#define SPS_CHANGE
Definition: winddi.h:4035
HDC hdc
Definition: main.c:9
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
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:606
#define NULL
Definition: types.h:112
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1

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 606 of file mouse.c.

617 {
618  ULONG ulResult = SPS_DECLINE;
619  PFN_DrvSetPointerShape pfnSetPointerShape;
620  PPDEVOBJ ppdev = GDIDEV(pso);
621 
622  pfnSetPointerShape = GDIDEVFUNCS(pso).SetPointerShape;
623 
624  if (pfnSetPointerShape)
625  {
626  /* Drivers expect to get an XLATEOBJ */
627  if (pxlo == NULL)
628  pxlo = &gexloTrivial.xlo;
629 
630  /* Call the driver */
631  ulResult = pfnSetPointerShape(pso,
632  psoMask,
633  psoColor,
634  pxlo,
635  xHot,
636  yHot,
637  x,
638  y,
639  prcl,
640  fl);
641  }
642 
643  /* Check if the driver accepted it */
644  if (ulResult == SPS_ACCEPT_NOEXCLUDE)
645  {
646  /* Set MovePointer to the driver function */
647  ppdev->pfnMovePointer = GDIDEVFUNCS(pso).MovePointer;
648  }
649  else
650  {
651  /* Set software pointer */
652  ulResult = EngSetPointerShape(pso,
653  psoMask,
654  psoColor,
655  pxlo,
656  xHot,
657  yHot,
658  x,
659  y,
660  prcl,
661  fl);
662  /* Set MovePointer to the eng function */
664  }
665 
666  return ulResult;
667 }
PFN_DrvMovePointer pfnMovePointer
Definition: pdevobj.h:114
EXLATEOBJ gexloTrivial
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
VOID APIENTRY EngMovePointer(_In_ SURFOBJ *pso, _In_ LONG x, _In_ LONG y, _In_ RECTL *prcl)
Definition: mouse.c:566
#define SPS_ACCEPT_NOEXCLUDE
Definition: winddi.h:4030
XLATEOBJ xlo
Definition: xlateobj.h:21
_In_ FLONG fl
Definition: winddi.h:1279
_In_opt_ SURFOBJ _In_opt_ SURFOBJ _In_ XLATEOBJ _In_ LONG _In_ LONG yHot
Definition: winddi.h:4049
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:321
_In_ HANDLE _In_ SURFOBJ * pso
Definition: winddi.h:3664
#define GDIDEVFUNCS(SurfObj)
Definition: surface.h:106
FN_DrvSetPointerShape * PFN_DrvSetPointerShape
Definition: winddi.h:4058
_In_opt_ SURFOBJ _In_opt_ SURFOBJ _In_ XLATEOBJ _In_ LONG xHot
Definition: winddi.h:4049
#define SPS_DECLINE
Definition: winddi.h:4029
_In_opt_ SURFOBJ _In_opt_ SURFOBJ * psoColor
Definition: winddi.h:4049
#define NULL
Definition: types.h:112
_In_opt_ SURFOBJ _In_opt_ SURFOBJ * psoMask
Definition: winddi.h:3433
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
_In_ ULONG _In_ CLIPOBJ _In_ RECTL * prcl
Definition: winddi.h:3529
#define GDIDEV(SurfObj)
Definition: surface.h:105
unsigned int ULONG
Definition: retypes.h:1
_In_ SURFOBJ _In_ CLIPOBJ _In_opt_ XLATEOBJ * pxlo
Definition: winddi.h:3414

Referenced by GreSetPointerShape().

◆ MouseSafetyOnDrawEnd()

_Requires_lock_held_ ppdev BOOL NTAPI MouseSafetyOnDrawEnd ( _Inout_ PPDEVOBJ  ppdev)

Definition at line 99 of file mouse.c.

101 {
102  GDIPOINTER *pgp;
103 
104  ASSERT(ppdev != NULL);
105  ASSERT(ppdev->pSurface != NULL);
106 
107  pgp = &ppdev->Pointer;
108 
109  if (pgp->Exclude.right == -1)
110  {
111  return FALSE;
112  }
113 
114  if (--ppdev->SafetyRemoveCount >= ppdev->SafetyRemoveLevel)
115  {
116  return FALSE;
117  }
118 
119  ppdev->pfnMovePointer(&ppdev->pSurface->SurfObj,
120  gpsi->ptCursor.x,
121  gpsi->ptCursor.y,
122  &pgp->Exclude);
123 
124  ppdev->SafetyRemoveLevel = 0;
125 
126  return TRUE;
127 }
#define TRUE
Definition: types.h:120
PSERVERINFO gpsi
Definition: main.c:27
long right
Definition: polytest.cpp:53
#define FALSE
Definition: types.h:117
RECTL Exclude
Definition: pdevobj.h:39
#define ASSERT(a)
Definition: mode.c:44
#define NULL
Definition: types.h:112

Referenced by DC_vFinishBlit(), and IntExtTextOutW().

◆ 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  ppdev->pfnMovePointer(&ppdev->pSurface->SurfObj, -1, -1, NULL);
88  }
89 
90  return TRUE;
91 }
#define TRUE
Definition: types.h:120
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
RECTL Exclude
Definition: pdevobj.h:39
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
#define ASSERT(a)
Definition: mode.c:44
#define NULL
Definition: types.h:112

Referenced by DC_vPrepareDCsForBlit(), and IntExtTextOutW().