[PATCH 08/10] Add redirect window for input device feature

Adam Jackson ajax at redhat.com
Thu Oct 17 09:36:50 PDT 2013


From: Kristian Høgsberg <krh at bitplanet.net>

Reviewed-by: Adam Jackson <ajax at redhat.com>
---
 Xi/exevents.c      | 13 +++++++++++++
 dix/events.c       | 11 ++++++++++-
 include/exevents.h |  4 ++++
 include/inputstr.h |  2 ++
 4 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/Xi/exevents.c b/Xi/exevents.c
index fd4b80c..f510a9e 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -2025,6 +2025,19 @@ DeliverTouchEvents(DeviceIntPtr dev, TouchPointInfoPtr ti,
     }
 }
 
+void
+SetDeviceRedirectWindow(DeviceIntPtr dev, WindowPtr window)
+{
+    SpritePtr pSprite = dev->spriteInfo->sprite;
+    DeviceIntPtr mouse;
+
+    mouse = IsMaster(dev) ? dev : GetMaster(dev, MASTER_POINTER);
+
+    pSprite->redirectWindow = window;
+
+    CheckMotion(NULL, mouse);
+}
+
 int
 InitProximityClassDeviceStruct(DeviceIntPtr dev)
 {
diff --git a/dix/events.c b/dix/events.c
index 7a1b1c3..16a0408 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2832,7 +2832,16 @@ XYToWindow(SpritePtr pSprite, int x, int y)
     BoxRec box;
 
     pSprite->spriteTraceGood = 1;       /* root window still there */
-    pWin = RootWindow(pSprite)->firstChild;
+    if (pSprite->redirectWindow == PointerRootWin) {
+        return RootWindow(pSprite);
+    }
+    else if (pSprite->redirectWindow) {
+        pWin = pSprite->redirectWindow;
+        pSprite->spriteTrace[pSprite->spriteTraceGood++] = pWin;
+        pWin = pWin->firstChild;
+    }
+    else
+        pWin = RootWindow(pSprite)->firstChild;
     while (pWin) {
         if ((pWin->mapped) &&
             (x >= pWin->drawable.x - wBorderWidth(pWin)) &&
diff --git a/include/exevents.h b/include/exevents.h
index 321fc42..ba93be3 100644
--- a/include/exevents.h
+++ b/include/exevents.h
@@ -162,6 +162,10 @@ extern void
  ProcessOtherEvent(InternalEvent * /* ev */ ,
                    DeviceIntPtr /* other */ );
 
+extern _X_EXPORT void
+  SetDeviceRedirectWindow(DeviceIntPtr /* dev */ ,
+                        WindowPtr /* window */ );
+
 extern int
  CheckGrabValues(ClientPtr /* client */ ,
                  GrabParameters * /* param */ );
diff --git a/include/inputstr.h b/include/inputstr.h
index dc36c5d..09471cf 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -246,6 +246,8 @@ typedef struct _SpriteRec {
     ScreenPtr pEnqueueScreen;
     ScreenPtr pDequeueScreen;
 
+    WindowPtr redirectWindow;
+
 } SpriteRec;
 
 typedef struct _KeyClassRec {
-- 
1.8.3.1



More information about the xorg-devel mailing list