mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 19:00:08 +00:00
a11y: remove implementation for [add/remove]_global_event_listener
Since release 2.5.3, ATK provides an implementation for those methods, so toolkits doesn't need to implement them.
This commit is contained in:
parent
47f5fbffd9
commit
4cfe2a38bf
@ -41,7 +41,7 @@ m4_define([gtk_binary_version], [3.0.0])
|
||||
# required versions of other packages
|
||||
m4_define([glib_required_version], [2.33.1])
|
||||
m4_define([pango_required_version], [1.30.0])
|
||||
m4_define([atk_required_version], [2.2.0])
|
||||
m4_define([atk_required_version], [2.5.3])
|
||||
m4_define([cairo_required_version], [1.10.0])
|
||||
m4_define([gdk_pixbuf_required_version], [2.26.0])
|
||||
m4_define([introspection_required_version], [1.32.0])
|
||||
|
@ -24,70 +24,16 @@
|
||||
#include "gtktoplevelaccessible.h"
|
||||
#include "gtkwindowaccessible.h"
|
||||
|
||||
|
||||
static GHashTable *listener_list = NULL;
|
||||
static gint listener_idx = 1;
|
||||
static GSList *key_listener_list = NULL;
|
||||
|
||||
typedef struct _GailUtilListenerInfo GailUtilListenerInfo;
|
||||
typedef struct _GailKeyEventInfo GailKeyEventInfo;
|
||||
|
||||
struct _GailUtilListenerInfo
|
||||
{
|
||||
gint key;
|
||||
guint signal_id;
|
||||
gulong hook_id;
|
||||
};
|
||||
|
||||
struct _GailKeyEventInfo
|
||||
{
|
||||
AtkKeyEventStruct *key_event;
|
||||
gpointer func_data;
|
||||
};
|
||||
|
||||
static guint
|
||||
add_listener (GSignalEmissionHook listener,
|
||||
const gchar *object_type,
|
||||
const gchar *signal_name,
|
||||
const gchar *hook_data)
|
||||
{
|
||||
GType type;
|
||||
guint signal_id;
|
||||
gint rc = 0;
|
||||
|
||||
type = g_type_from_name (object_type);
|
||||
if (type)
|
||||
{
|
||||
signal_id = g_signal_lookup (signal_name, type);
|
||||
if (signal_id > 0)
|
||||
{
|
||||
GailUtilListenerInfo *listener_info;
|
||||
|
||||
rc = listener_idx;
|
||||
|
||||
listener_info = g_new (GailUtilListenerInfo, 1);
|
||||
listener_info->key = listener_idx;
|
||||
listener_info->hook_id =
|
||||
g_signal_add_emission_hook (signal_id, 0, listener,
|
||||
g_strdup (hook_data),
|
||||
(GDestroyNotify) g_free);
|
||||
listener_info->signal_id = signal_id;
|
||||
|
||||
g_hash_table_insert (listener_list, &(listener_info->key), listener_info);
|
||||
listener_idx++;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning ("Invalid signal type %s\n", signal_name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning ("Invalid object type %s\n", object_type);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
state_event_watcher (GSignalInvocationHint *hint,
|
||||
guint n_param_values,
|
||||
@ -259,63 +205,6 @@ do_window_event_initialization (void)
|
||||
g_signal_connect (root, "children-changed::remove",
|
||||
(GCallback) window_removed, NULL);
|
||||
}
|
||||
static guint
|
||||
gail_util_add_global_event_listener (GSignalEmissionHook listener,
|
||||
const gchar *event_type)
|
||||
{
|
||||
guint rc = 0;
|
||||
gchar **split_string;
|
||||
|
||||
split_string = g_strsplit (event_type, ":", 3);
|
||||
|
||||
if (g_strv_length (split_string) == 3)
|
||||
rc = add_listener (listener, split_string[1], split_string[2], event_type);
|
||||
|
||||
g_strfreev (split_string);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_util_remove_global_event_listener (guint remove_listener)
|
||||
{
|
||||
if (remove_listener > 0)
|
||||
{
|
||||
GailUtilListenerInfo *listener_info;
|
||||
gint tmp_idx = remove_listener;
|
||||
|
||||
listener_info = (GailUtilListenerInfo *)
|
||||
g_hash_table_lookup(listener_list, &tmp_idx);
|
||||
|
||||
if (listener_info != NULL)
|
||||
{
|
||||
/* Hook id of 0 and signal id of 0 are invalid */
|
||||
if (listener_info->hook_id != 0 && listener_info->signal_id != 0)
|
||||
{
|
||||
/* Remove the emission hook */
|
||||
g_signal_remove_emission_hook(listener_info->signal_id,
|
||||
listener_info->hook_id);
|
||||
|
||||
/* Remove the element from the hash */
|
||||
g_hash_table_remove(listener_list, &tmp_idx);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning ("Invalid listener hook_id %ld or signal_id %d\n",
|
||||
listener_info->hook_id, listener_info->signal_id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning ("No listener with the specified listener id %d",
|
||||
remove_listener);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning ("Invalid listener_id %d", remove_listener);
|
||||
}
|
||||
}
|
||||
|
||||
static AtkKeyEventStruct *
|
||||
atk_key_event_from_gdk_event_key (GdkEventKey *key)
|
||||
@ -457,14 +346,11 @@ _gail_util_install (void)
|
||||
{
|
||||
AtkUtilClass *atk_class = ATK_UTIL_CLASS (g_type_class_ref (ATK_TYPE_UTIL));
|
||||
|
||||
atk_class->add_global_event_listener = gail_util_add_global_event_listener;
|
||||
atk_class->remove_global_event_listener = gail_util_remove_global_event_listener;
|
||||
atk_class->add_key_event_listener = gail_util_add_key_event_listener;
|
||||
atk_class->remove_key_event_listener = gail_util_remove_key_event_listener;
|
||||
atk_class->get_root = gail_util_get_root;
|
||||
atk_class->get_toolkit_name = gail_util_get_toolkit_name;
|
||||
atk_class->get_toolkit_version = gail_util_get_toolkit_version;
|
||||
|
||||
listener_list = g_hash_table_new_full (g_int_hash, g_int_equal, NULL, g_free);
|
||||
do_window_event_initialization ();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user