diff options
author | Matthias Clasen <mclasen@redhat.com> | 2018-01-06 12:51:33 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2018-01-16 14:14:10 -0500 |
commit | 7277d657d9636c00a7f455b6ed61a92536568594 (patch) | |
tree | c8332f2ea019d9c536b98507ade18b1604bfce2d /gtk/gtkwindow.c | |
parent | 327ec24e5111ae86b93bf56a907b7d3271af59f5 (diff) | |
download | gtk+-7277d657d9636c00a7f455b6ed61a92536568594.tar.gz |
window: Stop using ::focus-in/out-event
We can just use the generic ::event.
Diffstat (limited to 'gtk/gtkwindow.c')
-rw-r--r-- | gtk/gtkwindow.c | 36 |
1 files 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 * |