Commit dbabff08 authored by Benjamin Otte's avatar Benjamin Otte

a11y: Invoke key snooper directly

Gets around the deprecated function warnings.
parent 637e6688
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
static GHashTable *listener_list = NULL; static GHashTable *listener_list = NULL;
static gint listener_idx = 1; static gint listener_idx = 1;
static GSList *key_listener_list = NULL; static GSList *key_listener_list = NULL;
static guint key_snooper_id = 0;
typedef struct _GailUtilListenerInfo GailUtilListenerInfo; typedef struct _GailUtilListenerInfo GailUtilListenerInfo;
typedef struct _GailKeyEventInfo GailKeyEventInfo; typedef struct _GailKeyEventInfo GailKeyEventInfo;
...@@ -368,10 +367,9 @@ typedef struct { ...@@ -368,10 +367,9 @@ typedef struct {
guint key; guint key;
} KeyEventListener; } KeyEventListener;
static gint gboolean
gail_key_snooper (GtkWidget *the_widget, _gail_util_key_snooper (GtkWidget *the_widget,
GdkEventKey *event, GdkEventKey *event)
gpointer data)
{ {
GSList *l; GSList *l;
AtkKeyEventStruct *atk_event; AtkKeyEventStruct *atk_event;
...@@ -399,9 +397,6 @@ gail_util_add_key_event_listener (AtkKeySnoopFunc listener_func, ...@@ -399,9 +397,6 @@ gail_util_add_key_event_listener (AtkKeySnoopFunc listener_func,
static guint key = 0; static guint key = 0;
KeyEventListener *listener; KeyEventListener *listener;
if (key_snooper_id == 0)
key_snooper_id = gtk_key_snooper_install (gail_key_snooper, NULL);
key++; key++;
listener = g_slice_new0 (KeyEventListener); listener = g_slice_new0 (KeyEventListener);
...@@ -431,12 +426,6 @@ gail_util_remove_key_event_listener (guint listener_key) ...@@ -431,12 +426,6 @@ gail_util_remove_key_event_listener (guint listener_key)
break; break;
} }
} }
if (key_listener_list == NULL)
{
gtk_key_snooper_remove (key_snooper_id);
key_snooper_id = 0;
}
} }
static AtkObject * static AtkObject *
......
...@@ -26,6 +26,9 @@ G_BEGIN_DECLS ...@@ -26,6 +26,9 @@ G_BEGIN_DECLS
void _gail_util_install (void); void _gail_util_install (void);
gboolean _gail_util_key_snooper (GtkWidget *the_widget,
GdkEventKey *event);
G_END_DECLS G_END_DECLS
#endif /* __GAIL_UTIL_H__ */ #endif /* __GAIL_UTIL_H__ */
...@@ -130,6 +130,7 @@ ...@@ -130,6 +130,7 @@
#include "gtkwidgetprivate.h" #include "gtkwidgetprivate.h"
#include "gtkwindowprivate.h" #include "gtkwindowprivate.h"
#include "a11y/gailutil.h"
/* Private type definitions /* Private type definitions
*/ */
...@@ -2206,6 +2207,8 @@ gtk_invoke_key_snoopers (GtkWidget *grab_widget, ...@@ -2206,6 +2207,8 @@ gtk_invoke_key_snoopers (GtkWidget *grab_widget,
GSList *slist; GSList *slist;
gint return_val = FALSE; gint return_val = FALSE;
return_val = _gail_util_key_snooper (grab_widget, event);
slist = key_snoopers; slist = key_snoopers;
while (slist && !return_val) while (slist && !return_val)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment