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

Proposed by Luke Yelavich on 2015-02-20
Status: Merged
Approved by: Stephen M. Webb on 2015-02-26
Approved revision: 3922
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) 2015-02-20 Approve on 2015-02-26
PS Jenkins bot (community) continuous-integration Needs Fixing on 2015-02-20
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.
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
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
1=== modified file 'plugins/unityshell/src/nux-layout-accessible.cpp'
2--- plugins/unityshell/src/nux-layout-accessible.cpp 2014-02-19 04:15:22 +0000
3+++ plugins/unityshell/src/nux-layout-accessible.cpp 2015-02-20 04:50:28 +0000
4@@ -29,6 +29,7 @@
5 */
6
7 #include "nux-layout-accessible.h"
8+#include "unity-util-accessible.h"
9
10 #include "unitya11y.h"
11
12@@ -185,6 +186,7 @@
13 {
14 signal_name = "children-changed::add";
15 index = nux_layout_accessible_get_n_children(accessible) - 1;
16+ explore_children(accessible);
17 }
18 else
19 {
20
21=== modified file 'plugins/unityshell/src/nux-view-accessible.cpp'
22--- plugins/unityshell/src/nux-view-accessible.cpp 2012-07-09 20:33:59 +0000
23+++ plugins/unityshell/src/nux-view-accessible.cpp 2015-02-20 04:50:28 +0000
24@@ -28,6 +28,7 @@
25 */
26
27 #include "nux-view-accessible.h"
28+#include "unity-util-accessible.h"
29 #include "unitya11y.h"
30 #include "nux-base-window-accessible.h"
31
32@@ -241,9 +242,14 @@
33 atk_child = unity_a11y_get_accessible(layout);
34
35 if (is_add)
36+ {
37 signal_name = "children-changed::add";
38+ explore_children(accessible);
39+ }
40 else
41+ {
42 signal_name = "children-changed::remove";
43+ }
44
45 /* index is always 0 as there is always just one layout */
46 g_signal_emit_by_name(accessible, signal_name, 0, atk_child, NULL);
47
48=== modified file 'plugins/unityshell/src/unity-root-accessible.cpp'
49--- plugins/unityshell/src/unity-root-accessible.cpp 2012-10-15 12:48:26 +0000
50+++ plugins/unityshell/src/unity-root-accessible.cpp 2015-02-20 04:50:28 +0000
51@@ -27,6 +27,7 @@
52 */
53
54 #include "unity-root-accessible.h"
55+#include "unity-util-accessible.h"
56 #include "nux-base-window-accessible.h"
57 #include "unitya11y.h"
58
59@@ -48,7 +49,6 @@
60 gint i);
61 static AtkObject* unity_root_accessible_get_parent(AtkObject* obj);
62 /* private */
63-static void explore_children(AtkObject* obj);
64 static void check_active_window(UnityRootAccessible* self);
65 static void register_interesting_messages(UnityRootAccessible* self);
66 static void add_window(UnityRootAccessible* self,
67@@ -182,50 +182,6 @@
68
69 /* private */
70 /*
71- * FIXME: temporal solution
72- *
73- * Normally not all the accessible objects on the hierarchy are
74- * available from the beginning, and they are being created by demand
75- * due the request on the AT (ie: orca) side
76- *
77- * It usually follows a top-down approach. Top objects emits a signal
78- * of interest, so AT apps get interest on it, and request their
79- * children. One example is the signal "window::activate". AT receives
80- * a signal meaning that a top level object is activated, so request
81- * their children (and gran-children).
82- *
83- * Due technical reasons, right now it is hard to find a suitable way
84- * to emit the signal "activate" on the BaseWindow. That means that
85- * objects on the bottom of the hierarchy are not created, so Orca
86- * doesn't react to changes on sections like the Launcher.
87- *
88- * So in order to prevent that, we make a manual exploration of the
89- * hierarchy in order to ensure that those objects are there.
90- *
91- * NOTE: this manual exploration is not required with at-spi2, just
92- * with at-spi.
93- *
94- */
95-static void
96-explore_children(AtkObject* obj)
97-{
98- gint num = 0;
99- gint i = 0;
100- AtkObject* atk_child = NULL;
101-
102- g_return_if_fail(ATK_IS_OBJECT(obj));
103-
104- num = atk_object_get_n_accessible_children(obj);
105-
106- for (i = 0; i < num; i++)
107- {
108- atk_child = atk_object_ref_accessible_child(obj, i);
109- explore_children(atk_child);
110- g_object_unref(atk_child);
111- }
112-}
113-
114-/*
115 * Call all the children (NuxBaseWindowAccessible) to check if they
116 * are in the proper active or deactive status.
117 */
118
119=== modified file 'plugins/unityshell/src/unity-util-accessible.cpp'
120--- plugins/unityshell/src/unity-util-accessible.cpp 2013-02-21 12:01:36 +0000
121+++ plugins/unityshell/src/unity-util-accessible.cpp 2015-02-20 04:50:28 +0000
122@@ -447,3 +447,47 @@
123 {
124 unity_window_thread = wt;
125 }
126+
127+/*
128+ * FIXME: temporal solution
129+ *
130+ * Normally not all the accessible objects on the hierarchy are
131+ * available from the beginning, and they are being created by demand
132+ * due the request on the AT (ie: orca) side
133+ *
134+ * It usually follows a top-down approach. Top objects emits a signal
135+ * of interest, so AT apps get interest on it, and request their
136+ * children. One example is the signal "window::activate". AT receives
137+ * a signal meaning that a top level object is activated, so request
138+ * their children (and gran-children).
139+ *
140+ * Due technical reasons, right now it is hard to find a suitable way
141+ * to emit the signal "activate" on the BaseWindow. That means that
142+ * objects on the bottom of the hierarchy are not created, so Orca
143+ * doesn't react to changes on sections like the Launcher.
144+ *
145+ * So in order to prevent that, we make a manual exploration of the
146+ * hierarchy in order to ensure that those objects are there.
147+ *
148+ * NOTE: this manual exploration is not required with at-spi2, just
149+ * with at-spi.
150+ *
151+ */
152+void
153+explore_children(AtkObject* obj)
154+{
155+ gint num = 0;
156+ gint i = 0;
157+ AtkObject* atk_child = NULL;
158+
159+ g_return_if_fail(ATK_IS_OBJECT(obj));
160+
161+ num = atk_object_get_n_accessible_children(obj);
162+
163+ for (i = 0; i < num; i++)
164+ {
165+ atk_child = atk_object_ref_accessible_child(obj, i);
166+ explore_children(atk_child);
167+ g_object_unref(atk_child);
168+ }
169+}
170
171=== modified file 'plugins/unityshell/src/unity-util-accessible.h'
172--- plugins/unityshell/src/unity-util-accessible.h 2011-09-12 16:51:28 +0000
173+++ plugins/unityshell/src/unity-util-accessible.h 2015-02-20 04:50:28 +0000
174@@ -53,6 +53,7 @@
175 GType unity_util_accessible_get_type(void);
176
177 void unity_util_accessible_set_window_thread(nux::WindowThread* wt);
178+void explore_children(AtkObject* obj);
179
180 G_END_DECLS
181