[PATCH xserver 02/12] dix: Incroduce CursorConfinedTo vfunc in Screen

Jonas Ådahl jadahl at gmail.com
Thu Sep 8 10:46:31 UTC 2016


This function will be called when a pointer is grabbed non-root window
set as the 'confineTo'. This will enable the ddx to handle the
confinement their own way.

Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
---
 dix/events.c         | 5 +++++
 include/scrnintstr.h | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/dix/events.c b/dix/events.c
index 87f080e..cc26ba5 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -882,6 +882,8 @@ ConfineCursorToWindow(DeviceIntPtr pDev, WindowPtr pWin, Bool generateEvents,
         SyntheticMotion(pDev, pSprite->hot.x, pSprite->hot.y);
     }
     else {
+        ScreenPtr pScreen = pWin->drawable.pScreen;
+
 #ifdef PANORAMIX
         if (!noPanoramiXExtension) {
             XineramaConfineCursorToWindow(pDev, pWin, generateEvents);
@@ -893,6 +895,9 @@ ConfineCursorToWindow(DeviceIntPtr pDev, WindowPtr pWin, Bool generateEvents,
             : NullRegion;
         CheckPhysLimits(pDev, pSprite->current, generateEvents,
                         confineToScreen, pWin->drawable.pScreen);
+
+        if (*pScreen->CursorConfinedTo)
+            (*pScreen->CursorConfinedTo) (pDev, pScreen, pWin);
     }
 }
 
diff --git a/include/scrnintstr.h b/include/scrnintstr.h
index b3228f8..b342685 100644
--- a/include/scrnintstr.h
+++ b/include/scrnintstr.h
@@ -241,6 +241,10 @@ typedef void (*CursorWarpedToProcPtr) (DeviceIntPtr /* pDev */ ,
                                        int /*x */ ,
                                        int /*y */ );
 
+typedef void (*CurserConfinedToProcPtr) (DeviceIntPtr /* pDev */ ,
+                                         ScreenPtr /*pScreen */ ,
+                                         WindowPtr /*pWindow */ );
+
 typedef Bool (*CreateGCProcPtr) (GCPtr /*pGC */ );
 
 typedef Bool (*CreateColormapProcPtr) (ColormapPtr /*pColormap */ );
@@ -545,6 +549,7 @@ typedef struct _Screen {
     RecolorCursorProcPtr RecolorCursor;
     SetCursorPositionProcPtr SetCursorPosition;
     CursorWarpedToProcPtr CursorWarpedTo;
+    CurserConfinedToProcPtr CursorConfinedTo;
 
     /* GC procedures */
 
-- 
2.7.4



More information about the xorg-devel mailing list