[gtk+] a11y: Invoke key snooper directly



commit dbabff08466d265b5e229336d9f5db349b3b4397
Author: Benjamin Otte <otte redhat com>
Date:   Thu Jan 19 10:31:52 2012 +0100

    a11y: Invoke key snooper directly
    
    Gets around the deprecated function warnings.

 gtk/a11y/gailutil.c |   17 +++--------------
 gtk/a11y/gailutil.h |    3 +++
 gtk/gtkmain.c       |    3 +++
 3 files changed, 9 insertions(+), 14 deletions(-)
---
diff --git a/gtk/a11y/gailutil.c b/gtk/a11y/gailutil.c
index 8cba1c2..0d27c4d 100644
--- a/gtk/a11y/gailutil.c
+++ b/gtk/a11y/gailutil.c
@@ -30,7 +30,6 @@
 static GHashTable *listener_list = NULL;
 static gint listener_idx = 1;
 static GSList *key_listener_list = NULL;
-static guint key_snooper_id = 0;
 
 typedef struct _GailUtilListenerInfo GailUtilListenerInfo;
 typedef struct _GailKeyEventInfo GailKeyEventInfo;
@@ -368,10 +367,9 @@ typedef struct {
   guint           key;
 } KeyEventListener;
 
-static gint
-gail_key_snooper (GtkWidget   *the_widget,
-                  GdkEventKey *event,
-                  gpointer     data)
+gboolean
+_gail_util_key_snooper (GtkWidget   *the_widget,
+                        GdkEventKey *event)
 {
   GSList *l;
   AtkKeyEventStruct *atk_event;
@@ -399,9 +397,6 @@ gail_util_add_key_event_listener (AtkKeySnoopFunc  listener_func,
   static guint key = 0;
   KeyEventListener *listener;
 
-  if (key_snooper_id == 0)
-    key_snooper_id = gtk_key_snooper_install (gail_key_snooper, NULL);
-
   key++;
 
   listener = g_slice_new0 (KeyEventListener);
@@ -431,12 +426,6 @@ gail_util_remove_key_event_listener (guint listener_key)
           break;
         }
     }
-
-  if (key_listener_list == NULL)
-    {
-      gtk_key_snooper_remove (key_snooper_id);
-      key_snooper_id = 0;
-    }
 }
 
 static AtkObject *
diff --git a/gtk/a11y/gailutil.h b/gtk/a11y/gailutil.h
index d835b17..a2b8b91 100644
--- a/gtk/a11y/gailutil.h
+++ b/gtk/a11y/gailutil.h
@@ -26,6 +26,9 @@ G_BEGIN_DECLS
 
 void _gail_util_install (void);
 
+gboolean  _gail_util_key_snooper (GtkWidget   *the_widget,
+                                  GdkEventKey *event);
+
 G_END_DECLS
 
 #endif /* __GAIL_UTIL_H__ */
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index d6c5f72..99d3ce1 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -130,6 +130,7 @@
 #include "gtkwidgetprivate.h"
 #include "gtkwindowprivate.h"
 
+#include "a11y/gailutil.h"
 
 /* Private type definitions
  */
@@ -2206,6 +2207,8 @@ gtk_invoke_key_snoopers (GtkWidget *grab_widget,
   GSList *slist;
   gint return_val = FALSE;
 
+  return_val = _gail_util_key_snooper (grab_widget, event);
+
   slist = key_snoopers;
   while (slist && !return_val)
     {



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