[gtk+] a11y: Stop using ::focus-in/out-event



commit 144448d18bfdde2a70d7e08fd3b02e46b756b90c
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Jan 6 11:48:53 2018 -0500

    a11y: Stop using ::focus-in/out-event
    
    We can just use the generic ::event signal.

 gtk/a11y/gtkwidgetaccessible.c |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)
---
diff --git a/gtk/a11y/gtkwidgetaccessible.c b/gtk/a11y/gtkwidgetaccessible.c
index 0f3a1a7..2bd384c 100644
--- a/gtk/a11y/gtkwidgetaccessible.c
+++ b/gtk/a11y/gtkwidgetaccessible.c
@@ -45,18 +45,21 @@ G_DEFINE_TYPE_WITH_CODE (GtkWidgetAccessible, gtk_widget_accessible, GTK_TYPE_AC
 
 /* Translate GtkWidget::focus-in/out-event to AtkObject::focus-event */
 static gboolean
-focus_cb (GtkWidget     *widget,
-          GdkEventFocus *event)
+focus_cb (GtkWidget *widget,
+          GdkEvent  *event)
 {
-  AtkObject *obj;
-  gboolean in;
+  if (gdk_event_get_event_type (event) == GDK_FOCUS_CHANGE)
+    {
+      AtkObject *obj;
+      gboolean in;
 
-  obj = gtk_widget_get_accessible (widget);
+      obj = gtk_widget_get_accessible (widget);
 
-  gdk_event_get_focus_in ((GdkEvent *)event, &in);
-  g_signal_emit_by_name (obj, "focus-event", in);
+      gdk_event_get_focus_in (event, &in);
+      g_signal_emit_by_name (obj, "focus-event", in);
+    }
 
-  return FALSE;
+  return GDK_EVENT_PROPAGATE;
 }
 
 /* Translate GtkWidget property change notification to the notify_gtk vfunc */
@@ -134,8 +137,7 @@ gtk_widget_accessible_initialize (AtkObject *obj,
 
   widget = GTK_WIDGET (data);
 
-  g_signal_connect_after (widget, "focus-in-event", G_CALLBACK (focus_cb), NULL);
-  g_signal_connect_after (widget, "focus-out-event", G_CALLBACK (focus_cb), NULL);
+  g_signal_connect_after (widget, "event", G_CALLBACK (focus_cb), NULL);
   g_signal_connect (widget, "notify", G_CALLBACK (notify_cb), NULL);
   g_signal_connect (widget, "size-allocate", G_CALLBACK (size_allocate_cb), NULL);
   g_signal_connect (widget, "map", G_CALLBACK (map_cb), NULL);
@@ -465,7 +467,7 @@ gtk_widget_accessible_notify_gtk (GObject    *obj,
 
   if (g_strcmp0 (pspec->name, "has-focus") == 0)
     /*
-     * We use focus-in-event and focus-out-event signals to catch
+     * We use focus change events to catch
      * focus changes so we ignore this.
      */
     return;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]