summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2011-12-14 16:53:04 +1000
committerChase Douglas <chase.douglas@canonical.com>2011-12-21 10:34:11 -0800
commitc32d07d4741f0aa1bc6562cffcfbf9982faf4f4a (patch)
tree84dea6e049f7fe808c7d31faf9088ac8b0420db4
parenteaaff49a0fe56e87a8b3e57d7742601fb8ca26c1 (diff)
dix: when a window disappears, remove it from the touch sprite trace
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
-rw-r--r--Xi/exevents.c30
-rw-r--r--dix/window.c9
-rw-r--r--include/exevents.h4
3 files changed, 41 insertions, 2 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c
index ffb48d1c7..b18157d30 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1866,6 +1866,36 @@ InputClientGone(WindowPtr pWin, XID id)
FatalError("client not on device event list");
}
+/**
+ * Search for window in each touch trace for each device. Remove the window
+ * and all its subwindows from the trace when found. The initial window
+ * order is preserved.
+ */
+void WindowGone(WindowPtr win)
+{
+ DeviceIntPtr dev;
+
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
+ TouchClassPtr t = dev->touch;
+ int i;
+
+ if (!t)
+ continue;
+
+ for (i = 0; i < t->num_touches; i++) {
+ SpritePtr sprite = &t->touches[i].sprite;
+ int j;
+
+ for (j = 0; j < sprite->spriteTraceGood; j++) {
+ if (sprite->spriteTrace[j] == win) {
+ sprite->spriteTraceGood = j;
+ break;
+ }
+ }
+ }
+ }
+}
+
int
SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate,
xEvent * ev, Mask mask, int count)
diff --git a/dix/window.c b/dix/window.c
index 1953f025b..823294b9a 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -131,6 +131,7 @@ Equipment Corporation.
#include "privates.h"
#include "xace.h"
+#include "exevents.h"
#include <X11/Xatom.h> /* must come after server includes */
@@ -2971,8 +2972,10 @@ UnmapWindow(WindowPtr pWin, Bool fromConfigure)
if (!fromConfigure && pScreen->PostValidateTree)
(*pScreen->PostValidateTree)(pLayerWin->parent, pWin, VTUnmap);
}
- if (wasRealized && !fromConfigure)
+ if (wasRealized && !fromConfigure) {
WindowsRestructured ();
+ WindowGone(pWin);
+ }
return Success;
}
@@ -3055,8 +3058,10 @@ UnmapSubwindows(WindowPtr pWin)
if (anyMarked && pScreen->PostValidateTree)
(*pScreen->PostValidateTree)(pLayerWin->parent, pHead, VTUnmap);
}
- if (wasRealized)
+ if (wasRealized) {
WindowsRestructured ();
+ WindowGone(pWin);
+ }
}
diff --git a/include/exevents.h b/include/exevents.h
index 0ab04f525..0186f53bf 100644
--- a/include/exevents.h
+++ b/include/exevents.h
@@ -245,6 +245,10 @@ InputClientGone(
WindowPtr /* pWin */,
XID /* id */);
+extern void
+WindowGone(
+ WindowPtr /* win */);
+
extern int
SendEvent (
ClientPtr /* client */,