Merge lp:~apinheiro/unity/a11y-a11y-always-on into lp:unity

Proposed by Alejandro Piñeiro
Status: Rejected
Rejected by: Andrea Azzarone
Proposed branch: lp:~apinheiro/unity/a11y-a11y-always-on
Merge into: lp:unity
Diff against target: 354 lines (+12/-242)
5 files modified
CMakeLists.txt (+1/-2)
HACKING (+1/-0)
plugins/unityshell/src/unitya11y.cpp (+7/-123)
services/CMakeLists.txt (+1/-1)
services/panel-a11y.c (+2/-116)
To merge this branch: bzr merge lp:~apinheiro/unity/a11y-a11y-always-on
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) Disapprove
Marco Trevisan (Treviño) Approve
Alex Launi Pending
Review via email: mp+114479@code.launchpad.net

Commit message

a11y: Port unity3d and panel service accessibility init to atk-bridge

https://code.launchpad.net/bugs/1023542

Description of the change

See bug 1023542 for the reasons to do this merge.

After this merge:
  * Accessibility will be initialized using a library call instead of a module (plugin) runtime-load
  * Accessibility would be always on. Take into account that in the last releases of at-spi2-core and at-spi2-atk extra effort was done to not affect the system if no AT (like Orca) is listening. So right now bridge intialized + no AT is listening should be equivalent to not have the bridge initialized (aclaration added for people worried about performance and memory lose).

To post a comment you must log in.
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Once the conflict it's fixed, this is ok for me.

Revision history for this message
Alejandro Piñeiro (apinheiro) wrote :

> Once the conflict it's fixed, this is ok for me.

What conflict? Do you mean the new dependency?

Revision history for this message
Andrea Azzarone (azzar1) wrote :

> > Once the conflict it's fixed, this is ok for me.
>
> What conflict? Do you mean the new dependency?

8 +<<<<<<< TREE
9
10 set (UNITY_PLUGIN_DEPS "compiz;nux-3.0>=3.0.0;libbamf3;dee-1.0;gio-2.0;gio-unix-2.0;dbusmenu-glib-0.4;x11;libstartup-notification-1.0;gthread-2.0;indicator3-0.4>=0.4.90;atk;unity-misc>=0.4.0;gconf-2.0;libutouch-geis;gtk+-3.0>=3.1;sigc++-2.0;json-glib-1.0;libnotify;xfixes")
11
12 +=======
13 +set (UNITY_PLUGIN_DEPS "compiz;nux-2.0>=2.0.0;libbamf3;dee-1.0;gio-2.0;gio-unix-2.0;dbusmenu-glib-0.4;x11;libstartup-notification-1.0;gthread-2.0;indicator3-0.4>=0.4.90;atk;atk-bridge-2.0;unity-misc>=0.4.0;gconf-2.0;libutouch-geis;gtk+-3.0>=3.1;sigc++-2.0;json-glib-1.0;libnotify;gnome-desktop-3.0;xfixes")
14 +>>>>>>> MERGE-SOURCE

review: Needs Fixing
Revision history for this message
Alejandro Piñeiro (apinheiro) wrote :

> > > Once the conflict it's fixed, this is ok for me.
> >
> > What conflict? Do you mean the new dependency?
>
> 8 +<<<<<<< TREE
> 9
> 10 set (UNITY_PLUGIN_DEPS
> "compiz;nux-3.0>=3.0.0;libbamf3;dee-1.0;gio-2.0;gio-unix-2.0;dbusmenu-
> glib-0.4;x11;libstartup-
> notification-1.0;gthread-2.0;indicator3-0.4>=0.4.90;atk;unity-
> misc>=0.4.0;gconf-2.0;libutouch-geis;gtk+-3.0>=3.1;sigc++-2.0;json-
> glib-1.0;libnotify;xfixes")
> 11
> 12 +=======
> 13 +set (UNITY_PLUGIN_DEPS
> "compiz;nux-2.0>=2.0.0;libbamf3;dee-1.0;gio-2.0;gio-unix-2.0;dbusmenu-
> glib-0.4;x11;libstartup-
> notification-1.0;gthread-2.0;indicator3-0.4>=0.4.90;atk;atk-bridge-2.0;unity-
> misc>=0.4.0;gconf-2.0;libutouch-geis;gtk+-3.0>=3.1;sigc++-2.0;json-
> glib-1.0;libnotify;gnome-desktop-3.0;xfixes")
> 14 +>>>>>>> MERGE-SOURCE

Just in case you didn't notice, I have updated the branch, and solved the conflict.

Sorry for the noise of not realizing that conflict when I uploaded the branch.

Revision history for this message
Andrea Azzarone (azzar1) :
review: Approve
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Thanks, +1

review: Approve
Revision history for this message
Unity Merger (unity-merger) wrote :

No commit message specified.

Revision history for this message
Alejandro Piñeiro (apinheiro) wrote :

> No commit message specified.

Done, sorry AFAIR, this was not required when we just merged manually the branches approved.

Revision history for this message
Unity Merger (unity-merger) wrote :

Attempt to merge into lp:unity failed due to conflicts:

text conflict in CMakeLists.txt
text conflict in HACKING

Revision history for this message
Andrea Azzarone (azzar1) wrote :

Poke ;)

Revision history for this message
Alejandro Piñeiro (apinheiro) wrote :

> Poke ;)

Sorry, I missed that poke, I will update this branch as soon as possible.

Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Poke^2 ;)

Revision history for this message
Andrea Azzarone (azzar1) wrote :
review: Disapprove
Revision history for this message
Andrea Azzarone (azzar1) wrote :

*solved

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2012-07-09 07:51:54 +0000
3+++ CMakeLists.txt 2012-07-17 18:40:24 +0000
4@@ -133,8 +133,7 @@
5 #
6 # Compiz Plugins
7 #
8-
9-set (UNITY_PLUGIN_DEPS "compiz;nux-3.0>=3.0.0;libbamf3;dee-1.0;gio-2.0;gio-unix-2.0;dbusmenu-glib-0.4;x11;libstartup-notification-1.0;gthread-2.0;indicator3-0.4>=0.4.90;atk;unity-misc>=0.4.0;gconf-2.0;libutouch-geis;gtk+-3.0>=3.1;sigc++-2.0;json-glib-1.0;libnotify;xfixes")
10+set (UNITY_PLUGIN_DEPS "compiz;nux-3.0>=3.0.0;libbamf3;dee-1.0;gio-2.0;gio-unix-2.0;dbusmenu-glib-0.4;x11;libstartup-notification-1.0;gthread-2.0;indicator3-0.4>=0.4.90;atk;atk-bridge-2.0;unity-misc>=0.4.0;gconf-2.0;libutouch-geis;gtk+-3.0>=3.1;sigc++-2.0;json-glib-1.0;libnotify;xfixes")
11
12 find_package (PkgConfig)
13 pkg_check_modules (CACHED_UNITY_DEPS REQUIRED ${UNITY_PLUGIN_DEPS})
14
15=== modified file 'HACKING'
16--- HACKING 2012-06-19 03:34:06 +0000
17+++ HACKING 2012-07-17 18:40:24 +0000
18@@ -7,6 +7,7 @@
19 - gthread-2.0
20 - indicator
21 - atk
22+ - libatk-adaptor
23 - libutouch-geis
24
25 Or if you are on ubuntu run the command, apt-get build-dep unity
26
27=== modified file 'plugins/unityshell/src/unitya11y.cpp'
28--- plugins/unityshell/src/unitya11y.cpp 2012-05-17 19:34:56 +0000
29+++ plugins/unityshell/src/unitya11y.cpp 2012-07-17 18:40:24 +0000
30@@ -20,6 +20,7 @@
31 #include <gio/gio.h>
32 #include <gmodule.h>
33 #include <stdio.h>
34+#include <atk-bridge.h>
35
36 #include "unitya11y.h"
37 #include "unitya11ytests.h"
38@@ -62,12 +63,6 @@
39
40 static gboolean a11y_initialized = FALSE;
41
42-#define INIT_METHOD "gnome_accessibility_module_init"
43-#define DESKTOP_SCHEMA "org.gnome.desktop.interface"
44-#define ACCESSIBILITY_ENABLED_KEY "toolkit-accessibility"
45-#define AT_SPI_SCHEMA "org.a11y.atspi"
46-#define ATK_BRIDGE_LOCATION_KEY "atk-bridge-location"
47-
48 static void
49 unity_a11y_restore_environment(void)
50 {
51@@ -82,101 +77,6 @@
52 g_type_class_unref(g_type_class_ref(UNITY_TYPE_UTIL_ACCESSIBLE));
53 }
54
55-/* This method is required because g_setting_new abort if the schema
56- is not present. */
57-static gboolean
58-has_gsettings_schema(const gchar* schema)
59-{
60- const char* const* list_schemas = NULL;
61- gboolean found = FALSE;
62- int i = 0;
63-
64- list_schemas = g_settings_list_schemas();
65- for (i = 0; list_schemas [i]; i++)
66- {
67- if (!g_strcmp0(list_schemas[i], schema))
68- {
69- found = TRUE;
70- break;
71- }
72- }
73-
74- return found;
75-}
76-
77-static gboolean
78-should_enable_a11y(void)
79-{
80- GSettings* desktop_settings = NULL;
81- gboolean value = FALSE;
82-
83- if (!has_gsettings_schema(DESKTOP_SCHEMA))
84- return FALSE;
85-
86- desktop_settings = g_settings_new(DESKTOP_SCHEMA);
87- value = g_settings_get_boolean(desktop_settings, ACCESSIBILITY_ENABLED_KEY);
88-
89- g_object_unref(desktop_settings);
90-
91- return value;
92-}
93-
94-static gchar*
95-get_atk_bridge_path(void)
96-{
97- GSettings* atspi_settings = NULL;
98- GVariant *variant = NULL;
99- char* value = NULL;
100-
101- if (!has_gsettings_schema(AT_SPI_SCHEMA))
102- return NULL;
103-
104- atspi_settings = g_settings_new(AT_SPI_SCHEMA);
105- variant = g_settings_get_value (atspi_settings, ATK_BRIDGE_LOCATION_KEY);
106- value = g_variant_dup_bytestring (variant, NULL);
107-
108- g_variant_unref (variant);
109- g_object_unref(atspi_settings);
110-
111- return value;
112-}
113-
114-static gboolean
115-a11y_invoke_module(const char* module_path)
116-{
117- GModule* handle;
118- void (*invoke_fn)(void);
119-
120- if (!module_path)
121- {
122- g_warning("Accessibility: invalid module path (NULL)");
123-
124- return FALSE;
125- }
126-
127- if (!(handle = g_module_open(module_path, (GModuleFlags)0)))
128- {
129- g_warning("Accessibility: failed to load module '%s': '%s'",
130- module_path, g_module_error());
131-
132- return FALSE;
133- }
134-
135- if (!g_module_symbol(handle, INIT_METHOD, (gpointer*)&invoke_fn))
136- {
137- g_warning("Accessibility: error library '%s' does not include "
138- "method '%s' required for accessibility support",
139- module_path, INIT_METHOD);
140- g_module_close(handle);
141-
142- return FALSE;
143- }
144-
145- invoke_fn();
146-
147- return TRUE;
148-}
149-
150 /********************************************************************************/
151 /*
152 * In order to avoid the atk-bridge loading and the GAIL
153@@ -194,35 +94,19 @@
154 /*
155 * Initializes the accessibility (ATK) support on Unity
156 *
157- * It loads the atk-bridge if required. It checks:
158- * * If the proper gsettings keys are set
159- * * Loads the proper AtkUtil implementation
160 */
161 void
162 unity_a11y_init(nux::WindowThread* wt)
163 {
164- gchar* bridge_path = NULL;
165+ if (a11y_initialized)
166+ return;
167
168 unity_a11y_restore_environment();
169-
170- if (!should_enable_a11y())
171- return;
172-
173 load_unity_atk_util(wt);
174-
175- bridge_path = get_atk_bridge_path();
176-
177- if (a11y_invoke_module(bridge_path))
178- {
179- g_debug("Unity Oneiric accessibility started, using bridge on %s",
180- bridge_path);
181-
182- atk_get_root();
183-
184- a11y_initialized = TRUE;
185- }
186-
187- g_free(bridge_path);
188+ atk_bridge_adaptor_init(NULL, NULL);
189+ atk_get_root();
190+
191+ a11y_initialized = TRUE;
192
193 // NOTE: we run manually the unit tests while developing by
194 // uncommenting this. Take a look to the explanation on
195
196=== modified file 'services/CMakeLists.txt'
197--- services/CMakeLists.txt 2012-03-21 12:31:11 +0000
198+++ services/CMakeLists.txt 2012-07-17 18:40:24 +0000
199@@ -2,7 +2,7 @@
200 # Panel Service
201 #
202 find_package(PkgConfig)
203-pkg_check_modules(SERVICE_DEPS REQUIRED gtk+-3.0>=3.3 gobject-2.0 gio-2.0 gthread-2.0 indicator3-0.4>=0.4.90 x11 gconf-2.0)
204+pkg_check_modules(SERVICE_DEPS REQUIRED gtk+-3.0>=3.3 gobject-2.0 gio-2.0 gthread-2.0 indicator3-0.4>=0.4.90 x11 gconf-2.0 atk-bridge-2.0)
205
206 execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} indicator3-0.4 --variable indicatordir OUTPUT_VARIABLE _indicatordir OUTPUT_STRIP_TRAILING_WHITESPACE)
207 execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} indicator3-0.4 --variable iconsdir OUTPUT_VARIABLE _iconsdir OUTPUT_STRIP_TRAILING_WHITESPACE)
208
209=== modified file 'services/panel-a11y.c'
210--- services/panel-a11y.c 2011-09-09 14:04:34 +0000
211+++ services/panel-a11y.c 2012-07-17 18:40:24 +0000
212@@ -17,119 +17,16 @@
213 */
214
215 #include <gio/gio.h>
216+#include <atk-bridge.h>
217
218 #include "panel-a11y.h"
219 #include "panel-util-accessible.h"
220
221 static gboolean a11y_initialized = FALSE;
222
223-#define INIT_METHOD "gnome_accessibility_module_init"
224-#define DESKTOP_SCHEMA "org.gnome.desktop.interface"
225-#define ACCESSIBILITY_ENABLED_KEY "toolkit-accessibility"
226-#define AT_SPI_SCHEMA "org.a11y.atspi"
227-#define ATK_BRIDGE_LOCATION_KEY "atk-bridge-location"
228-
229-
230-/* This method is required because g_setting_new abort if the schema
231- is not present. */
232-static gboolean
233-has_gsettings_schema (const gchar *schema)
234-{
235- const char * const *list_schemas = NULL;
236- gboolean found = FALSE;
237- int i = 0;
238-
239- list_schemas = g_settings_list_schemas ();
240- for (i = 0; list_schemas [i]; i++)
241- {
242- if (!g_strcmp0 (list_schemas[i], schema))
243- {
244- found = TRUE;
245- break;
246- }
247- }
248-
249- return found;
250-}
251-
252-static gboolean
253-should_enable_a11y (void)
254-{
255- GSettings *desktop_settings = NULL;
256- gboolean value = FALSE;
257-
258- if (!has_gsettings_schema (DESKTOP_SCHEMA))
259- return FALSE;
260-
261- desktop_settings = g_settings_new (DESKTOP_SCHEMA);
262- value = g_settings_get_boolean (desktop_settings, ACCESSIBILITY_ENABLED_KEY);
263-
264- g_object_unref (desktop_settings);
265-
266- return value;
267-}
268-
269-static gchar*
270-get_atk_bridge_path (void)
271-{
272- GSettings *atspi_settings = NULL;
273- GVariant *variant = NULL;
274- char *value = NULL;
275-
276- if (!has_gsettings_schema (AT_SPI_SCHEMA))
277- return NULL;
278-
279- atspi_settings = g_settings_new(AT_SPI_SCHEMA);
280- variant = g_settings_get_value (atspi_settings, ATK_BRIDGE_LOCATION_KEY);
281- value = g_variant_dup_bytestring (variant, NULL);
282-
283- g_variant_unref (variant);
284- g_object_unref (atspi_settings);
285-
286- return value;
287-}
288-
289-static gboolean
290-a11y_invoke_module (const char *module_path)
291-{
292- GModule *handle;
293- void (*invoke_fn) (void);
294-
295- if (!module_path)
296- {
297- g_warning ("Accessibility: invalid module path (NULL)");
298-
299- return FALSE;
300- }
301-
302- if (!(handle = g_module_open (module_path, (GModuleFlags)0)))
303- {
304- g_warning ("Accessibility: failed to load module '%s': '%s'",
305- module_path, g_module_error ());
306-
307- return FALSE;
308- }
309-
310- if (!g_module_symbol (handle, INIT_METHOD, (gpointer *)&invoke_fn))
311- {
312- g_warning ("Accessibility: error library '%s' does not include "
313- "method '%s' required for accessibility support",
314- module_path, INIT_METHOD);
315- g_module_close (handle);
316-
317- return FALSE;
318- }
319-
320- invoke_fn ();
321-
322- return TRUE;
323-}
324-
325 void
326 panel_a11y_init (void)
327 {
328- gchar *bridge_path = NULL;
329-
330 if (a11y_initialized)
331 return;
332
333@@ -137,20 +34,9 @@
334 g_unsetenv ("NO_AT_BRIDGE");
335 g_unsetenv ("NO_GAIL");
336
337- if (!should_enable_a11y ())
338- return;
339-
340 /* Load PanelUtilAccessible class */
341 g_type_class_unref (g_type_class_ref (PANEL_TYPE_UTIL_ACCESSIBLE));
342-
343- bridge_path = get_atk_bridge_path ();
344- if (a11y_invoke_module (bridge_path))
345- {
346- g_debug ("Unity accessibility started, using bridge on %s", bridge_path);
347- }
348-
349- g_free (bridge_path);
350- atk_get_root ();
351+ atk_bridge_adaptor_init(NULL, NULL);
352
353 a11y_initialized = TRUE;
354 }