When the pointer leaves the window surface, gtk_window_capture_motion
will not be called anymore, so priv->resize_cursor may remain non-NULL
indefinitely without this.
If update_cursor is later called (via gtk_window_maybe_update_cursor) on
a virtual enter notify event (e.g. because the pointer entered a
descendant surface), it would previously re-set the window surface
cursor to priv->resize_cursor, which could result in the wrong cursor
shape being shown for descendant surfaces.
This affected mutter-x11-frames, see
https://gitlab.freedesktop.org/xorg/xserver/-/issues/1557.
One could also say that if the pointer leaves the window surface, it's
trivially not over any window edge.
(cherry-picked from commit
f8fd04402eaf500abc72d5529165068660bd6911)
gtk_window_maybe_update_cursor (window, widget, NULL);
}
+static void
+gtk_window_capture_leave (GtkWidget *widget)
+{
+ GtkWindow *window = GTK_WINDOW (widget);
+ GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
+
+ g_clear_object (&priv->resize_cursor);
+}
+
static void
gtk_window_activate_default_activate (GtkWidget *widget,
const char *name,
GTK_PHASE_CAPTURE);
g_signal_connect_swapped (controller, "motion",
G_CALLBACK (gtk_window_capture_motion), window);
+ g_signal_connect_swapped (controller, "leave",
+ G_CALLBACK (gtk_window_capture_leave), window);
gtk_widget_add_controller (widget, controller);
controller = gtk_event_controller_key_new ();