[gtk/gtk-4-6: 11/15] gtkwindow: Use pointer-oriented function to deal with crossing events
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-4-6: 11/15] gtkwindow: Use pointer-oriented function to deal with crossing events
- Date: Mon, 12 Sep 2022 23:33:55 +0000 (UTC)
commit 083d023b6bab9820fbda1a5b3e3ef4fabcbf5dc8
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Aug 9 18:49:35 2022 +0200
gtkwindow: Use pointer-oriented function to deal with crossing events
Commit adba0b97 fixed missed pointer crossings by using a helper function that
was already present and looked like did everything that was needed. However
this function was oriented to keyboard focus and it also did update the related
widget state. Doing these changes on pointer-based crossing was misuse, and
could cause weird interactions with keyboard focus management.
Fix this by using gtkmain.c gtk_synthesize_crossing_event() that is in fact
oriented to pointers.
Fixes: adba0b97 (gtkwindow: Synthesize pointer crossing events on state changes)
Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5094
gtk/gtkmain.c | 2 +-
gtk/gtkprivate.h | 9 +++++++++
gtk/gtkwindow.c | 7 ++++++-
3 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index d39366982d..3548a97bf1 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -1106,7 +1106,7 @@ translate_coordinates (double event_x,
return TRUE;
}
-static void
+void
gtk_synthesize_crossing_events (GtkRoot *toplevel,
GtkCrossingType crossing_type,
GtkWidget *old_target,
diff --git a/gtk/gtkprivate.h b/gtk/gtkprivate.h
index 3495e07efc..7869347cad 100644
--- a/gtk/gtkprivate.h
+++ b/gtk/gtkprivate.h
@@ -152,6 +152,15 @@ char * _gtk_elide_underscores (const char *original);
void setlocale_initialization (void);
+void gtk_synthesize_crossing_events (GtkRoot *toplevel,
+ GtkCrossingType crossing_type,
+ GtkWidget *old_target,
+ GtkWidget *new_target,
+ double surface_x,
+ double surface_y,
+ GdkCrossingMode mode,
+ GdkDrop *drop);
+
G_END_DECLS
#endif /* __GTK_PRIVATE_H__ */
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 060f89140b..8a4fa27cf5 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -6469,7 +6469,12 @@ gtk_window_update_pointer_focus_on_state_change (GtkWindow *window,
old_target = g_object_ref (focus->target);
gtk_pointer_focus_repick_target (focus);
- synthesize_focus_change_events (window, old_target, focus->target, GTK_CROSSING_POINTER);
+ gtk_synthesize_crossing_events (GTK_ROOT (window),
+ GTK_CROSSING_POINTER,
+ old_target, focus->target,
+ focus->x, focus->y,
+ GDK_CROSSING_NORMAL,
+ NULL);
g_object_unref (old_target);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]