[PATCH 3/4] xwayland: Remove related touchpoints when unrealizing windows

Carlos Garnacho carlosg at gnome.org
Thu Oct 23 06:44:14 PDT 2014


These sequences are forgotten to all purposes.

Signed-off-by: Carlos Garnacho <carlosg at gnome.org>
---
 hw/xwayland/xwayland-input.c | 14 ++++++++++++++
 hw/xwayland/xwayland.c       |  6 +++---
 hw/xwayland/xwayland.h       |  2 ++
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index 0aead8f..4f39032 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -870,6 +870,20 @@ xwl_xy_to_window(ScreenPtr screen, SpritePtr sprite, int x, int y)
 }
 
 void
+xwl_seat_clear_touch(struct xwl_seat *xwl_seat, WindowPtr window)
+{
+    struct xwl_touch *xwl_touch, *next_xwl_touch;
+
+    xorg_list_for_each_entry_safe(xwl_touch, next_xwl_touch,
+                                  &xwl_seat->touches, link_touch) {
+        if (xwl_touch->window->window == window) {
+            xorg_list_del(&xwl_touch->link_touch);
+            free(xwl_touch);
+        }
+    }
+}
+
+void
 InitInput(int argc, char *argv[])
 {
     ScreenPtr pScreen = screenInfo.screens[0];
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 9132969..f532ebc 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -287,10 +287,10 @@ xwl_unrealize_window(WindowPtr window)
     xwl_screen = xwl_screen_get(screen);
 
     xorg_list_for_each_entry(xwl_seat, &xwl_screen->seat_list, link) {
-        if (!xwl_seat->focus_window)
-            continue;
-        if (xwl_seat->focus_window->window == window)
+        if (xwl_seat->focus_window && xwl_seat->focus_window->window == window)
             xwl_seat->focus_window = NULL;
+
+        xwl_seat_clear_touch(xwl_seat, window);
     }
 
     screen->UnrealizeWindow = xwl_screen->UnrealizeWindow;
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index 537cfbc..5a82103 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -162,6 +162,8 @@ void xwl_seat_set_cursor(struct xwl_seat *xwl_seat);
 
 void xwl_seat_destroy(struct xwl_seat *xwl_seat);
 
+void xwl_seat_clear_touch(struct xwl_seat *xwl_seat, WindowPtr window);
+
 Bool xwl_screen_init_output(struct xwl_screen *xwl_screen);
 
 struct xwl_output *xwl_output_create(struct xwl_screen *xwl_screen,
-- 
2.1.0



More information about the xorg-devel mailing list