From 9702f1ac244758172c3f8edbfc26e99fe1d52fbe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= <krh@redhat.com>
Date: Fri, 18 Sep 2009 22:09:03 -0400
Subject: [PATCH 09/39] Add redirect window for input device feature
---
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 5dc9020..69b4038 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 4632bb7..9caa8b0 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2877,7 +2877,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