From 7277d657d9636c00a7f455b6ed61a92536568594 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 6 Jan 2018 12:51:33 -0500 Subject: [PATCH] window: Stop using ::focus-in/out-event We can just use the generic ::event. --- gtk/gtkwindow.c | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 2fe43abe7b..91e3bdbb63 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -427,10 +427,8 @@ static gint gtk_window_key_press_event (GtkWidget *widget, GdkEventKey *event); static gint gtk_window_key_release_event (GtkWidget *widget, GdkEventKey *event); -static gint gtk_window_focus_in_event (GtkWidget *widget, - GdkEventFocus *event); -static gint gtk_window_focus_out_event (GtkWidget *widget, - GdkEventFocus *event); +static void gtk_window_focus_in (GtkWidget *widget); +static void gtk_window_focus_out (GtkWidget *widget); static void window_state_changed (GtkWidget *widget); static void gtk_window_remove (GtkContainer *container, GtkWidget *widget); @@ -802,8 +800,6 @@ gtk_window_class_init (GtkWindowClass *klass) widget_class->event = gtk_window_event; widget_class->key_press_event = gtk_window_key_press_event; widget_class->key_release_event = gtk_window_key_release_event; - widget_class->focus_in_event = gtk_window_focus_in_event; - widget_class->focus_out_event = gtk_window_focus_out_event; widget_class->focus = gtk_window_focus; widget_class->move_focus = gtk_window_move_focus; widget_class->measure = gtk_window_measure; @@ -7654,7 +7650,19 @@ gtk_window_event (GtkWidget *widget, event_type = gdk_event_get_event_type (event); - if (event_type == GDK_DELETE) + if (event_type == GDK_FOCUS_CHANGE) + { + gboolean focus_in; + + gdk_event_get_focus_in (event, &focus_in); + if (focus_in) + gtk_window_focus_in (widget); + else + gtk_window_focus_out (widget); + + return GDK_EVENT_PROPAGATE; + } + else if (event_type == GDK_DELETE) { if (gtk_window_emit_close_request (GTK_WINDOW (widget))) return GDK_EVENT_STOP; @@ -7771,9 +7779,8 @@ gtk_window_has_mnemonic_modifier_pressed (GtkWindow *window) return retval; } -static gint -gtk_window_focus_in_event (GtkWidget *widget, - GdkEventFocus *event) +static void +gtk_window_focus_in (GtkWidget *widget) { GtkWindow *window = GTK_WINDOW (widget); @@ -7789,13 +7796,10 @@ gtk_window_focus_in_event (GtkWidget *widget, if (gtk_window_has_mnemonic_modifier_pressed (window)) _gtk_window_schedule_mnemonics_visible (window); } - - return FALSE; } -static gint -gtk_window_focus_out_event (GtkWidget *widget, - GdkEventFocus *event) +static void +gtk_window_focus_out (GtkWidget *widget) { GtkWindow *window = GTK_WINDOW (widget); @@ -7803,8 +7807,6 @@ gtk_window_focus_out_event (GtkWidget *widget, /* set the mnemonic-visible property to false */ gtk_window_set_mnemonics_visible (window, FALSE); - - return FALSE; } static GtkWindowPopover *