Blame SOURCES/0001-wayland-Check-stylus-serials-on-meta_wayland_seat_ca.patch

657d8e
From f2b3dd318f1165849b45a86251724939b100ef7d Mon Sep 17 00:00:00 2001
657d8e
From: Carlos Garnacho <carlosg@gnome.org>
657d8e
Date: Mon, 28 Oct 2019 18:07:31 +0100
657d8e
Subject: [PATCH] wayland: Check stylus serials on
657d8e
 meta_wayland_seat_can_popup()
657d8e
657d8e
This allows xdg_popup.grab() to work with styli. Without this check
657d8e
we would bail out and emit xdg_popup.popup_done, leaving stylus users
657d8e
unable to interact with popup menus, comboboxes, etc...
657d8e
657d8e
Closes: https://gitlab.gnome.org/GNOME/mutter/issues/886
657d8e
---
657d8e
 src/wayland/meta-wayland-seat.c        | 10 +++++++++-
657d8e
 src/wayland/meta-wayland-tablet-seat.c | 17 +++++++++++++++++
657d8e
 src/wayland/meta-wayland-tablet-seat.h |  2 ++
657d8e
 src/wayland/meta-wayland-tablet-tool.c |  7 +++++++
657d8e
 src/wayland/meta-wayland-tablet-tool.h |  2 ++
657d8e
 5 files changed, 37 insertions(+), 1 deletion(-)
657d8e
657d8e
diff --git a/src/wayland/meta-wayland-seat.c b/src/wayland/meta-wayland-seat.c
657d8e
index 91fe376ff..cf41d6eb8 100644
657d8e
--- a/src/wayland/meta-wayland-seat.c
657d8e
+++ b/src/wayland/meta-wayland-seat.c
657d8e
@@ -504,9 +504,17 @@ gboolean
657d8e
 meta_wayland_seat_can_popup (MetaWaylandSeat *seat,
657d8e
                              uint32_t         serial)
657d8e
 {
657d8e
+  MetaWaylandCompositor *compositor;
657d8e
+  MetaWaylandTabletSeat *tablet_seat;
657d8e
+
657d8e
+  compositor = meta_wayland_compositor_get_default ();
657d8e
+  tablet_seat =
657d8e
+    meta_wayland_tablet_manager_ensure_seat (compositor->tablet_manager, seat);
657d8e
+
657d8e
   return (meta_wayland_pointer_can_popup (seat->pointer, serial) ||
657d8e
           meta_wayland_keyboard_can_popup (seat->keyboard, serial) ||
657d8e
-          meta_wayland_touch_can_popup (seat->touch, serial));
657d8e
+          meta_wayland_touch_can_popup (seat->touch, serial) ||
657d8e
+          meta_wayland_tablet_seat_can_popup (tablet_seat, serial));
657d8e
 }
657d8e
 
657d8e
 gboolean
657d8e
diff --git a/src/wayland/meta-wayland-tablet-seat.c b/src/wayland/meta-wayland-tablet-seat.c
657d8e
index b4bc4aa58..b1964714a 100644
657d8e
--- a/src/wayland/meta-wayland-tablet-seat.c
657d8e
+++ b/src/wayland/meta-wayland-tablet-seat.c
657d8e
@@ -552,3 +552,20 @@ meta_wayland_tablet_seat_set_pad_focus (MetaWaylandTabletSeat *tablet_seat,
657d8e
   while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &pad))
657d8e
     meta_wayland_tablet_pad_set_focus (pad, surface);
657d8e
 }
657d8e
+
657d8e
+gboolean
657d8e
+meta_wayland_tablet_seat_can_popup (MetaWaylandTabletSeat *tablet_seat,
657d8e
+                                    uint32_t               serial)
657d8e
+{
657d8e
+  MetaWaylandTabletTool *tool;
657d8e
+  GHashTableIter iter;
657d8e
+
657d8e
+  g_hash_table_iter_init (&iter, tablet_seat->tools);
657d8e
+  while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &tool))
657d8e
+    {
657d8e
+      if (meta_wayland_tablet_tool_can_popup (tool, serial))
657d8e
+        return TRUE;
657d8e
+    }
657d8e
+
657d8e
+  return FALSE;
657d8e
+}
657d8e
diff --git a/src/wayland/meta-wayland-tablet-seat.h b/src/wayland/meta-wayland-tablet-seat.h
657d8e
index c083dec5f..e3be5f264 100644
657d8e
--- a/src/wayland/meta-wayland-tablet-seat.h
657d8e
+++ b/src/wayland/meta-wayland-tablet-seat.h
657d8e
@@ -75,5 +75,7 @@ MetaWaylandTablet     *meta_wayland_tablet_seat_lookup_paired_tablet (MetaWaylan
657d8e
                                                                       MetaWaylandTabletPad  *pad);
657d8e
 GList                 *meta_wayland_tablet_seat_lookup_paired_pads   (MetaWaylandTabletSeat *tablet_seat,
657d8e
                                                                       MetaWaylandTablet     *tablet);
657d8e
+gboolean               meta_wayland_tablet_seat_can_popup            (MetaWaylandTabletSeat *tablet_seat,
657d8e
+                                                                      uint32_t               serial);
657d8e
 
657d8e
 #endif /* META_WAYLAND_TABLET_SEAT_H */
657d8e
diff --git a/src/wayland/meta-wayland-tablet-tool.c b/src/wayland/meta-wayland-tablet-tool.c
657d8e
index c02831d73..065c834bb 100644
657d8e
--- a/src/wayland/meta-wayland-tablet-tool.c
657d8e
+++ b/src/wayland/meta-wayland-tablet-tool.c
657d8e
@@ -1018,3 +1018,10 @@ meta_wayland_tablet_tool_can_grab_surface (MetaWaylandTabletTool *tool,
657d8e
   return ((tool->down_serial == serial || tool->button_serial == serial) &&
657d8e
           tablet_tool_can_grab_surface (tool, surface));
657d8e
 }
657d8e
+
657d8e
+gboolean
657d8e
+meta_wayland_tablet_tool_can_popup (MetaWaylandTabletTool *tool,
657d8e
+                                    uint32_t               serial)
657d8e
+{
657d8e
+  return tool->down_serial == serial || tool->button_serial == serial;
657d8e
+}
657d8e
diff --git a/src/wayland/meta-wayland-tablet-tool.h b/src/wayland/meta-wayland-tablet-tool.h
657d8e
index 71bc86643..315e26bde 100644
657d8e
--- a/src/wayland/meta-wayland-tablet-tool.h
657d8e
+++ b/src/wayland/meta-wayland-tablet-tool.h
657d8e
@@ -85,5 +85,7 @@ void     meta_wayland_tablet_tool_set_cursor_position (MetaWaylandTabletTool  *t
657d8e
 gboolean meta_wayland_tablet_tool_can_grab_surface (MetaWaylandTabletTool *tool,
657d8e
                                                     MetaWaylandSurface    *surface,
657d8e
                                                     uint32_t               serial);
657d8e
+gboolean meta_wayland_tablet_tool_can_popup        (MetaWaylandTabletTool *tool,
657d8e
+                                                    uint32_t               serial);
657d8e
 
657d8e
 #endif /* META_WAYLAND_TABLET_TOOL_H */
657d8e
-- 
657d8e
2.23.0
657d8e