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

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