[gtk+/wip/matthiasc/kill-event-signals: 116/123] treeview: Stop using ::focus-out-event
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/matthiasc/kill-event-signals: 116/123] treeview: Stop using ::focus-out-event
- Date: Wed, 10 Jan 2018 23:37:18 +0000 (UTC)
commit 9be1c885b1995e065c5dcfc37da4a48050dea143
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Jan 6 18:10:11 2018 -0500
treeview: Stop using ::focus-out-event
We can just use the generic ::event signal.
gtk/gtktreeview.c | 36 ++++++++++++++++++++++++------------
1 files changed, 24 insertions(+), 12 deletions(-)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index f957624..65e47cf 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -605,8 +605,8 @@ static gboolean gtk_tree_view_key_release (GtkWidget *widget,
static void gtk_tree_view_set_focus_child (GtkContainer *container,
GtkWidget *child);
-static gint gtk_tree_view_focus_out (GtkWidget *widget,
- GdkEventFocus *event);
+static gboolean gtk_tree_view_event (GtkWidget *widget,
+ GdkEvent *event);
static gint gtk_tree_view_focus (GtkWidget *widget,
GtkDirectionType direction);
static void gtk_tree_view_grab_focus (GtkWidget *widget);
@@ -977,7 +977,7 @@ gtk_tree_view_class_init (GtkTreeViewClass *class)
widget_class->snapshot = gtk_tree_view_snapshot;
widget_class->key_press_event = gtk_tree_view_key_press;
widget_class->key_release_event = gtk_tree_view_key_release;
- widget_class->focus_out_event = gtk_tree_view_focus_out;
+ widget_class->event = gtk_tree_view_event;
widget_class->drag_begin = gtk_tree_view_drag_begin;
widget_class->drag_end = gtk_tree_view_drag_end;
widget_class->drag_data_get = gtk_tree_view_drag_data_get;
@@ -5798,21 +5798,33 @@ gtk_tree_view_motion_controller_leave (GtkEventControllerMotion *controller,
}
-static gint
-gtk_tree_view_focus_out (GtkWidget *widget,
- GdkEventFocus *event)
+static gboolean
+gtk_tree_view_event (GtkWidget *widget,
+ GdkEvent *event)
{
GtkTreeView *tree_view;
tree_view = GTK_TREE_VIEW (widget);
- gtk_widget_queue_draw (widget);
+ if (gdk_event_get_event_type (event) == GDK_FOCUS_CHANGE)
+ {
+ gboolean focus_in;
- /* destroy interactive search dialog */
- if (tree_view->priv->search_window)
- gtk_tree_view_search_window_hide (tree_view->priv->search_window, tree_view,
- gdk_event_get_device ((GdkEvent *) event));
- return FALSE;
+ gdk_event_get_focus_in (event, &focus_in);
+ if (!focus_in)
+ {
+ gtk_widget_queue_draw (widget);
+
+ /* destroy interactive search dialog */
+ if (tree_view->priv->search_window)
+ gtk_tree_view_search_window_hide (tree_view->priv->search_window, tree_view,
+ gdk_event_get_device ((GdkEvent *) event));
+ }
+
+ return GDK_EVENT_PROPAGATE;
+ }
+
+ return GDK_EVENT_PROPAGATE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]