[clutter/clutter-1.20] a11y: provide a way to ensure clutter accessibility
- From: Alejandro Piñeiro Iglesias <apinheiro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter/clutter-1.20] a11y: provide a way to ensure clutter accessibility
- Date: Wed, 3 Sep 2014 14:04:38 +0000 (UTC)
commit 281a57a6a3bd56278cf0025614c066e3cb007da8
Author: Alejandro Piñeiro <apinheiro igalia com>
Date: Tue Sep 2 18:22:41 2014 +0200
a11y: provide a way to ensure clutter accessibility
If gtk_init is called after clutter_init, it can override clutter
AtkUtil implementation. In that situation, we can't say that
the accessibility is enabled, as the root object would be wrong.
In order to provide a way to prevent this:
* clutter_get_accessibility_enabled returns true of false
depending on the current AtkUtil implemented
* cally_accessibility_init always override AtkUtil implementation.
clutter/cally/cally-util.c | 12 ++++++++++++
clutter/cally/cally-util.h | 2 ++
clutter/cally/cally.c | 13 +++----------
3 files changed, 17 insertions(+), 10 deletions(-)
---
diff --git a/clutter/cally/cally-util.c b/clutter/cally/cally-util.c
index fdef295..ce37869 100644
--- a/clutter/cally/cally-util.c
+++ b/clutter/cally/cally-util.c
@@ -438,3 +438,15 @@ cally_util_stage_removed_cb (ClutterStageManager *stage_manager,
g_signal_handlers_disconnect_by_func (stage, cally_key_snooper_cb, NULL);
}
+
+void
+_cally_util_override_atk_util (void)
+{
+ AtkUtilClass *atk_class = ATK_UTIL_CLASS (g_type_class_ref (ATK_TYPE_UTIL));
+
+ atk_class->add_key_event_listener = cally_util_add_key_event_listener;
+ atk_class->remove_key_event_listener = cally_util_remove_key_event_listener;
+ atk_class->get_root = cally_util_get_root;
+ atk_class->get_toolkit_name = cally_util_get_toolkit_name;
+ atk_class->get_toolkit_version = cally_util_get_toolkit_version;
+}
diff --git a/clutter/cally/cally-util.h b/clutter/cally/cally-util.h
index 382e23a..76f36be 100644
--- a/clutter/cally/cally-util.h
+++ b/clutter/cally/cally-util.h
@@ -77,6 +77,8 @@ struct _CallyUtilClass
CLUTTER_AVAILABLE_IN_1_4
GType cally_util_get_type (void) G_GNUC_CONST;
+void _cally_util_override_atk_util (void);
+
G_END_DECLS
#endif /* __CALLY_UTIL_H__ */
diff --git a/clutter/cally/cally.c b/clutter/cally/cally.c
index 2edcdf8..4f23d20 100644
--- a/clutter/cally/cally.c
+++ b/clutter/cally/cally.c
@@ -53,8 +53,6 @@
#include "clutter-debug.h"
#include "clutter-private.h"
-static int cally_initialized = FALSE;
-
/* factories initialization*/
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_ACTOR, cally_actor, cally_actor_new)
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_GROUP, cally_group, cally_group_new)
@@ -77,11 +75,6 @@ CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_CLONE, cally_clone, cally_clone_new)
gboolean
cally_accessibility_init (void)
{
- if (cally_initialized)
- return TRUE;
-
- cally_initialized = TRUE;
-
/* setting the factories */
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_ACTOR, cally_actor);
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_GROUP, cally_group);
@@ -92,11 +85,11 @@ cally_accessibility_init (void)
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_CLONE, cally_clone);
/* Initialize the CallyUtility class */
- g_type_class_unref (g_type_class_ref (CALLY_TYPE_UTIL));
+ _cally_util_override_atk_util ();
CLUTTER_NOTE (MISC, "Clutter Accessibility initialized");
- return cally_initialized;
+ return TRUE;
}
/**
@@ -111,5 +104,5 @@ cally_accessibility_init (void)
*/
gboolean cally_get_cally_initialized (void)
{
- return cally_initialized;
+ return !g_strcmp0 (atk_get_toolkit_name (), "clutter");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]