Merge lp:~themuso/unity/explore-children-when-view-or-layout-added into lp:unity

Proposed by Luke Yelavich
Status: Merged
Approved by: Stephen M. Webb
Approved revision: no longer in the source branch.
Merged at revision: 3924
Proposed branch: lp:~themuso/unity/explore-children-when-view-or-layout-added
Merge into: lp:unity
Diff against target: 180 lines (+54/-45)
5 files modified
plugins/unityshell/src/nux-layout-accessible.cpp (+2/-0)
plugins/unityshell/src/nux-view-accessible.cpp (+6/-0)
plugins/unityshell/src/unity-root-accessible.cpp (+1/-45)
plugins/unityshell/src/unity-util-accessible.cpp (+44/-0)
plugins/unityshell/src/unity-util-accessible.h (+1/-0)
To merge this branch: bzr merge lp:~themuso/unity/explore-children-when-view-or-layout-added
Reviewer Review Type Date Requested Status
Stephen M. Webb (community) Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+250409@code.launchpad.net

Commit message

Explore children when a view or layout is added

The dash results view grid objects are not being created when the dash is opened. Force an exploration of the children of a view or layout to make sure any dynamically added/removed objects in the dash can be found.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Stephen M. Webb (bregma) wrote :

PS Jenkins is just being PS Jenkins.

Builds fine on our (unofficial) test servers and does what's on the label. Ready for merging.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/unityshell/src/nux-layout-accessible.cpp'
--- plugins/unityshell/src/nux-layout-accessible.cpp 2014-02-19 04:15:22 +0000
+++ plugins/unityshell/src/nux-layout-accessible.cpp 2015-02-20 04:50:28 +0000
@@ -29,6 +29,7 @@
29 */29 */
3030
31#include "nux-layout-accessible.h"31#include "nux-layout-accessible.h"
32#include "unity-util-accessible.h"
3233
33#include "unitya11y.h"34#include "unitya11y.h"
3435
@@ -185,6 +186,7 @@
185 {186 {
186 signal_name = "children-changed::add";187 signal_name = "children-changed::add";
187 index = nux_layout_accessible_get_n_children(accessible) - 1;188 index = nux_layout_accessible_get_n_children(accessible) - 1;
189 explore_children(accessible);
188 }190 }
189 else191 else
190 {192 {
191193
=== modified file 'plugins/unityshell/src/nux-view-accessible.cpp'
--- plugins/unityshell/src/nux-view-accessible.cpp 2012-07-09 20:33:59 +0000
+++ plugins/unityshell/src/nux-view-accessible.cpp 2015-02-20 04:50:28 +0000
@@ -28,6 +28,7 @@
28 */28 */
2929
30#include "nux-view-accessible.h"30#include "nux-view-accessible.h"
31#include "unity-util-accessible.h"
31#include "unitya11y.h"32#include "unitya11y.h"
32#include "nux-base-window-accessible.h"33#include "nux-base-window-accessible.h"
3334
@@ -241,9 +242,14 @@
241 atk_child = unity_a11y_get_accessible(layout);242 atk_child = unity_a11y_get_accessible(layout);
242243
243 if (is_add)244 if (is_add)
245 {
244 signal_name = "children-changed::add";246 signal_name = "children-changed::add";
247 explore_children(accessible);
248 }
245 else249 else
250 {
246 signal_name = "children-changed::remove";251 signal_name = "children-changed::remove";
252 }
247253
248 /* index is always 0 as there is always just one layout */254 /* index is always 0 as there is always just one layout */
249 g_signal_emit_by_name(accessible, signal_name, 0, atk_child, NULL);255 g_signal_emit_by_name(accessible, signal_name, 0, atk_child, NULL);
250256
=== modified file 'plugins/unityshell/src/unity-root-accessible.cpp'
--- plugins/unityshell/src/unity-root-accessible.cpp 2012-10-15 12:48:26 +0000
+++ plugins/unityshell/src/unity-root-accessible.cpp 2015-02-20 04:50:28 +0000
@@ -27,6 +27,7 @@
27 */27 */
2828
29#include "unity-root-accessible.h"29#include "unity-root-accessible.h"
30#include "unity-util-accessible.h"
30#include "nux-base-window-accessible.h"31#include "nux-base-window-accessible.h"
31#include "unitya11y.h"32#include "unitya11y.h"
3233
@@ -48,7 +49,6 @@
48 gint i);49 gint i);
49static AtkObject* unity_root_accessible_get_parent(AtkObject* obj);50static AtkObject* unity_root_accessible_get_parent(AtkObject* obj);
50/* private */51/* private */
51static void explore_children(AtkObject* obj);
52static void check_active_window(UnityRootAccessible* self);52static void check_active_window(UnityRootAccessible* self);
53static void register_interesting_messages(UnityRootAccessible* self);53static void register_interesting_messages(UnityRootAccessible* self);
54static void add_window(UnityRootAccessible* self,54static void add_window(UnityRootAccessible* self,
@@ -182,50 +182,6 @@
182182
183/* private */183/* private */
184/*184/*
185 * FIXME: temporal solution
186 *
187 * Normally not all the accessible objects on the hierarchy are
188 * available from the beginning, and they are being created by demand
189 * due the request on the AT (ie: orca) side
190 *
191 * It usually follows a top-down approach. Top objects emits a signal
192 * of interest, so AT apps get interest on it, and request their
193 * children. One example is the signal "window::activate". AT receives
194 * a signal meaning that a top level object is activated, so request
195 * their children (and gran-children).
196 *
197 * Due technical reasons, right now it is hard to find a suitable way
198 * to emit the signal "activate" on the BaseWindow. That means that
199 * objects on the bottom of the hierarchy are not created, so Orca
200 * doesn't react to changes on sections like the Launcher.
201 *
202 * So in order to prevent that, we make a manual exploration of the
203 * hierarchy in order to ensure that those objects are there.
204 *
205 * NOTE: this manual exploration is not required with at-spi2, just
206 * with at-spi.
207 *
208 */
209static void
210explore_children(AtkObject* obj)
211{
212 gint num = 0;
213 gint i = 0;
214 AtkObject* atk_child = NULL;
215
216 g_return_if_fail(ATK_IS_OBJECT(obj));
217
218 num = atk_object_get_n_accessible_children(obj);
219
220 for (i = 0; i < num; i++)
221 {
222 atk_child = atk_object_ref_accessible_child(obj, i);
223 explore_children(atk_child);
224 g_object_unref(atk_child);
225 }
226}
227
228/*
229 * Call all the children (NuxBaseWindowAccessible) to check if they185 * Call all the children (NuxBaseWindowAccessible) to check if they
230 * are in the proper active or deactive status.186 * are in the proper active or deactive status.
231 */187 */
232188
=== modified file 'plugins/unityshell/src/unity-util-accessible.cpp'
--- plugins/unityshell/src/unity-util-accessible.cpp 2013-02-21 12:01:36 +0000
+++ plugins/unityshell/src/unity-util-accessible.cpp 2015-02-20 04:50:28 +0000
@@ -447,3 +447,47 @@
447{447{
448 unity_window_thread = wt;448 unity_window_thread = wt;
449}449}
450
451/*
452 * FIXME: temporal solution
453 *
454 * Normally not all the accessible objects on the hierarchy are
455 * available from the beginning, and they are being created by demand
456 * due the request on the AT (ie: orca) side
457 *
458 * It usually follows a top-down approach. Top objects emits a signal
459 * of interest, so AT apps get interest on it, and request their
460 * children. One example is the signal "window::activate". AT receives
461 * a signal meaning that a top level object is activated, so request
462 * their children (and gran-children).
463 *
464 * Due technical reasons, right now it is hard to find a suitable way
465 * to emit the signal "activate" on the BaseWindow. That means that
466 * objects on the bottom of the hierarchy are not created, so Orca
467 * doesn't react to changes on sections like the Launcher.
468 *
469 * So in order to prevent that, we make a manual exploration of the
470 * hierarchy in order to ensure that those objects are there.
471 *
472 * NOTE: this manual exploration is not required with at-spi2, just
473 * with at-spi.
474 *
475 */
476void
477explore_children(AtkObject* obj)
478{
479 gint num = 0;
480 gint i = 0;
481 AtkObject* atk_child = NULL;
482
483 g_return_if_fail(ATK_IS_OBJECT(obj));
484
485 num = atk_object_get_n_accessible_children(obj);
486
487 for (i = 0; i < num; i++)
488 {
489 atk_child = atk_object_ref_accessible_child(obj, i);
490 explore_children(atk_child);
491 g_object_unref(atk_child);
492 }
493}
450494
=== modified file 'plugins/unityshell/src/unity-util-accessible.h'
--- plugins/unityshell/src/unity-util-accessible.h 2011-09-12 16:51:28 +0000
+++ plugins/unityshell/src/unity-util-accessible.h 2015-02-20 04:50:28 +0000
@@ -53,6 +53,7 @@
53GType unity_util_accessible_get_type(void);53GType unity_util_accessible_get_type(void);
5454
55void unity_util_accessible_set_window_thread(nux::WindowThread* wt);55void unity_util_accessible_set_window_thread(nux::WindowThread* wt);
56void explore_children(AtkObject* obj);
5657
57G_END_DECLS58G_END_DECLS
5859