summaryrefslogtreecommitdiff
path: root/gtk/gtkcalendar.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-02-19 20:51:03 -0500
committerMatthias Clasen <mclasen@redhat.com>2020-02-21 00:51:03 -0500
commit5a2f829a407241d784dd61e417f4d3166ab5e7a3 (patch)
treee93a9573fdd6e3d74adc5b29543ec01516ba11a4 /gtk/gtkcalendar.c
parent89c3a7ab24cb16e8b64aa924170d0a38bada8a65 (diff)
downloadgtk+-5a2f829a407241d784dd61e417f4d3166ab5e7a3.tar.gz
Split off GtkEventControllerFocus
Split the focus tracking into a separate GtkEventControllerFocus, and change the API one more time. We are back to having ::focus-in and ::focus-out signals. Update all users.
Diffstat (limited to 'gtk/gtkcalendar.c')
-rw-r--r--gtk/gtkcalendar.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c
index 36470a711d..4ef0721072 100644
--- a/gtk/gtkcalendar.c
+++ b/gtk/gtkcalendar.c
@@ -109,6 +109,7 @@
#include "gtkgesturedrag.h"
#include "gtkeventcontrollerscroll.h"
#include "gtkeventcontrollerkey.h"
+#include "gtkeventcontrollerfocus.h"
#include "gtkdragsource.h"
#include "gtknative.h"
#include "gtkicontheme.h"
@@ -280,8 +281,7 @@ static gboolean gtk_calendar_key_controller_key_pressed (GtkEventControllerKey *
guint keycode,
GdkModifierType state,
GtkWidget *widget);
-static void gtk_calendar_key_controller_focus (GtkEventController *controller,
- GtkCrossingDirection direction,
+static void gtk_calendar_focus_controller_focus (GtkEventController *controller,
GtkWidget *widget);
static void gtk_calendar_state_flags_changed (GtkWidget *widget,
GtkStateFlags previous_state);
@@ -592,8 +592,13 @@ 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-change",
- G_CALLBACK (gtk_calendar_key_controller_focus),
+ gtk_widget_add_controller (GTK_WIDGET (calendar), controller);
+ controller = gtk_event_controller_focus_new ();
+ g_signal_connect (controller, "enter",
+ G_CALLBACK (gtk_calendar_focus_controller_focus),
+ calendar);
+ g_signal_connect (controller, "leave",
+ G_CALLBACK (gtk_calendar_focus_controller_focus),
calendar);
gtk_widget_add_controller (GTK_WIDGET (calendar), controller);
@@ -1389,9 +1394,8 @@ gtk_calendar_key_controller_key_pressed (GtkEventControllerKey *controller,
}
static void
-gtk_calendar_key_controller_focus (GtkEventController *controller,
- GtkCrossingDirection direction,
- GtkWidget *widget)
+gtk_calendar_focus_controller_focus (GtkEventController *controller,
+ GtkWidget *widget)
{
GtkCalendar *calendar = GTK_CALENDAR (widget);
GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);