gdk/wayland: Unset GDK_BUTTON1_MASK on proximity_in
authorCarlos Garnacho <carlosg@gnome.org>
Thu, 2 Dec 2021 15:53:47 +0000 (16:53 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Thu, 2 Dec 2021 16:06:35 +0000 (17:06 +0100)
In some circumstances (e.g. activating with a stylus something that
closes a window), we can receive zwp_tablet_tool.proximity_out without
receiving a zwp_tablet_tool.up beforehand.

In those cases, we are not expecting neither .up nor .button, so
reset the stylus device button modifiers on proximity_out.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4103
gdk/wayland/gdkdevice-wayland.c

index d0bc73eb97ca8a96f798183f8f8b2408ceb72ca6..8a45e911e9abddceeeb8c4b743d5faa1f7283143 100644 (file)
@@ -3606,6 +3606,10 @@ tablet_tool_handle_proximity_out (void                      *data,
   g_object_unref (tablet->pointer_info.focus);
   tablet->pointer_info.focus = NULL;
 
+  tablet->pointer_info.button_modifiers &=
+    ~(GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK |
+      GDK_BUTTON4_MASK | GDK_BUTTON5_MASK);
+
   gdk_device_update_tool (tablet->stylus_device, NULL);
   g_clear_object (&tablet->pointer_info.cursor);
 }