diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-02-12 20:26:29 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-02-21 00:47:53 -0500 |
commit | 23c67f8c672ee3c0a3e22afd71ac86f96592dca5 (patch) | |
tree | 140c5974325aa00cd4c4f320a1f0220f6660840e /gtk/gtkcalendar.c | |
parent | 9402e335d014e5f1fffafd8bc9af6e049576418b (diff) | |
download | gtk+-23c67f8c672ee3c0a3e22afd71ac86f96592dca5.tar.gz |
New focus change handling
Instead of relying on gdk's antiquated crossing events,
create a new GtkCrossingData struct that contains the
actual widgets, and a new event controller vfunc that
expects this struct. This also saves us from making sense
of X's crossing modes and details, and makes for a
generally simpler api.
The ::focus-in and ::focus-out signals of GtkEventControllerKey
have been replaced by a single ::focus-change signal that
takes GtkCrossingData as an argument. All callers have
been updated.
Diffstat (limited to 'gtk/gtkcalendar.c')
-rw-r--r-- | gtk/gtkcalendar.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c index 1c97018c2d..36470a711d 100644 --- a/gtk/gtkcalendar.c +++ b/gtk/gtkcalendar.c @@ -280,9 +280,8 @@ static gboolean gtk_calendar_key_controller_key_pressed (GtkEventControllerKey * guint keycode, GdkModifierType state, GtkWidget *widget); -static void gtk_calendar_key_controller_focus (GtkEventControllerKey *controller, - GdkCrossingMode mode, - GdkNotifyType detail, +static void gtk_calendar_key_controller_focus (GtkEventController *controller, + GtkCrossingDirection direction, GtkWidget *widget); static void gtk_calendar_state_flags_changed (GtkWidget *widget, GtkStateFlags previous_state); @@ -593,10 +592,7 @@ gtk_calendar_init (GtkCalendar *calendar) g_signal_connect (controller, "key-pressed", G_CALLBACK (gtk_calendar_key_controller_key_pressed), calendar); - g_signal_connect (controller, "focus-in", - G_CALLBACK (gtk_calendar_key_controller_focus), - calendar); - g_signal_connect (controller, "focus-out", + g_signal_connect (controller, "focus-change", G_CALLBACK (gtk_calendar_key_controller_focus), calendar); gtk_widget_add_controller (GTK_WIDGET (calendar), controller); @@ -1393,10 +1389,9 @@ gtk_calendar_key_controller_key_pressed (GtkEventControllerKey *controller, } static void -gtk_calendar_key_controller_focus (GtkEventControllerKey *key, - GdkCrossingMode mode, - GdkNotifyType detail, - GtkWidget *widget) +gtk_calendar_key_controller_focus (GtkEventController *controller, + GtkCrossingDirection direction, + GtkWidget *widget) { GtkCalendar *calendar = GTK_CALENDAR (widget); GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar); |