ReactOS 0.4.15-dev-8135-g1bc6c90
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 575 of file mouse.c.

580{
581 PDEVOBJ *ppdev;
582 GDIPOINTER *pgp;
583
584 ASSERT(pso);
585
586 ppdev = GDIDEV(pso);
587 ASSERT(ppdev);
588
589 pgp = &ppdev->Pointer;
590
591 IntHideMousePointer(ppdev, pso);
592
593 ppdev->ptlPointer.x = x;
594 ppdev->ptlPointer.y = y;
595
596 if (x != -1)
597 {
598 IntShowMousePointer(ppdev, pso);
599 if (prcl != NULL)
600 {
601 prcl->left = x - pgp->HotSpot.x;
602 prcl->top = y - pgp->HotSpot.y;
603 prcl->right = prcl->left + pgp->Size.cx;
604 prcl->bottom = prcl->top + pgp->Size.cy;
605 }
606 }
607 else if (prcl != NULL)
608 {
609 prcl->left = prcl->top = prcl->right = prcl->bottom = -1;
610 }
611}
#define NULL
Definition: types.h:112
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
POINTL HotSpot
Definition: pdevobj.h:32
SIZEL Size
Definition: pdevobj.h:31
POINTL ptlPointer
Definition: pdevobj.h:91
GDIPOINTER Pointer
Definition: pdevobj.h:143
LONG y
Definition: windef.h:330
LONG x
Definition: windef.h:329
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
VOID NTAPI IntShowMousePointer(_Inout_ PDEVOBJ *ppdev, _Inout_ SURFOBJ *psoDest)
Definition: mouse.c:196
VOID NTAPI IntHideMousePointer(_Inout_ PDEVOBJ *ppdev, _Inout_ SURFOBJ *psoDest)
Definition: mouse.c:142
#define GDIDEV(SurfObj)
Definition: surface.h:105
_In_ HANDLE _In_ SURFOBJ * pso
Definition: winddi.h:3665
_In_ ULONG _In_ CLIPOBJ _In_ RECTL * prcl
Definition: winddi.h:3531

Referenced by DrvMovePointer(), GreMovePointer(), IntEngSetPointerShape(), MouseSafetyOnDrawEnd(), MouseSafetyOnDrawStart(), and PDEVOBJ_Create().

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

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

Referenced by DrvSetPointerShape(), and IntEngSetPointerShape().

◆ 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}
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
VOID WINAPI EngReleaseSemaphore(IN HSEMAPHORE hsem)
Definition: eng.c:235
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
ENGAPI VOID APIENTRY EngAcquireSemaphore(_Inout_ HSEMAPHORE hsem)
#define GCAPS_PANNING
Definition: winddi.h:339

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}
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 SPS_CHANGE
Definition: winddi.h:4035

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 GDIDEVFUNCS(SurfObj)
Definition: surface.h:106
FN_DrvSetPointerShape * PFN_DrvSetPointerShape
Definition: winddi.h:4058
#define SPS_DECLINE
Definition: winddi.h:4029

Referenced by GreSetPointerShape().

◆ IntHideMousePointer()

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

Definition at line 142 of file mouse.c.

145{
146 GDIPOINTER *pgp;
147 POINTL pt;
148 RECTL rclDest;
149 POINTL ptlSave;
150
151 ASSERT(ppdev);
152 ASSERT(psoDest);
153
154 pgp = &ppdev->Pointer;
155
156 if (!pgp->Enabled)
157 {
158 return;
159 }
160
161 pgp->Enabled = FALSE;
162
163 if (!pgp->psurfSave)
164 {
165 DPRINT("No SaveSurface!\n");
166 return;
167 }
168
169 /* Calculate cursor coordinates */
170 pt.x = ppdev->ptlPointer.x - pgp->HotSpot.x;
171 pt.y = ppdev->ptlPointer.y - pgp->HotSpot.y;
172
173 rclDest.left = max(pt.x, 0);
174 rclDest.top = max(pt.y, 0);
175 rclDest.right = min(pt.x + pgp->Size.cx, psoDest->sizlBitmap.cx);
176 rclDest.bottom = min(pt.y + pgp->Size.cy, psoDest->sizlBitmap.cy);
177
178 ptlSave.x = rclDest.left - pt.x;
179 ptlSave.y = rclDest.top - pt.y;
180
181 IntEngBitBlt(psoDest,
182 &pgp->psurfSave->SurfObj,
183 NULL,
184 NULL,
185 NULL,
186 &rclDest,
187 &ptlSave,
188 &ptlSave,
189 NULL,
190 NULL,
192}
#define R3_OPINDEX_SRCCOPY
Definition: bitblt.h:27
#define pt(x, y)
Definition: drawing.c:79
#define ROP4_FROM_INDEX(index)
Definition: inteng.h:42
#define min(a, b)
Definition: monoChain.cc:55
#define DPRINT
Definition: sndvol32.h:73
BOOL Enabled
Definition: pdevobj.h:30
#define max(a, b)
Definition: svc.c:63
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:656

Referenced by EngMovePointer(), and EngSetPointerShape().

◆ IntShowMousePointer()

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

Definition at line 196 of file mouse.c.

199{
200 GDIPOINTER *pgp;
201 POINTL pt;
202 RECTL rclSurf, rclPointer;
203
204 ASSERT(ppdev);
205 ASSERT(psoDest);
206
207 pgp = &ppdev->Pointer;
208
209 if (pgp->Enabled)
210 {
211 return;
212 }
213
214 pgp->Enabled = TRUE;
215
216 /* Check if we have any mouse pointer */
217 if (!pgp->psurfSave) return;
218
219 /* Calculate pointer coordinates */
220 pt.x = ppdev->ptlPointer.x - pgp->HotSpot.x;
221 pt.y = ppdev->ptlPointer.y - pgp->HotSpot.y;
222
223 /* Calculate the rect on the surface */
224 rclSurf.left = max(pt.x, 0);
225 rclSurf.top = max(pt.y, 0);
226 rclSurf.right = min(pt.x + pgp->Size.cx, psoDest->sizlBitmap.cx);
227 rclSurf.bottom = min(pt.y + pgp->Size.cy, psoDest->sizlBitmap.cy);
228
229 /* Calculate the rect in the pointer bitmap */
230 rclPointer.left = rclSurf.left - pt.x;
231 rclPointer.top = rclSurf.top - pt.y;
232 rclPointer.right = min(pgp->Size.cx, psoDest->sizlBitmap.cx - pt.x);
233 rclPointer.bottom = min(pgp->Size.cy, psoDest->sizlBitmap.cy - pt.y);
234
235 /* Copy the pixels under the cursor to temporary surface. */
237 psoDest,
238 NULL,
239 NULL,
240 NULL,
241 &rclPointer,
242 (POINTL*)&rclSurf,
243 NULL,
244 NULL,
245 NULL,
247
248 /* Blt the pointer on the screen. */
249 if (pgp->psurfColor)
250 {
251 if(!(pgp->flags & SPS_ALPHA))
252 {
253 IntEngBitBlt(psoDest,
254 &pgp->psurfMask->SurfObj,
255 NULL,
256 NULL,
257 NULL,
258 &rclSurf,
259 (POINTL*)&rclPointer,
260 NULL,
261 NULL,
262 NULL,
264
265 IntEngBitBlt(psoDest,
266 &pgp->psurfColor->SurfObj,
267 NULL,
268 NULL,
269 NULL,
270 &rclSurf,
271 (POINTL*)&rclPointer,
272 NULL,
273 NULL,
274 NULL,
276 }
277 else
278 {
279 BLENDOBJ blendobj = { {AC_SRC_OVER, 0, 255, AC_SRC_ALPHA } };
280 EXLATEOBJ exlo;
282 &gpalRGB,
283 ppdev->ppalSurf,
284 0, 0, 0);
285 IntEngAlphaBlend(psoDest,
286 &pgp->psurfColor->SurfObj,
287 NULL,
288 &exlo.xlo,
289 &rclSurf,
290 &rclPointer,
291 &blendobj);
292 EXLATEOBJ_vCleanup(&exlo);
293 }
294 }
295 else
296 {
297 IntEngBitBlt(psoDest,
298 &pgp->psurfMask->SurfObj,
299 NULL,
300 NULL,
301 NULL,
302 &rclSurf,
303 (POINTL*)&rclPointer,
304 NULL,
305 NULL,
306 NULL,
308
309 rclPointer.top += pgp->Size.cy;
310
311 IntEngBitBlt(psoDest,
312 &pgp->psurfMask->SurfObj,
313 NULL,
314 NULL,
315 NULL,
316 &rclSurf,
317 (POINTL*)&rclPointer,
318 NULL,
319 NULL,
320 NULL,
322 }
323}
@ R3_OPINDEX_SRCAND
Definition: inteng.h:30
@ R3_OPINDEX_SRCINVERT
Definition: inteng.h:29
#define AC_SRC_ALPHA
Definition: alphablend.c:9
#define ROP4_SRCINVERT
Definition: dib.h:9
#define ROP4_SRCAND
Definition: dib.h:10
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:197
#define AC_SRC_OVER
Definition: wingdi.h:1369

Referenced by EngMovePointer(), and EngSetPointerShape().

◆ 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
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}

Referenced by DC_vPrepareDCsForBlit().

Variable Documentation

◆ fl

Initial value:
{
return FALSE

Definition at line 26 of file mouse.c.

Referenced by EngSetPointerShape().

◆ psoColor

Definition at line 24 of file mouse.c.

◆ psoMask

Definition at line 23 of file mouse.c.

◆ pxlo