ReactOS  0.4.14-dev-77-gd9e7c48
mouse.c File Reference
#include <win32k.h>
#include <debug.h>
Include dependency graph for mouse.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

 __drv_preferredFunction ("(see documentation)", "Obsolete, always returns false. ") BOOL APIENTRY EngSetPointerTag(_In_ HDEV hdev
 
_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)
 
VOID NTAPI IntHideMousePointer (_Inout_ PDEVOBJ *ppdev, _Inout_ SURFOBJ *psoDest)
 
VOID NTAPI IntShowMousePointer (_Inout_ PDEVOBJ *ppdev, _Inout_ SURFOBJ *psoDest)
 
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)
 
VOID APIENTRY EngMovePointer (_In_ SURFOBJ *pso, _In_ LONG x, _In_ LONG y, _In_ RECTL *prcl)
 
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)
 

Variables

_In_opt_ SURFOBJpsoMask
 
_In_opt_ SURFOBJ _In_opt_ SURFOBJpsoColor
 
_In_opt_ SURFOBJ _In_opt_ SURFOBJ _Reserved_ XLATEOBJpxlo
 
_In_opt_ SURFOBJ _In_opt_ SURFOBJ _Reserved_ XLATEOBJ _In_ FLONG fl
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file mouse.c.

Function Documentation

◆ __drv_preferredFunction()

__drv_preferredFunction ( "(see documentation)"  ,
Obsolete,
always returns false. "   
)

◆ EngMovePointer()

VOID APIENTRY EngMovePointer ( _In_ SURFOBJ pso,
_In_ LONG  x,
_In_ LONG  y,
_In_ RECTL prcl 
)

Definition at line 566 of file mouse.c.

571 {
572  PDEVOBJ *ppdev;
573  GDIPOINTER *pgp;
574 
575  ASSERT(pso);
576 
577  ppdev = GDIDEV(pso);
578  ASSERT(ppdev);
579 
580  pgp = &ppdev->Pointer;
581 
582  IntHideMousePointer(ppdev, pso);
583 
584  ppdev->ptlPointer.x = x;
585  ppdev->ptlPointer.y = y;
586 
587  if (x != -1)
588  {
589  IntShowMousePointer(ppdev, pso);
590  if (prcl != NULL)
591  {
592  prcl->left = x - pgp->HotSpot.x;
593  prcl->top = y - pgp->HotSpot.y;
594  prcl->right = prcl->left + pgp->Size.cx;
595  prcl->bottom = prcl->top + pgp->Size.cy;
596  }
597  }
598  else if (prcl != NULL)
599  {
600  prcl->left = prcl->top = prcl->right = prcl->bottom = -1;
601  }
602 }
SIZEL Size
Definition: pdevobj.h:31
POINTL HotSpot
Definition: pdevobj.h:32
POINTL ptlPointer
Definition: pdevobj.h:93
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
LONG y
Definition: windef.h:315
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:319
_In_ HANDLE _In_ SURFOBJ * pso
Definition: winddi.h:3664
VOID NTAPI IntHideMousePointer(_Inout_ PDEVOBJ *ppdev, _Inout_ SURFOBJ *psoDest)
Definition: mouse.c:133
LONG x
Definition: windef.h:314
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
VOID NTAPI IntShowMousePointer(_Inout_ PDEVOBJ *ppdev, _Inout_ SURFOBJ *psoDest)
Definition: mouse.c:187
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GDIPOINTER Pointer
Definition: pdevobj.h:145
_In_ ULONG _In_ CLIPOBJ _In_ RECTL * prcl
Definition: winddi.h:3529
#define GDIDEV(SurfObj)
Definition: surface.h:105
LONG cy
Definition: windef.h:320

Referenced by DrvMovePointer(), EngpCreatePDEV(), and IntEngSetPointerShape().

◆ EngSetPointerShape()

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 at line 321 of file mouse.c.

332 {
333  PDEVOBJ *ppdev;
334  GDIPOINTER *pgp;
335  LONG lDelta = 0;
336  HBITMAP hbmSave = NULL, hbmColor = NULL, hbmMask = NULL;
337  PSURFACE psurfSave = NULL, psurfColor = NULL, psurfMask = NULL;
338  RECTL rectl;
339  SIZEL sizel = {0, 0};
340 
341  ASSERT(pso);
342 
343  ppdev = GDIDEV(pso);
344  pgp = &ppdev->Pointer;
345 
346  /* Handle the case where we have no XLATEOBJ */
347  if (pxlo == NULL)
348  pxlo = &gexloTrivial.xlo;
349 
350  /* Do we have any bitmap at all? */
351  if (psoColor || psoMask)
352  {
353  /* Get the size of the new pointer */
354  if (psoColor)
355  {
356  sizel.cx = psoColor->sizlBitmap.cx;
357  sizel.cy = psoColor->sizlBitmap.cy;
358  }
359  else// if (psoMask)
360  {
361  sizel.cx = psoMask->sizlBitmap.cx;
362  sizel.cy = psoMask->sizlBitmap.cy / 2;
363  }
364 
365  rectl.left = 0;
366  rectl.top = 0;
367  rectl.right = sizel.cx;
368  rectl.bottom = sizel.cy;
369 
370  /* Calculate lDelta for our surfaces. */
371  lDelta = WIDTH_BYTES_ALIGN32(sizel.cx,
372  BitsPerFormat(pso->iBitmapFormat));
373 
374  /* Create a bitmap for saving the pixels under the cursor. */
375  hbmSave = EngCreateBitmap(sizel,
376  lDelta,
377  pso->iBitmapFormat,
379  NULL);
380  psurfSave = SURFACE_ShareLockSurface(hbmSave);
381  if (!psurfSave) goto failure;
382  }
383 
384  if (psoColor)
385  {
386  if (fl & SPS_ALPHA)
387  {
388  /* Always store the alpha cursor in RGB. */
389  EXLATEOBJ exloSrcRGB;
390  PEXLATEOBJ pexlo;
391 
392  pexlo = CONTAINING_RECORD(pxlo, EXLATEOBJ, xlo);
393  EXLATEOBJ_vInitialize(&exloSrcRGB, pexlo->ppalSrc, &gpalRGB, 0, 0, 0);
394 
395  hbmColor = EngCreateBitmap(psoColor->sizlBitmap,
396  WIDTH_BYTES_ALIGN32(sizel.cx, 32),
397  BMF_32BPP,
399  NULL);
400  psurfColor = SURFACE_ShareLockSurface(hbmColor);
401  if (!psurfColor) goto failure;
402 
403  /* Now copy the given bitmap. */
404  rectl.bottom = psoColor->sizlBitmap.cy;
405  IntEngCopyBits(&psurfColor->SurfObj,
406  psoColor,
407  NULL,
408  &exloSrcRGB.xlo,
409  &rectl,
410  (POINTL*)&rectl);
411 
412  EXLATEOBJ_vCleanup(&exloSrcRGB);
413  }
414  else
415  {
416  /* Color bitmap must have the same format as the dest surface */
417  if (psoColor->iBitmapFormat != pso->iBitmapFormat)
418  {
419  DPRINT1("Screen surface and cursor color bitmap format don't match!.\n");
420  goto failure;
421  }
422 
423  /* Create a bitmap to copy the color bitmap to */
424  hbmColor = EngCreateBitmap(psoColor->sizlBitmap,
425  lDelta,
426  pso->iBitmapFormat,
428  NULL);
429  psurfColor = SURFACE_ShareLockSurface(hbmColor);
430  if (!psurfColor) goto failure;
431 
432  /* Now copy the given bitmap. */
433  rectl.bottom = psoColor->sizlBitmap.cy;
434  IntEngCopyBits(&psurfColor->SurfObj,
435  psoColor,
436  NULL,
437  pxlo,
438  &rectl,
439  (POINTL*)&rectl);
440  }
441 
442  }
443 
444  /* Create a mask surface */
445  if (psoMask)
446  {
447  EXLATEOBJ exlo;
448  PPALETTE ppal;
449 
450  lDelta = WIDTH_BYTES_ALIGN32(sizel.cx, BitsPerFormat(pso->iBitmapFormat));
451 
452  /* Create a bitmap for the mask */
453  hbmMask = EngCreateBitmap(psoMask->sizlBitmap,
454  lDelta,
455  pso->iBitmapFormat,
457  NULL);
458  psurfMask = SURFACE_ShareLockSurface(hbmMask);
459  if (!psurfMask) goto failure;
460 
461  /* Initialize an EXLATEOBJ */
463  EXLATEOBJ_vInitialize(&exlo,
464  gppalMono,
465  ppal,
466  0,
467  RGB(0xff,0xff,0xff),
468  RGB(0,0,0));
469 
470  /* Copy the mask bitmap */
471  rectl.bottom = psoMask->sizlBitmap.cy;
472  IntEngCopyBits(&psurfMask->SurfObj,
473  psoMask,
474  NULL,
475  &exlo.xlo,
476  &rectl,
477  (POINTL*)&rectl);
478 
479  /* Cleanup */
480  EXLATEOBJ_vCleanup(&exlo);
481  if (ppal) PALETTE_ShareUnlockPalette(ppal);
482  }
483 
484  /* Hide mouse pointer */
485  IntHideMousePointer(ppdev, pso);
486 
487  /* Free old color bitmap */
488  if (pgp->psurfColor)
489  {
492  pgp->psurfColor = NULL;
493  }
494 
495  /* Free old mask bitmap */
496  if (pgp->psurfMask)
497  {
500  pgp->psurfMask = NULL;
501  }
502 
503  /* Free old save bitmap */
504  if (pgp->psurfSave)
505  {
508  pgp->psurfSave = NULL;
509  }
510 
511  /* See if we are being asked to hide the pointer. */
512  if (psoMask == NULL && psoColor == NULL)
513  {
514  /* We're done */
515  return SPS_ACCEPT_NOEXCLUDE;
516  }
517 
518  /* Now set the new cursor */
519  pgp->psurfColor = psurfColor;
520  pgp->psurfMask = psurfMask;
521  pgp->psurfSave = psurfSave;
522  pgp->HotSpot.x = xHot;
523  pgp->HotSpot.y = yHot;
524  pgp->Size = sizel;
525  pgp->flags = fl;
526 
527  if (x != -1)
528  {
529  ppdev->ptlPointer.x = x;
530  ppdev->ptlPointer.y = y;
531 
532  IntShowMousePointer(ppdev, pso);
533 
534  if (prcl != NULL)
535  {
536  prcl->left = x - pgp->HotSpot.x;
537  prcl->top = y - pgp->HotSpot.x;
538  prcl->right = prcl->left + pgp->Size.cx;
539  prcl->bottom = prcl->top + pgp->Size.cy;
540  }
541  }
542  else if (prcl != NULL)
543  {
544  prcl->left = prcl->top = prcl->right = prcl->bottom = -1;
545  }
546 
547  return SPS_ACCEPT_NOEXCLUDE;
548 
549 failure:
550  /* Cleanup surfaces */
551  if (hbmMask) EngDeleteSurface((HSURF)hbmMask);
552  if (psurfMask) SURFACE_ShareUnlockSurface(psurfMask);
553  if (hbmColor) EngDeleteSurface((HSURF)hbmColor);
554  if (psurfColor) SURFACE_ShareUnlockSurface(psurfColor);
555  if (hbmSave) EngDeleteSurface((HSURF)hbmSave);
556  if (psurfSave) SURFACE_ShareUnlockSurface(psurfSave);
557 
558  return SPS_ERROR;
559 }
SIZEL Size
Definition: pdevobj.h:31
#define BMF_32BPP
Definition: winddi.h:360
ENGAPI BOOL APIENTRY EngDeleteSurface(_In_ _Post_ptr_invalid_ HSURF hsurf)
Definition: surface.c:564
#define WIDTH_BYTES_ALIGN32(cx, bpp)
Definition: swimpl.c:16
PALETTE * gppalMono
Definition: palette.c:20
#define SURFACE_ShareUnlockSurface(pBMObj)
Definition: surface.h:102
POINTL HotSpot
Definition: pdevobj.h:32
POINTL ptlPointer
Definition: pdevobj.h:93
#define BitsPerFormat(Format)
Definition: surface.h:109
EXLATEOBJ gexloTrivial
#define BMF_TOPDOWN
Definition: winddi.h:1180
SURFACE * psurfSave
Definition: pdevobj.h:35
long bottom
Definition: polytest.cpp:53
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define SURFACE_ShareLockSurface(hBMObj)
Definition: surface.h:91
#define SPS_ACCEPT_NOEXCLUDE
Definition: winddi.h:4030
LONG y
Definition: windef.h:315
#define SPS_ALPHA
Definition: winddi.h:4039
XLATEOBJ xlo
Definition: xlateobj.h:21
long right
Definition: polytest.cpp:53
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
long LONG
Definition: pedump.c:60
long top
Definition: polytest.cpp:53
_In_opt_ SURFOBJ _In_opt_ SURFOBJ _In_ XLATEOBJ _In_ LONG _In_ LONG yHot
Definition: winddi.h:4049
HPALETTE hpalDefault
Definition: winddi.h:398
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:319
BOOL APIENTRY IntEngCopyBits(SURFOBJ *psoTrg, SURFOBJ *psoSrc, CLIPOBJ *pco, XLATEOBJ *pxlo, RECTL *prclTrg, POINTL *pptlSrc)
Definition: bitblt_new.c:678
VOID NTAPI EXLATEOBJ_vCleanup(_Inout_ PEXLATEOBJ pexlo)
Definition: xlateobj.c:649
long left
Definition: polytest.cpp:53
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define PALETTE_ShareLockPalette(hpal)
Definition: palette.h:57
typedef HSURF(APIENTRY FN_DrvEnableSurface)(_In_ DHPDEV dhpdev)
_In_ HANDLE _In_ SURFOBJ * pso
Definition: winddi.h:3664
BASEOBJECT BaseObject
Definition: surface.h:6
SURFACE * psurfMask
Definition: pdevobj.h:34
DEVINFO devinfo
Definition: pdevobj.h:123
#define RGB(r, g, b)
Definition: wingdi.h:2935
VOID NTAPI IntHideMousePointer(_Inout_ PDEVOBJ *ppdev, _Inout_ SURFOBJ *psoDest)
Definition: mouse.c:133
_In_opt_ SURFOBJ _In_opt_ SURFOBJ _In_ XLATEOBJ _In_ LONG xHot
Definition: winddi.h:4049
LONG x
Definition: windef.h:314
FLONG flags
Definition: pdevobj.h:36
#define BMF_NOZEROINIT
Definition: winddi.h:1181
SURFACE * psurfColor
Definition: pdevobj.h:33
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
VOID NTAPI IntShowMousePointer(_Inout_ PDEVOBJ *ppdev, _Inout_ SURFOBJ *psoDest)
Definition: mouse.c:187
#define SPS_ERROR
Definition: winddi.h:4028
_In_opt_ SURFOBJ _In_opt_ SURFOBJ * psoColor
Definition: winddi.h:4049
#define PALETTE_ShareUnlockPalette(ppal)
Definition: palette.h:59
_In_opt_ SURFOBJ _In_opt_ SURFOBJ * psoMask
Definition: winddi.h:3433
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GDIPOINTER Pointer
Definition: pdevobj.h:145
#define DPRINT1
Definition: precomp.h:8
_In_ ULONG _In_ CLIPOBJ _In_ RECTL * prcl
Definition: winddi.h:3529
#define GDIDEV(SurfObj)
Definition: surface.h:105
PALETTE gpalRGB
Definition: palette.c:20
static HBITMAP
Definition: button.c:44
PPALETTE ppalSrc
Definition: xlateobj.h:25
LONG cy
Definition: windef.h:320
ENGAPI HBITMAP APIENTRY EngCreateBitmap(_In_ SIZEL sizl, _In_ LONG lWidth, _In_ ULONG iFormat, _In_ FLONG fl, _In_opt_ PVOID pvBits)
_In_ SURFOBJ _In_ CLIPOBJ _In_opt_ XLATEOBJ * pxlo
Definition: winddi.h:3414
_In_opt_ SURFOBJ _In_opt_ SURFOBJ _Reserved_ XLATEOBJ _In_ FLONG fl
Definition: mouse.c:27

Referenced by DrvSetPointerShape(), and IntEngSetPointerShape().

◆ 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
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
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)
smooth NULL
Definition: ftsmooth.c:416
VOID NTAPI EXLATEOBJ_vCleanup(_Inout_ PEXLATEOBJ pexlo)
Definition: xlateobj.c:649
Definition: polytest.cpp:40
_In_opt_ SURFOBJ _In_opt_ SURFOBJ _In_ XLATEOBJ _In_ LONG xHot
Definition: winddi.h:4049
#define SPS_CHANGE
Definition: winddi.h:4035
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
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
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
smooth NULL
Definition: ftsmooth.c:416
_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
_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().

◆ IntHideMousePointer()

VOID NTAPI IntHideMousePointer ( _Inout_ PDEVOBJ ppdev,
_Inout_ SURFOBJ psoDest 
)

Definition at line 133 of file mouse.c.

136 {
137  GDIPOINTER *pgp;
138  POINTL pt;
139  RECTL rclDest;
140  POINTL ptlSave;
141 
142  ASSERT(ppdev);
143  ASSERT(psoDest);
144 
145  pgp = &ppdev->Pointer;
146 
147  if (!pgp->Enabled)
148  {
149  return;
150  }
151 
152  pgp->Enabled = FALSE;
153 
154  if (!pgp->psurfSave)
155  {
156  DPRINT("No SaveSurface!\n");
157  return;
158  }
159 
160  /* Calculate cursor coordinates */
161  pt.x = ppdev->ptlPointer.x - pgp->HotSpot.x;
162  pt.y = ppdev->ptlPointer.y - pgp->HotSpot.y;
163 
164  rclDest.left = max(pt.x, 0);
165  rclDest.top = max(pt.y, 0);
166  rclDest.right = min(pt.x + pgp->Size.cx, psoDest->sizlBitmap.cx);
167  rclDest.bottom = min(pt.y + pgp->Size.cy, psoDest->sizlBitmap.cy);
168 
169  ptlSave.x = rclDest.left - pt.x;
170  ptlSave.y = rclDest.top - pt.y;
171 
172  IntEngBitBlt(psoDest,
173  &pgp->psurfSave->SurfObj,
174  NULL,
175  NULL,
176  NULL,
177  &rclDest,
178  &ptlSave,
179  &ptlSave,
180  NULL,
181  NULL,
183 }
SIZEL Size
Definition: pdevobj.h:31
#define max(a, b)
Definition: svc.c:63
BOOL Enabled
Definition: pdevobj.h:30
POINTL HotSpot
Definition: pdevobj.h:32
#define pt(x, y)
Definition: drawing.c:79
SURFACE * psurfSave
Definition: pdevobj.h:35
long bottom
Definition: polytest.cpp:53
LONG y
Definition: windef.h:315
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
SURFOBJ SurfObj
Definition: surface.h:8
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:319
void DPRINT(...)
Definition: polytest.cpp:61
long left
Definition: polytest.cpp:53
LONG x
Definition: windef.h:314
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define min(a, b)
Definition: monoChain.cc:55
LONG cy
Definition: windef.h:320
#define ROP4_FROM_INDEX(index)
Definition: inteng.h:42
BOOL APIENTRY IntEngBitBlt(SURFOBJ *psoTrg, SURFOBJ *psoSrc, SURFOBJ *psoMask, CLIPOBJ *pco, XLATEOBJ *pxlo, RECTL *prclTrg, POINTL *pptlSrc, POINTL *pptlMask, BRUSHOBJ *pbo, POINTL *pptlBrush, ROP4 Rop4)
Definition: bitblt.c:604

Referenced by EngMovePointer(), and EngSetPointerShape().

◆ IntShowMousePointer()

VOID NTAPI IntShowMousePointer ( _Inout_ PDEVOBJ ppdev,
_Inout_ SURFOBJ psoDest 
)

Definition at line 187 of file mouse.c.

190 {
191  GDIPOINTER *pgp;
192  POINTL pt;
193  RECTL rclSurf, rclPointer;
194 
195  ASSERT(ppdev);
196  ASSERT(psoDest);
197 
198  pgp = &ppdev->Pointer;
199 
200  if (pgp->Enabled)
201  {
202  return;
203  }
204 
205  pgp->Enabled = TRUE;
206 
207  /* Check if we have any mouse pointer */
208  if (!pgp->psurfSave) return;
209 
210  /* Calculate pointer coordinates */
211  pt.x = ppdev->ptlPointer.x - pgp->HotSpot.x;
212  pt.y = ppdev->ptlPointer.y - pgp->HotSpot.y;
213 
214  /* Calculate the rect on the surface */
215  rclSurf.left = max(pt.x, 0);
216  rclSurf.top = max(pt.y, 0);
217  rclSurf.right = min(pt.x + pgp->Size.cx, psoDest->sizlBitmap.cx);
218  rclSurf.bottom = min(pt.y + pgp->Size.cy, psoDest->sizlBitmap.cy);
219 
220  /* Calculate the rect in the pointer bitmap */
221  rclPointer.left = rclSurf.left - pt.x;
222  rclPointer.top = rclSurf.top - pt.y;
223  rclPointer.right = min(pgp->Size.cx, psoDest->sizlBitmap.cx - pt.x);
224  rclPointer.bottom = min(pgp->Size.cy, psoDest->sizlBitmap.cy - pt.y);
225 
226  /* Copy the pixels under the cursor to temporary surface. */
228  psoDest,
229  NULL,
230  NULL,
231  NULL,
232  &rclPointer,
233  (POINTL*)&rclSurf,
234  NULL,
235  NULL,
236  NULL,
238 
239  /* Blt the pointer on the screen. */
240  if (pgp->psurfColor)
241  {
242  if(!(pgp->flags & SPS_ALPHA))
243  {
244  IntEngBitBlt(psoDest,
245  &pgp->psurfMask->SurfObj,
246  NULL,
247  NULL,
248  NULL,
249  &rclSurf,
250  (POINTL*)&rclPointer,
251  NULL,
252  NULL,
253  NULL,
254  ROP4_SRCAND);
255 
256  IntEngBitBlt(psoDest,
257  &pgp->psurfColor->SurfObj,
258  NULL,
259  NULL,
260  NULL,
261  &rclSurf,
262  (POINTL*)&rclPointer,
263  NULL,
264  NULL,
265  NULL,
267  }
268  else
269  {
270  BLENDOBJ blendobj = { {AC_SRC_OVER, 0, 255, AC_SRC_ALPHA } };
271  EXLATEOBJ exlo;
272  EXLATEOBJ_vInitialize(&exlo,
273  &gpalRGB,
274  ppdev->ppalSurf,
275  0, 0, 0);
276  IntEngAlphaBlend(psoDest,
277  &pgp->psurfColor->SurfObj,
278  NULL,
279  &exlo.xlo,
280  &rclSurf,
281  &rclPointer,
282  &blendobj);
283  EXLATEOBJ_vCleanup(&exlo);
284  }
285  }
286  else
287  {
288  IntEngBitBlt(psoDest,
289  &pgp->psurfMask->SurfObj,
290  NULL,
291  NULL,
292  NULL,
293  &rclSurf,
294  (POINTL*)&rclPointer,
295  NULL,
296  NULL,
297  NULL,
299 
300  rclPointer.top += pgp->Size.cy;
301 
302  IntEngBitBlt(psoDest,
303  &pgp->psurfMask->SurfObj,
304  NULL,
305  NULL,
306  NULL,
307  &rclSurf,
308  (POINTL*)&rclPointer,
309  NULL,
310  NULL,
311  NULL,
313  }
314 }
BOOL APIENTRY IntEngAlphaBlend(_Inout_ SURFOBJ *psoDest, _In_ SURFOBJ *psoSource, _In_opt_ CLIPOBJ *pco, _In_opt_ XLATEOBJ *pxlo, _In_ RECTL *prclDest, _In_ RECTL *prclSrc, _In_ BLENDOBJ *pBlendObj)
Definition: alphablend.c:196
SIZEL Size
Definition: pdevobj.h:31
#define max(a, b)
Definition: svc.c:63
BOOL Enabled
Definition: pdevobj.h:30
#define TRUE
Definition: types.h:120
POINTL HotSpot
Definition: pdevobj.h:32
#define pt(x, y)
Definition: drawing.c:79
SURFACE * psurfSave
Definition: pdevobj.h:35
long bottom
Definition: polytest.cpp:53
#define AC_SRC_ALPHA
Definition: alphablend.c:9
LONG y
Definition: windef.h:315
#define SPS_ALPHA
Definition: winddi.h:4039
XLATEOBJ xlo
Definition: xlateobj.h:21
long right
Definition: polytest.cpp:53
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
long top
Definition: polytest.cpp:53
SURFOBJ SurfObj
Definition: surface.h:8
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:319
VOID NTAPI EXLATEOBJ_vCleanup(_Inout_ PEXLATEOBJ pexlo)
Definition: xlateobj.c:649
long left
Definition: polytest.cpp:53
SURFACE * psurfMask
Definition: pdevobj.h:34
LONG x
Definition: windef.h:314
FLONG flags
Definition: pdevobj.h:36
SURFACE * psurfColor
Definition: pdevobj.h:33
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define AC_SRC_OVER
Definition: wingdi.h:1368
#define ROP4_SRCINVERT
Definition: dib.h:9
#define min(a, b)
Definition: monoChain.cc:55
#define ROP4_SRCAND
Definition: dib.h:10
PALETTE gpalRGB
Definition: palette.c:20
LONG cy
Definition: windef.h:320
#define ROP4_FROM_INDEX(index)
Definition: inteng.h:42
BOOL APIENTRY IntEngBitBlt(SURFOBJ *psoTrg, SURFOBJ *psoSrc, SURFOBJ *psoMask, CLIPOBJ *pco, XLATEOBJ *pxlo, RECTL *prclTrg, POINTL *pptlSrc, POINTL *pptlMask, BRUSHOBJ *pbo, POINTL *pptlBrush, ROP4 Rop4)
Definition: bitblt.c:604

Referenced by EngMovePointer(), and EngSetPointerShape().

◆ 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
RECTL Exclude
Definition: pdevobj.h:39
smooth NULL
Definition: ftsmooth.c:416
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)

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
long LONG
Definition: pedump.c:60
RECTL Exclude
Definition: pdevobj.h:39
long top
Definition: polytest.cpp:53
smooth NULL
Definition: ftsmooth.c:416
long left
Definition: polytest.cpp:53
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)

Referenced by DC_vPrepareDCsForBlit(), and IntExtTextOutW().

Variable Documentation

◆ fl

Initial value:
{
return FALSE

Definition at line 27 of file mouse.c.

Referenced by EngSetPointerShape().

◆ psoColor

Definition at line 23 of file mouse.c.

◆ psoMask

Definition at line 23 of file mouse.c.

◆ pxlo