Merge lp:~apinheiro/unity/a11y-review-places into lp:unity
- a11y-review-places
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 1051 |
Proposed branch: | lp:~apinheiro/unity/a11y-review-places |
Merge into: | lp:unity |
Diff against target: |
1656 lines (+935/-186) 19 files modified
src/PlacesSearchBar.h (+5/-0) src/nux-area-accessible.cpp (+257/-20) src/nux-area-accessible.h (+4/-0) src/nux-base-window-accessible.cpp (+134/-2) src/nux-base-window-accessible.h (+4/-0) src/nux-view-accessible.cpp (+65/-135) src/nux-view-accessible.h (+4/-0) src/unity-launcher-accessible.cpp (+38/-5) src/unity-launcher-icon-accessible.cpp (+10/-12) src/unity-places-view-accessible.cpp (+112/-0) src/unity-places-view-accessible.h (+57/-0) src/unity-root-accessible.cpp (+4/-3) src/unity-root-accessible.h (+2/-1) src/unity-search-bar-accessible.cpp (+132/-0) src/unity-search-bar-accessible.h (+57/-0) src/unity-util-accessible.cpp (+32/-5) src/unity-util-accessible.h (+2/-2) src/unitya11y.cpp (+9/-0) src/unityshell.cpp (+7/-1) |
To merge this branch: | bzr merge lp:~apinheiro/unity/a11y-review-places |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Rodrigo Moya (community) | Approve | ||
Review via email: mp+55139@code.launchpad.net |
Commit message
Description of the change
This branch provides the base support for the Dash.
Some explanation:
* Dash is using Focusable class to manage the focus
* But it is not used on the Launcher
* So I needed to use both, and being care to not create
* In the same way, places still requires the low level focus management, as the top level window (a base window) still requires to get the key input focus
* But the places focus management based on Focusable can start to be applied before receive the key input focus.
* So in order to have a proper order (base window focus, then places contain focus), I don't emit the focus change based on Focusable until the top level base window became active.
So, with this branch:
* Launcher is still working
* Pressing Alt+F2 you get the notification of places window being focused, and search bar entry being focused.
NOTE: with the alt+f2 thing, we get a extra notification or orca. I will try to fix it while Rodrigo reviews the branch
Rodrigo Moya (rodrigo-moya) wrote : | # |
Alejandro Piñeiro (apinheiro) wrote : | # |
> Run command dialog and places window seem to work ok with orca, but none of
> the buttons in the places window seem to be accessible at all (I guess that's
> intended though, as this branch doesn't seem to include stuff to do that).
Yes, it is a known issue. The intention of the branch is provide the base, focusing on the run command dialog, as a full a11y support for the dash is out of scope taking into account the current deadlines.
> Also, the extents of both windows seem to be wrong when selecting them in
> accerciser.
The work to provide accurate extents values is also postponed, mainly because it is blocked by this nux bug:
https:/
(In the same way, launcher icon would require an ad-hoc compute, as they are not a nux::View subclass)
Rodrigo Moya (rodrigo-moya) wrote : | # |
Ok, approving then, so merge as soon as you fix the extra notification thing (or keep that for another branch, as you wish)
Preview Diff
1 | === modified file 'src/PlacesSearchBar.h' |
2 | --- src/PlacesSearchBar.h 2011-03-23 21:11:00 +0000 |
3 | +++ src/PlacesSearchBar.h 2011-03-28 12:38:26 +0000 |
4 | @@ -60,6 +60,11 @@ |
5 | sigc::signal<void, const char *> search_changed; |
6 | sigc::signal<void> activated; |
7 | |
8 | + nux::TextEntry* GetTextEntry () |
9 | + { |
10 | + return _pango_entry; |
11 | + } |
12 | + |
13 | protected: |
14 | // Introspectable methods |
15 | const gchar * GetName (); |
16 | |
17 | === modified file 'src/nux-area-accessible.cpp' |
18 | --- src/nux-area-accessible.cpp 2011-03-24 17:09:19 +0000 |
19 | +++ src/nux-area-accessible.cpp 2011-03-28 12:38:26 +0000 |
20 | @@ -37,39 +37,76 @@ |
21 | static void nux_area_accessible_init (NuxAreaAccessible *area_accessible); |
22 | |
23 | /* AtkObject.h */ |
24 | -static void nux_area_accessible_initialize (AtkObject *accessible, |
25 | - gpointer data); |
26 | -static AtkObject *nux_area_accessible_get_parent (AtkObject *obj); |
27 | -static AtkStateSet* nux_area_accessible_ref_state_set (AtkObject *obj); |
28 | +static void nux_area_accessible_initialize (AtkObject *accessible, |
29 | + gpointer data); |
30 | +static AtkObject * nux_area_accessible_get_parent (AtkObject *obj); |
31 | +static AtkStateSet* nux_area_accessible_ref_state_set (AtkObject *obj); |
32 | |
33 | /* AtkComponent.h */ |
34 | -static void atk_component_interface_init (AtkComponentIface *iface); |
35 | -static void nux_area_accessible_get_extents (AtkComponent *component, |
36 | - gint *x, |
37 | - gint *y, |
38 | - gint *width, |
39 | - gint *height, |
40 | - AtkCoordType coord_type); |
41 | - |
42 | - |
43 | - |
44 | -G_DEFINE_TYPE_WITH_CODE (NuxAreaAccessible, nux_area_accessible, NUX_TYPE_OBJECT_ACCESSIBLE, |
45 | - G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, atk_component_interface_init)) |
46 | +static void atk_component_interface_init (AtkComponentIface *iface); |
47 | +static void nux_area_accessible_get_extents (AtkComponent *component, |
48 | + gint *x, |
49 | + gint *y, |
50 | + gint *width, |
51 | + gint *height, |
52 | + AtkCoordType coord_type); |
53 | +static gboolean nux_area_accessible_grab_focus (AtkComponent *component); |
54 | +static guint nux_area_accessible_add_focus_handler (AtkComponent *component, |
55 | + AtkFocusHandler handler); |
56 | +static void nux_area_accessible_remove_focus_handler (AtkComponent *component, |
57 | + guint handler_id); |
58 | +static void nux_area_accessible_focus_handler (AtkObject *accessible, |
59 | + gboolean focus_in); |
60 | +/* private */ |
61 | +static void on_focus_changed_cb (nux::Area *area, |
62 | + AtkObject *accessible); |
63 | +static void on_parent_window_activate_cb (AtkObject *parent_window, |
64 | + NuxAreaAccessible *self); |
65 | +static AtkObject * search_for_parent_window (AtkObject *object); |
66 | + |
67 | + |
68 | +G_DEFINE_TYPE_WITH_CODE (NuxAreaAccessible, |
69 | + nux_area_accessible, |
70 | + NUX_TYPE_OBJECT_ACCESSIBLE, |
71 | + G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, |
72 | + atk_component_interface_init)) |
73 | + |
74 | +#define NUX_AREA_ACCESSIBLE_GET_PRIVATE(obj) \ |
75 | + (G_TYPE_INSTANCE_GET_PRIVATE ((obj), NUX_TYPE_AREA_ACCESSIBLE, \ |
76 | + NuxAreaAccessiblePrivate)) |
77 | + |
78 | +struct _NuxAreaAccessiblePrivate |
79 | +{ |
80 | + /* Cached values (used to avoid extra notifications) */ |
81 | + gboolean focused; |
82 | + |
83 | + /* Top level parent window, it is not required to be the direct |
84 | + parent */ |
85 | + AtkObject *parent_window; |
86 | +}; |
87 | + |
88 | |
89 | static void |
90 | nux_area_accessible_class_init (NuxAreaAccessibleClass *klass) |
91 | { |
92 | + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
93 | AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass); |
94 | |
95 | /* AtkObject */ |
96 | atk_class->initialize = nux_area_accessible_initialize; |
97 | atk_class->get_parent = nux_area_accessible_get_parent; |
98 | atk_class->ref_state_set = nux_area_accessible_ref_state_set; |
99 | + |
100 | + g_type_class_add_private (gobject_class, sizeof (NuxAreaAccessiblePrivate)); |
101 | } |
102 | |
103 | static void |
104 | nux_area_accessible_init (NuxAreaAccessible *area_accessible) |
105 | { |
106 | + NuxAreaAccessiblePrivate *priv = |
107 | + NUX_AREA_ACCESSIBLE_GET_PRIVATE (area_accessible); |
108 | + |
109 | + area_accessible->priv = priv; |
110 | } |
111 | |
112 | AtkObject* |
113 | @@ -91,9 +128,21 @@ |
114 | nux_area_accessible_initialize (AtkObject *accessible, |
115 | gpointer data) |
116 | { |
117 | + nux::Object *nux_object = NULL; |
118 | + nux::Area *area = NULL; |
119 | + |
120 | ATK_OBJECT_CLASS (nux_area_accessible_parent_class)->initialize (accessible, data); |
121 | |
122 | accessible->role = ATK_ROLE_UNKNOWN; |
123 | + |
124 | + nux_object = nux_object_accessible_get_object (NUX_OBJECT_ACCESSIBLE (accessible)); |
125 | + area = dynamic_cast<nux::Area *>(nux_object); |
126 | + |
127 | + /* focus support based on Focusable, used on the Dash */ |
128 | + area->FocusChanged.connect (sigc::bind (sigc::ptr_fun (on_focus_changed_cb), accessible)); |
129 | + |
130 | + atk_component_add_focus_handler (ATK_COMPONENT (accessible), |
131 | + nux_area_accessible_focus_handler); |
132 | } |
133 | |
134 | static AtkObject * |
135 | @@ -110,7 +159,7 @@ |
136 | |
137 | nux_object = nux_object_accessible_get_object (NUX_OBJECT_ACCESSIBLE (obj)); |
138 | |
139 | - if (nux_object == NULL) /* actor is defunct */ |
140 | + if (nux_object == NULL) /* defunct */ |
141 | return NULL; |
142 | |
143 | area = dynamic_cast<nux::Area *>(nux_object); |
144 | @@ -156,7 +205,7 @@ |
145 | |
146 | nux_object = nux_object_accessible_get_object (NUX_OBJECT_ACCESSIBLE (obj)); |
147 | |
148 | - if (nux_object == NULL) /* actor is defunct */ |
149 | + if (nux_object == NULL) /* defunct */ |
150 | return state_set; |
151 | |
152 | area = dynamic_cast<nux::Area *>(nux_object); |
153 | @@ -175,6 +224,12 @@ |
154 | atk_state_set_add_state (state_set, ATK_STATE_SHOWING); |
155 | } |
156 | |
157 | + if (area->CanFocus ()) |
158 | + atk_state_set_add_state (state_set, ATK_STATE_FOCUSABLE); |
159 | + |
160 | + if (area->GetFocused ()) |
161 | + atk_state_set_add_state (state_set, ATK_STATE_FOCUSED); |
162 | + |
163 | return state_set; |
164 | } |
165 | |
166 | @@ -184,9 +239,13 @@ |
167 | { |
168 | g_return_if_fail (iface != NULL); |
169 | |
170 | + /* placement */ |
171 | iface->get_extents = nux_area_accessible_get_extents; |
172 | |
173 | - /* Focus management is done on NuxViewAccessible */ |
174 | + /* focus management based on Focusable */ |
175 | + iface->grab_focus = nux_area_accessible_grab_focus; |
176 | + iface->add_focus_handler = nux_area_accessible_add_focus_handler; |
177 | + iface->remove_focus_handler = nux_area_accessible_remove_focus_handler; |
178 | } |
179 | |
180 | static void |
181 | @@ -207,7 +266,7 @@ |
182 | |
183 | nux_object = nux_object_accessible_get_object (NUX_OBJECT_ACCESSIBLE (component)); |
184 | |
185 | - if (nux_object == NULL) /* actor is defunct */ |
186 | + if (nux_object == NULL) /* defunct */ |
187 | return; |
188 | |
189 | area = dynamic_cast<nux::Area *>(nux_object); |
190 | @@ -234,3 +293,181 @@ |
191 | |
192 | return; |
193 | } |
194 | + |
195 | +static gboolean |
196 | +nux_area_accessible_grab_focus (AtkComponent *component) |
197 | +{ |
198 | + nux::Object *nux_object = NULL; |
199 | + nux::Area *area = NULL; |
200 | + |
201 | + g_return_val_if_fail (NUX_IS_AREA_ACCESSIBLE (component), FALSE); |
202 | + |
203 | + nux_object = nux_object_accessible_get_object (NUX_OBJECT_ACCESSIBLE (component)); |
204 | + if (nux_object == NULL) /* defunct */ |
205 | + return FALSE; |
206 | + |
207 | + area = dynamic_cast<nux::Area *>(nux_object); |
208 | + |
209 | + area->SetFocused (TRUE); |
210 | + |
211 | + /* FIXME: SetFocused doesn't return if the force was succesful or |
212 | + not, we suppose that this is the case like in cally and gail */ |
213 | + |
214 | + return TRUE; |
215 | +} |
216 | + |
217 | +/* |
218 | + * comment C&P from cally-actor: |
219 | + * |
220 | + * "These methods are basically taken from gail, as I don't see any |
221 | + * reason to modify it. It makes me wonder why it is really required |
222 | + * to be implemented in the toolkit" |
223 | + */ |
224 | + |
225 | +static guint |
226 | +nux_area_accessible_add_focus_handler (AtkComponent *component, |
227 | + AtkFocusHandler handler) |
228 | +{ |
229 | + GSignalMatchType match_type; |
230 | + gulong ret; |
231 | + guint signal_id; |
232 | + |
233 | + g_return_val_if_fail (NUX_IS_AREA_ACCESSIBLE (component), 0); |
234 | + |
235 | + match_type = (GSignalMatchType) (G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC); |
236 | + signal_id = g_signal_lookup ("focus-event", ATK_TYPE_OBJECT); |
237 | + |
238 | + ret = g_signal_handler_find (component, match_type, signal_id, 0, NULL, |
239 | + (gpointer) handler, NULL); |
240 | + if (!ret) |
241 | + { |
242 | + return g_signal_connect_closure_by_id (component, |
243 | + signal_id, 0, |
244 | + g_cclosure_new (G_CALLBACK (handler), NULL, |
245 | + (GClosureNotify) NULL), |
246 | + FALSE); |
247 | + } |
248 | + else |
249 | + return 0; |
250 | +} |
251 | + |
252 | +static void |
253 | +nux_area_accessible_remove_focus_handler (AtkComponent *component, |
254 | + guint handler_id) |
255 | +{ |
256 | + g_return_if_fail (NUX_IS_AREA_ACCESSIBLE (component)); |
257 | + |
258 | + g_signal_handler_disconnect (component, handler_id); |
259 | +} |
260 | + |
261 | +static void |
262 | +nux_area_accessible_focus_handler (AtkObject *accessible, |
263 | + gboolean focus_in) |
264 | +{ |
265 | + g_return_if_fail (NUX_IS_AREA_ACCESSIBLE (accessible)); |
266 | + |
267 | + g_debug ("[a11y][area] focus_handler (%p:%s:%i)", |
268 | + accessible, atk_object_get_name (accessible), focus_in); |
269 | + |
270 | + atk_object_notify_state_change (accessible, ATK_STATE_FOCUSED, focus_in); |
271 | +} |
272 | + |
273 | +/* private */ |
274 | +static gboolean |
275 | +check_parent_window_active (NuxAreaAccessible *self) |
276 | +{ |
277 | + gboolean active = FALSE; |
278 | + AtkStateSet *state_set = NULL; |
279 | + |
280 | + if (self->priv->parent_window == NULL) |
281 | + { |
282 | + self->priv->parent_window = search_for_parent_window (ATK_OBJECT (self)); |
283 | + |
284 | + g_signal_connect (self->priv->parent_window, |
285 | + "activate", |
286 | + G_CALLBACK (on_parent_window_activate_cb), |
287 | + self); |
288 | + } |
289 | + |
290 | + state_set = atk_object_ref_state_set (ATK_OBJECT (self->priv->parent_window)); |
291 | + |
292 | + active = atk_state_set_contains_state (state_set, ATK_STATE_ACTIVE); |
293 | + |
294 | + g_debug ("[a11y][area] check_parent_window_active %i", active); |
295 | + |
296 | + g_object_unref (state_set); |
297 | + |
298 | + return active; |
299 | +} |
300 | + |
301 | +static void |
302 | +check_focus_change (nux::Area *area, |
303 | + AtkObject *accessible) |
304 | +{ |
305 | + gboolean focus_in = FALSE; |
306 | + NuxAreaAccessible *self = NULL; |
307 | + gboolean is_parent_window_active = FALSE; |
308 | + |
309 | + g_return_if_fail (NUX_IS_AREA_ACCESSIBLE (accessible)); |
310 | + |
311 | + self = NUX_AREA_ACCESSIBLE (accessible); |
312 | + |
313 | + if (area->GetFocused ()) |
314 | + focus_in = TRUE; |
315 | + |
316 | + is_parent_window_active = check_parent_window_active (self); |
317 | + |
318 | + /* We don't emit focus_in=TRUE events until the top level window is |
319 | + active*/ |
320 | + if ((focus_in) && (!is_parent_window_active)) |
321 | + return; |
322 | + |
323 | + if (self->priv->focused != focus_in) |
324 | + { |
325 | + self->priv->focused = focus_in; |
326 | + |
327 | + g_debug ("[a11y][area] on_focus_change_cb (actual focus change) : (%p:%s:%i)", |
328 | + accessible, atk_object_get_name (accessible), focus_in); |
329 | + |
330 | + g_signal_emit_by_name (accessible, "focus_event", focus_in); |
331 | + atk_focus_tracker_notify (accessible); |
332 | + } |
333 | +} |
334 | + |
335 | +static void |
336 | +on_focus_changed_cb (nux::Area *area, |
337 | + AtkObject *accessible) |
338 | +{ |
339 | + check_focus_change (area, accessible); |
340 | +} |
341 | + |
342 | +static AtkObject * |
343 | +search_for_parent_window (AtkObject *object) |
344 | +{ |
345 | + AtkObject *parent = NULL; |
346 | + |
347 | + for (parent = atk_object_get_parent (object); |
348 | + (parent != NULL) && (atk_object_get_role (parent) != ATK_ROLE_WINDOW); |
349 | + parent = atk_object_get_parent (parent)); |
350 | + |
351 | + if (parent == NULL) |
352 | + g_debug ("[a11y][area] search_for_parent NO PARENT WINDOW"); |
353 | + |
354 | + return parent; |
355 | +} |
356 | + |
357 | +static void |
358 | +on_parent_window_activate_cb (AtkObject *parent_window, |
359 | + NuxAreaAccessible *self) |
360 | +{ |
361 | + nux::Object *nux_object = NULL; |
362 | + nux::Area *area = NULL; |
363 | + |
364 | + nux_object = nux_object_accessible_get_object (NUX_OBJECT_ACCESSIBLE (self)); |
365 | + if (nux_object == NULL) /* defunct */ |
366 | + return; |
367 | + |
368 | + area = dynamic_cast<nux::Area *>(nux_object); |
369 | + |
370 | + check_focus_change (area, ATK_OBJECT (self)); |
371 | +} |
372 | |
373 | === modified file 'src/nux-area-accessible.h' |
374 | --- src/nux-area-accessible.h 2011-02-17 12:57:17 +0000 |
375 | +++ src/nux-area-accessible.h 2011-03-28 12:38:26 +0000 |
376 | @@ -34,10 +34,14 @@ |
377 | |
378 | typedef struct _NuxAreaAccessible NuxAreaAccessible; |
379 | typedef struct _NuxAreaAccessibleClass NuxAreaAccessibleClass; |
380 | +typedef struct _NuxAreaAccessiblePrivate NuxAreaAccessiblePrivate; |
381 | |
382 | struct _NuxAreaAccessible |
383 | { |
384 | NuxObjectAccessible parent; |
385 | + |
386 | + /*< private >*/ |
387 | + NuxAreaAccessiblePrivate *priv; |
388 | }; |
389 | |
390 | struct _NuxAreaAccessibleClass |
391 | |
392 | === modified file 'src/nux-base-window-accessible.cpp' |
393 | --- src/nux-base-window-accessible.cpp 2011-03-09 09:44:28 +0000 |
394 | +++ src/nux-base-window-accessible.cpp 2011-03-28 12:38:26 +0000 |
395 | @@ -34,6 +34,14 @@ |
396 | #include "Nux/Area.h" |
397 | #include "Nux/Layout.h" |
398 | |
399 | +enum { |
400 | + ACTIVATE, |
401 | + DEACTIVATE, |
402 | + LAST_SIGNAL |
403 | +}; |
404 | + |
405 | +static guint signals [LAST_SIGNAL] = { 0, }; |
406 | + |
407 | /* GObject */ |
408 | static void nux_base_window_accessible_class_init (NuxBaseWindowAccessibleClass *klass); |
409 | static void nux_base_window_accessible_init (NuxBaseWindowAccessible *base_window_accessible); |
410 | @@ -42,23 +50,85 @@ |
411 | static void nux_base_window_accessible_initialize (AtkObject *accessible, |
412 | gpointer data); |
413 | static AtkObject *nux_base_window_accessible_get_parent (AtkObject *obj); |
414 | +static AtkStateSet *nux_base_window_accessible_ref_state_set (AtkObject *obj); |
415 | |
416 | +/* private */ |
417 | +static void on_focus_event_cb (AtkObject *object, |
418 | + gboolean in, |
419 | + gpointer data); |
420 | |
421 | G_DEFINE_TYPE (NuxBaseWindowAccessible, nux_base_window_accessible, NUX_TYPE_VIEW_ACCESSIBLE) |
422 | |
423 | +struct _NuxBaseWindowAccessiblePrivate |
424 | +{ |
425 | + /* Cached values (used to avoid extra notifications) */ |
426 | + gboolean active; |
427 | +}; |
428 | + |
429 | +#define NUX_BASE_WINDOW_ACCESSIBLE_GET_PRIVATE(obj) \ |
430 | + (G_TYPE_INSTANCE_GET_PRIVATE ((obj), NUX_TYPE_BASE_WINDOW_ACCESSIBLE, \ |
431 | + NuxBaseWindowAccessiblePrivate)) |
432 | + |
433 | static void |
434 | nux_base_window_accessible_class_init (NuxBaseWindowAccessibleClass *klass) |
435 | { |
436 | + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
437 | AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass); |
438 | |
439 | /* AtkObject */ |
440 | atk_class->initialize = nux_base_window_accessible_initialize; |
441 | atk_class->get_parent = nux_base_window_accessible_get_parent; |
442 | + atk_class->ref_state_set = nux_base_window_accessible_ref_state_set; |
443 | + |
444 | + g_type_class_add_private (gobject_class, sizeof (NuxBaseWindowAccessiblePrivate)); |
445 | + |
446 | + /** |
447 | + * BaseWindow::activate: |
448 | + * @nux_object: the object which received the signal |
449 | + * |
450 | + * The ::activate signal is emitted when the window receives the key |
451 | + * focus from the underlying window system. |
452 | + * |
453 | + * Toolkit implementation note: it is used when anyone adds a global |
454 | + * event listener to "window:activate" |
455 | + */ |
456 | + signals [ACTIVATE] = |
457 | + g_signal_new ("activate", |
458 | + G_TYPE_FROM_CLASS (klass), |
459 | + G_SIGNAL_RUN_LAST, |
460 | + 0, /* default signal handler */ |
461 | + NULL, NULL, |
462 | + g_cclosure_marshal_VOID__VOID, |
463 | + G_TYPE_NONE, 0); |
464 | + |
465 | + /** |
466 | + * BaseWindow::deactivate: |
467 | + * @nux_object: the object which received the signal |
468 | + * |
469 | + * The ::deactivate signal is emitted when the window loses key |
470 | + * focus from the underlying window system. |
471 | + * |
472 | + * Toolkit implementation note: it is used when anyone adds a global |
473 | + * event listener to "window:deactivate" |
474 | + */ |
475 | + signals [DEACTIVATE] = |
476 | + g_signal_new ("deactivate", |
477 | + G_TYPE_FROM_CLASS (klass), |
478 | + G_SIGNAL_RUN_LAST, |
479 | + 0, /* default signal handler */ |
480 | + NULL, NULL, |
481 | + g_cclosure_marshal_VOID__VOID, |
482 | + G_TYPE_NONE, 0); |
483 | + |
484 | } |
485 | |
486 | static void |
487 | nux_base_window_accessible_init (NuxBaseWindowAccessible *base_window_accessible) |
488 | { |
489 | + NuxBaseWindowAccessiblePrivate *priv = |
490 | + NUX_BASE_WINDOW_ACCESSIBLE_GET_PRIVATE (base_window_accessible); |
491 | + |
492 | + base_window_accessible->priv = priv; |
493 | } |
494 | |
495 | AtkObject* |
496 | @@ -72,8 +142,6 @@ |
497 | |
498 | atk_object_initialize (accessible, object); |
499 | |
500 | - atk_object_set_name (accessible, "BaseWindow"); |
501 | - |
502 | return accessible; |
503 | } |
504 | |
505 | @@ -85,6 +153,9 @@ |
506 | ATK_OBJECT_CLASS (nux_base_window_accessible_parent_class)->initialize (accessible, data); |
507 | |
508 | accessible->role = ATK_ROLE_WINDOW; |
509 | + |
510 | + g_signal_connect (accessible, "focus-event", |
511 | + G_CALLBACK (on_focus_event_cb), NULL); |
512 | } |
513 | |
514 | static AtkObject* |
515 | @@ -92,3 +163,64 @@ |
516 | { |
517 | return atk_get_root (); |
518 | } |
519 | + |
520 | +static AtkStateSet* |
521 | +nux_base_window_accessible_ref_state_set (AtkObject *obj) |
522 | +{ |
523 | + AtkStateSet *state_set = NULL; |
524 | + NuxBaseWindowAccessible *self = NULL; |
525 | + nux::Object *nux_object = NULL; |
526 | + |
527 | + g_return_val_if_fail (NUX_IS_BASE_WINDOW_ACCESSIBLE (obj), NULL); |
528 | + |
529 | + state_set = ATK_OBJECT_CLASS (nux_base_window_accessible_parent_class)->ref_state_set (obj); |
530 | + |
531 | + nux_object = nux_object_accessible_get_object (NUX_OBJECT_ACCESSIBLE (obj)); |
532 | + if (nux_object == NULL) /* defunct */ |
533 | + return state_set; |
534 | + |
535 | + self = NUX_BASE_WINDOW_ACCESSIBLE (obj); |
536 | + |
537 | + atk_state_set_add_state (state_set, ATK_STATE_FOCUSABLE); |
538 | + |
539 | + if (self->priv->active) |
540 | + { |
541 | + atk_state_set_add_state (state_set, ATK_STATE_ACTIVE); |
542 | + atk_state_set_add_state (state_set, ATK_STATE_FOCUSED); |
543 | + } |
544 | + |
545 | + return state_set; |
546 | +} |
547 | + |
548 | +/* private */ |
549 | +static void |
550 | +on_focus_event_cb (AtkObject *object, |
551 | + gboolean focus_in, |
552 | + gpointer data) |
553 | +{ |
554 | + NuxBaseWindowAccessible *self = NULL; |
555 | + |
556 | + /* On the base window, we suppose that the window is active if it |
557 | + has the focus*/ |
558 | + self = NUX_BASE_WINDOW_ACCESSIBLE (object); |
559 | + |
560 | + if (self->priv->active != focus_in) |
561 | + { |
562 | + gint signal_id; |
563 | + |
564 | + self->priv->active = focus_in; |
565 | + |
566 | + atk_object_notify_state_change (ATK_OBJECT (self), |
567 | + ATK_STATE_ACTIVE, focus_in); |
568 | + |
569 | + if (focus_in) |
570 | + signal_id = ACTIVATE; |
571 | + else |
572 | + signal_id = DEACTIVATE; |
573 | + |
574 | + g_debug ("[a11y][bwindow] on_focus_event activate events (%p:%s:%i)", |
575 | + object, atk_object_get_name (object), focus_in); |
576 | + |
577 | + g_signal_emit (self, signals [signal_id], 0); |
578 | + } |
579 | +} |
580 | |
581 | === modified file 'src/nux-base-window-accessible.h' |
582 | --- src/nux-base-window-accessible.h 2011-02-17 12:57:17 +0000 |
583 | +++ src/nux-base-window-accessible.h 2011-03-28 12:38:26 +0000 |
584 | @@ -37,10 +37,14 @@ |
585 | |
586 | typedef struct _NuxBaseWindowAccessible NuxBaseWindowAccessible; |
587 | typedef struct _NuxBaseWindowAccessibleClass NuxBaseWindowAccessibleClass; |
588 | +typedef struct _NuxBaseWindowAccessiblePrivate NuxBaseWindowAccessiblePrivate; |
589 | |
590 | struct _NuxBaseWindowAccessible |
591 | { |
592 | NuxViewAccessible parent; |
593 | + |
594 | + /*< private >*/ |
595 | + NuxBaseWindowAccessiblePrivate *priv; |
596 | }; |
597 | |
598 | struct _NuxBaseWindowAccessibleClass |
599 | |
600 | === modified file 'src/nux-view-accessible.cpp' |
601 | --- src/nux-view-accessible.cpp 2011-03-21 00:30:48 +0000 |
602 | +++ src/nux-view-accessible.cpp 2011-03-28 12:38:26 +0000 |
603 | @@ -31,6 +31,7 @@ |
604 | #include "unitya11y.h" |
605 | |
606 | #include "Nux/Layout.h" |
607 | +#include "Nux/Area.h" |
608 | |
609 | /* GObject */ |
610 | static void nux_view_accessible_class_init (NuxViewAccessibleClass *klass); |
611 | @@ -44,34 +45,34 @@ |
612 | static gint nux_view_accessible_get_n_children (AtkObject *obj); |
613 | static AtkObject* nux_view_accessible_ref_child (AtkObject *obj, |
614 | gint i); |
615 | - |
616 | -/* AtkComponent.h */ |
617 | -static void atk_component_interface_init (AtkComponentIface *iface); |
618 | -static gboolean nux_view_accessible_grab_focus (AtkComponent *component); |
619 | -static guint nux_view_accessible_add_focus_handler (AtkComponent *component, |
620 | - AtkFocusHandler handler); |
621 | -static void nux_view_accessible_remove_focus_handler (AtkComponent *component, |
622 | - guint handler_id); |
623 | - |
624 | /* private methods */ |
625 | -static void on_start_focus_cb (AtkObject *accessible); |
626 | -static void on_end_focus_cb (AtkObject *accessible); |
627 | -static void nux_view_accessible_focus_handler (AtkObject *accessible, |
628 | - gboolean focus_in); |
629 | -static void on_layout_changed_cb (nux::View *view, |
630 | - nux::Layout *layout, |
631 | - AtkObject *accessible, |
632 | - gboolean is_add); |
633 | - |
634 | -G_DEFINE_TYPE_WITH_CODE (NuxViewAccessible, |
635 | - nux_view_accessible, |
636 | - NUX_TYPE_AREA_ACCESSIBLE, |
637 | - G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, |
638 | - atk_component_interface_init)) |
639 | +static void on_layout_changed_cb (nux::View *view, |
640 | + nux::Layout *layout, |
641 | + AtkObject *accessible, |
642 | + gboolean is_add); |
643 | +static void on_start_focus_cb (AtkObject *accessible); |
644 | +static void on_end_focus_cb (AtkObject *accessible); |
645 | + |
646 | + |
647 | +G_DEFINE_TYPE (NuxViewAccessible, |
648 | + nux_view_accessible, |
649 | + NUX_TYPE_AREA_ACCESSIBLE) |
650 | + |
651 | +#define NUX_VIEW_ACCESSIBLE_GET_PRIVATE(obj) \ |
652 | + (G_TYPE_INSTANCE_GET_PRIVATE ((obj), NUX_TYPE_VIEW_ACCESSIBLE, \ |
653 | + NuxViewAccessiblePrivate)) |
654 | + |
655 | +struct _NuxViewAccessiblePrivate |
656 | +{ |
657 | + /* Cached values (used to avoid extra notifications) */ |
658 | + gboolean focused; |
659 | +}; |
660 | + |
661 | |
662 | static void |
663 | nux_view_accessible_class_init (NuxViewAccessibleClass *klass) |
664 | { |
665 | + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
666 | AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass); |
667 | |
668 | /* AtkObject */ |
669 | @@ -79,11 +80,17 @@ |
670 | atk_class->ref_state_set = nux_view_accessible_ref_state_set; |
671 | atk_class->ref_child = nux_view_accessible_ref_child; |
672 | atk_class->get_n_children = nux_view_accessible_get_n_children; |
673 | + |
674 | + g_type_class_add_private (gobject_class, sizeof (NuxViewAccessiblePrivate)); |
675 | } |
676 | |
677 | static void |
678 | nux_view_accessible_init (NuxViewAccessible *view_accessible) |
679 | { |
680 | + NuxViewAccessiblePrivate *priv = |
681 | + NUX_VIEW_ACCESSIBLE_GET_PRIVATE (view_accessible); |
682 | + |
683 | + view_accessible->priv = priv; |
684 | } |
685 | |
686 | AtkObject* |
687 | @@ -115,16 +122,17 @@ |
688 | nux_object = nux_object_accessible_get_object (NUX_OBJECT_ACCESSIBLE (accessible)); |
689 | view = dynamic_cast<nux::View *>(nux_object); |
690 | |
691 | - view->OnStartFocus.connect (sigc::bind (sigc::ptr_fun (on_start_focus_cb), accessible)); |
692 | - view->OnEndFocus.connect (sigc::bind (sigc::ptr_fun (on_end_focus_cb), accessible)); |
693 | - |
694 | view->LayoutAdded.connect (sigc::bind (sigc::ptr_fun (on_layout_changed_cb), |
695 | accessible, TRUE)); |
696 | view->LayoutRemoved.connect (sigc::bind (sigc::ptr_fun (on_layout_changed_cb), |
697 | accessible, FALSE)); |
698 | |
699 | - atk_component_add_focus_handler (ATK_COMPONENT (accessible), |
700 | - nux_view_accessible_focus_handler); |
701 | + /* Some extra focus things as Focusable is not used on Launcher and |
702 | + some BaseWindow */ |
703 | + view->OnStartFocus.connect (sigc::bind (sigc::ptr_fun (on_start_focus_cb), |
704 | + accessible)); |
705 | + view->OnEndFocus.connect (sigc::bind (sigc::ptr_fun (on_end_focus_cb), |
706 | + accessible)); |
707 | } |
708 | |
709 | static AtkStateSet* |
710 | @@ -140,15 +148,13 @@ |
711 | |
712 | nux_object = nux_object_accessible_get_object (NUX_OBJECT_ACCESSIBLE (obj)); |
713 | |
714 | - if (nux_object == NULL) /* actor is defunct */ |
715 | + if (nux_object == NULL) /* defunct */ |
716 | return state_set; |
717 | |
718 | view = dynamic_cast<nux::View *>(nux_object); |
719 | |
720 | - /* FIXME: Waiting for the full keyboard navigation support, for the |
721 | - moment any nux object is focusable*/ |
722 | - atk_state_set_add_state (state_set, ATK_STATE_FOCUSABLE); |
723 | - |
724 | + /* required for some basic object as the BaseWindow containing the |
725 | + Launcher */ |
726 | if (view->HasKeyboardFocus ()) |
727 | atk_state_set_add_state (state_set, ATK_STATE_FOCUSED); |
728 | |
729 | @@ -210,24 +216,6 @@ |
730 | } |
731 | |
732 | static void |
733 | -on_start_focus_cb (AtkObject *accessible) |
734 | -{ |
735 | - g_debug ("[a11y] on start_focus_cb: (%p:%s)", accessible, atk_object_get_name (accessible)); |
736 | - |
737 | - g_signal_emit_by_name (accessible, "focus_event", TRUE); |
738 | - atk_focus_tracker_notify (accessible); |
739 | -} |
740 | - |
741 | -static void |
742 | -on_end_focus_cb (AtkObject *accessible) |
743 | -{ |
744 | - g_debug ("[a11y] on end_focus_cb: (%p:%s)", accessible, atk_object_get_name (accessible)); |
745 | - |
746 | - g_signal_emit_by_name (accessible, "focus_event", FALSE); |
747 | - atk_focus_tracker_notify (accessible); |
748 | -} |
749 | - |
750 | -static void |
751 | on_layout_changed_cb (nux::View *view, |
752 | nux::Layout *layout, |
753 | AtkObject *accessible, |
754 | @@ -254,91 +242,33 @@ |
755 | g_signal_emit_by_name (accessible, signal_name, 0, atk_child, NULL); |
756 | } |
757 | |
758 | -/* AtkComponent.h */ |
759 | static void |
760 | -atk_component_interface_init (AtkComponentIface *iface) |
761 | -{ |
762 | - g_return_if_fail (iface != NULL); |
763 | - |
764 | - /* focus management */ |
765 | - iface->grab_focus = nux_view_accessible_grab_focus; |
766 | - iface->add_focus_handler = nux_view_accessible_add_focus_handler; |
767 | - iface->remove_focus_handler = nux_view_accessible_remove_focus_handler; |
768 | -} |
769 | - |
770 | -static gboolean |
771 | -nux_view_accessible_grab_focus (AtkComponent *component) |
772 | -{ |
773 | - nux::Object *nux_object = NULL; |
774 | - nux::View *view = NULL; |
775 | - |
776 | - g_return_val_if_fail (NUX_IS_VIEW_ACCESSIBLE (component), FALSE); |
777 | - |
778 | - nux_object = nux_object_accessible_get_object (NUX_OBJECT_ACCESSIBLE (component)); |
779 | - if (nux_object == NULL) /* actor is defunct */ |
780 | - return FALSE; |
781 | - |
782 | - view = dynamic_cast<nux::View *>(nux_object); |
783 | - |
784 | - view->ForceStartFocus (0, 0); |
785 | - |
786 | - /* FIXME: ForceStartFocus doesn't return if the force was succesful |
787 | - or not, we suppose that this is the case like in cally and gail */ |
788 | - return TRUE; |
789 | -} |
790 | - |
791 | -/* |
792 | - * comment C&P from cally-actor: |
793 | - * |
794 | - * "These methods are basically taken from gail, as I don't see any |
795 | - * reason to modify it. It makes me wonder why it is really required |
796 | - * to be implemented in the toolkit" |
797 | - */ |
798 | - |
799 | -static guint |
800 | -nux_view_accessible_add_focus_handler (AtkComponent *component, |
801 | - AtkFocusHandler handler) |
802 | -{ |
803 | - GSignalMatchType match_type; |
804 | - gulong ret; |
805 | - guint signal_id; |
806 | - |
807 | - g_return_val_if_fail (NUX_IS_VIEW_ACCESSIBLE (component), 0); |
808 | - |
809 | - match_type = (GSignalMatchType) (G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC); |
810 | - signal_id = g_signal_lookup ("focus-event", ATK_TYPE_OBJECT); |
811 | - |
812 | - ret = g_signal_handler_find (component, match_type, signal_id, 0, NULL, |
813 | - (gpointer) handler, NULL); |
814 | - if (!ret) |
815 | +check_focus (NuxViewAccessible *self, |
816 | + gboolean focus_in) |
817 | +{ |
818 | + if (self->priv->focused != focus_in) |
819 | { |
820 | - return g_signal_connect_closure_by_id (component, |
821 | - signal_id, 0, |
822 | - g_cclosure_new (G_CALLBACK (handler), NULL, |
823 | - (GClosureNotify) NULL), |
824 | - FALSE); |
825 | + self->priv->focused = focus_in; |
826 | + |
827 | + g_signal_emit_by_name (self, "focus-event", focus_in); |
828 | + atk_focus_tracker_notify (ATK_OBJECT (self)); |
829 | } |
830 | - else |
831 | - return 0; |
832 | -} |
833 | - |
834 | -static void |
835 | -nux_view_accessible_remove_focus_handler (AtkComponent *component, |
836 | - guint handler_id) |
837 | -{ |
838 | - g_return_if_fail (NUX_IS_VIEW_ACCESSIBLE (component)); |
839 | - |
840 | - g_signal_handler_disconnect (component, handler_id); |
841 | -} |
842 | - |
843 | -static void |
844 | -nux_view_accessible_focus_handler (AtkObject *accessible, |
845 | - gboolean focus_in) |
846 | -{ |
847 | - g_return_if_fail (NUX_IS_VIEW_ACCESSIBLE (accessible)); |
848 | - |
849 | - g_debug ("[a11y] view_focus_handler (%p:%s:%i)", |
850 | - accessible, atk_object_get_name (accessible), focus_in); |
851 | - |
852 | - atk_object_notify_state_change (accessible, ATK_STATE_FOCUSED, focus_in); |
853 | +} |
854 | + |
855 | +static void |
856 | +on_start_focus_cb (AtkObject *accessible) |
857 | +{ |
858 | + g_debug ("[a11y][view] on_start_focus_cb: (%p:%s)", accessible, |
859 | + atk_object_get_name (accessible)); |
860 | + |
861 | + check_focus (NUX_VIEW_ACCESSIBLE (accessible), TRUE); |
862 | +} |
863 | + |
864 | +static void |
865 | +on_end_focus_cb (AtkObject *accessible) |
866 | +{ |
867 | + g_debug ("[a11y][view] on_end_focus_cb: (%p:%s)", |
868 | + accessible, atk_object_get_name (accessible)); |
869 | + |
870 | + check_focus (NUX_VIEW_ACCESSIBLE (accessible), FALSE); |
871 | } |
872 | |
873 | === modified file 'src/nux-view-accessible.h' |
874 | --- src/nux-view-accessible.h 2011-02-17 12:57:17 +0000 |
875 | +++ src/nux-view-accessible.h 2011-03-28 12:38:26 +0000 |
876 | @@ -37,10 +37,14 @@ |
877 | |
878 | typedef struct _NuxViewAccessible NuxViewAccessible; |
879 | typedef struct _NuxViewAccessibleClass NuxViewAccessibleClass; |
880 | +typedef struct _NuxViewAccessiblePrivate NuxViewAccessiblePrivate; |
881 | |
882 | struct _NuxViewAccessible |
883 | { |
884 | NuxAreaAccessible parent; |
885 | + |
886 | + /*< private >*/ |
887 | + NuxViewAccessiblePrivate *priv; |
888 | }; |
889 | |
890 | struct _NuxViewAccessibleClass |
891 | |
892 | === modified file 'src/unity-launcher-accessible.cpp' |
893 | --- src/unity-launcher-accessible.cpp 2011-03-14 11:45:11 +0000 |
894 | +++ src/unity-launcher-accessible.cpp 2011-03-28 12:38:26 +0000 |
895 | @@ -48,6 +48,7 @@ |
896 | static gint unity_launcher_accessible_get_n_children (AtkObject *obj); |
897 | static AtkObject *unity_launcher_accessible_ref_child (AtkObject *obj, |
898 | gint i); |
899 | +static AtkStateSet *unity_launcher_accessible_ref_state_set (AtkObject *obj); |
900 | |
901 | /* AtkSelection */ |
902 | static void atk_selection_interface_init (AtkSelectionIface *iface); |
903 | @@ -64,7 +65,6 @@ |
904 | static void on_order_change_cb (UnityLauncherAccessible *self); |
905 | static void update_children_index (UnityLauncherAccessible *self); |
906 | |
907 | - |
908 | G_DEFINE_TYPE_WITH_CODE (UnityLauncherAccessible, unity_launcher_accessible, NUX_TYPE_VIEW_ACCESSIBLE, |
909 | G_IMPLEMENT_INTERFACE (ATK_TYPE_SELECTION, atk_selection_interface_init)) |
910 | |
911 | @@ -78,6 +78,8 @@ |
912 | sigc::connection on_icon_added_connection; |
913 | sigc::connection on_icon_removed_connection; |
914 | sigc::connection on_order_changed_connection; |
915 | + |
916 | + gboolean focused; |
917 | }; |
918 | |
919 | |
920 | @@ -93,6 +95,7 @@ |
921 | atk_class->get_n_children = unity_launcher_accessible_get_n_children; |
922 | atk_class->ref_child = unity_launcher_accessible_ref_child; |
923 | atk_class->initialize = unity_launcher_accessible_initialize; |
924 | + atk_class->ref_state_set = unity_launcher_accessible_ref_state_set; |
925 | |
926 | g_type_class_add_private (gobject_class, sizeof (UnityLauncherAccessiblePrivate)); |
927 | } |
928 | @@ -215,7 +218,6 @@ |
929 | return 0; |
930 | |
931 | launcher = dynamic_cast<Launcher *>(nux_object); |
932 | - g_debug ("[Launcher] ref_child Launcher = %p", launcher); |
933 | |
934 | launcher_model = launcher->GetModel (); |
935 | |
936 | @@ -225,11 +227,42 @@ |
937 | child = dynamic_cast<nux::Object *>(*it); |
938 | child_accessible = unity_a11y_get_accessible (child); |
939 | |
940 | + g_debug ("[a11y][launcher] ref_child (%p:%s)", |
941 | + child_accessible, atk_object_get_name (child_accessible)); |
942 | + |
943 | g_object_ref (child_accessible); |
944 | |
945 | return child_accessible; |
946 | } |
947 | |
948 | +static AtkStateSet* |
949 | +unity_launcher_accessible_ref_state_set (AtkObject *obj) |
950 | +{ |
951 | + AtkStateSet *state_set = NULL; |
952 | + nux::Object *nux_object = NULL; |
953 | + UnityLauncherAccessible *self = NULL; |
954 | + |
955 | + g_return_val_if_fail (UNITY_IS_LAUNCHER_ACCESSIBLE (obj), NULL); |
956 | + |
957 | + state_set = |
958 | + ATK_OBJECT_CLASS (unity_launcher_accessible_parent_class)->ref_state_set (obj); |
959 | + |
960 | + nux_object = nux_object_accessible_get_object (NUX_OBJECT_ACCESSIBLE (obj)); |
961 | + |
962 | + if (nux_object == NULL) /* defunct */ |
963 | + return state_set; |
964 | + |
965 | + self = UNITY_LAUNCHER_ACCESSIBLE (obj); |
966 | + |
967 | + /* The Launcher is always focusable */ |
968 | + atk_state_set_add_state (state_set, ATK_STATE_FOCUSABLE); |
969 | + |
970 | + if (self->priv->focused) |
971 | + atk_state_set_add_state (state_set, ATK_STATE_FOCUSED); |
972 | + |
973 | + return state_set; |
974 | +} |
975 | + |
976 | /* AtkSelection */ |
977 | static void |
978 | atk_selection_interface_init (AtkSelectionIface *iface) |
979 | @@ -336,7 +369,7 @@ |
980 | /* private */ |
981 | static void on_selection_change_cb (UnityLauncherAccessible *launcher_accessible) |
982 | { |
983 | - g_debug ("[LAUNCHER]: selection changed"); |
984 | + g_debug ("[a11y][launcher] selection changed"); |
985 | |
986 | g_signal_emit_by_name (ATK_OBJECT (launcher_accessible), "selection-changed"); |
987 | } |
988 | @@ -362,7 +395,7 @@ |
989 | |
990 | index = atk_object_get_index_in_parent (icon_accessible); |
991 | |
992 | - g_debug ("[a11y] icon (%p, %s) added on container (%p,%s) at index %i", |
993 | + g_debug ("[a11y][launcher] icon (%p, %s) added on container (%p,%s) at index %i", |
994 | icon_accessible, atk_object_get_name (icon_accessible), |
995 | self, atk_object_get_name ( ATK_OBJECT (self)), |
996 | index); |
997 | @@ -389,7 +422,7 @@ |
998 | |
999 | index = atk_object_get_index_in_parent (icon_accessible); |
1000 | |
1001 | - g_debug ("[a11y] icon (%p, %s) removed on container (%p,%s) at index %i", |
1002 | + g_debug ("[a11y][launcher] icon (%p, %s) removed on container (%p,%s) at index %i", |
1003 | icon_accessible, atk_object_get_name (icon_accessible), |
1004 | self, atk_object_get_name (ATK_OBJECT (self)), |
1005 | index); |
1006 | |
1007 | === modified file 'src/unity-launcher-icon-accessible.cpp' |
1008 | --- src/unity-launcher-icon-accessible.cpp 2011-03-24 17:09:19 +0000 |
1009 | +++ src/unity-launcher-icon-accessible.cpp 2011-03-28 12:38:26 +0000 |
1010 | @@ -185,11 +185,6 @@ |
1011 | |
1012 | atk_component_add_focus_handler (ATK_COMPONENT (accessible), |
1013 | unity_launcher_icon_accessible_focus_handler); |
1014 | - |
1015 | - /* Check the cached selected state and notify the first selection. |
1016 | - * Ie: it is required to ensure a first notification |
1017 | - */ |
1018 | - check_selected (UNITY_LAUNCHER_ICON_ACCESSIBLE (accessible)); |
1019 | } |
1020 | |
1021 | |
1022 | @@ -231,7 +226,7 @@ |
1023 | |
1024 | nux_object = nux_object_accessible_get_object (NUX_OBJECT_ACCESSIBLE (obj)); |
1025 | |
1026 | - if (nux_object == NULL) /* actor is defunct */ |
1027 | + if (nux_object == NULL) /* defunct */ |
1028 | return state_set; |
1029 | |
1030 | /* by default */ |
1031 | @@ -271,7 +266,7 @@ |
1032 | |
1033 | nux_object = nux_object_accessible_get_object (NUX_OBJECT_ACCESSIBLE (obj)); |
1034 | |
1035 | - if (nux_object == NULL) /* actor is defunct */ |
1036 | + if (nux_object == NULL) /* defunct */ |
1037 | return NULL; |
1038 | |
1039 | icon = dynamic_cast<LauncherIcon *>(nux_object); |
1040 | @@ -305,7 +300,7 @@ |
1041 | icon = dynamic_cast<LauncherIcon *>(nux_object); |
1042 | launcher = icon->GetLauncher (); |
1043 | |
1044 | - if ((launcher == NULL) || (self->priv->parent_focused == FALSE)) |
1045 | + if (launcher == NULL) |
1046 | return; |
1047 | |
1048 | selected_icon = launcher->GetSelectedMenuIcon (); |
1049 | @@ -313,6 +308,9 @@ |
1050 | if (icon == selected_icon) |
1051 | found = TRUE; |
1052 | |
1053 | + if ((found) && (self->priv->parent_focused == FALSE)) |
1054 | + return; |
1055 | + |
1056 | if (found != self->priv->selected) |
1057 | { |
1058 | gboolean return_val = FALSE; |
1059 | @@ -325,11 +323,11 @@ |
1060 | ATK_STATE_ACTIVE, |
1061 | found); |
1062 | |
1063 | - g_signal_emit_by_name (self, "focus_event", found, &return_val); |
1064 | + g_signal_emit_by_name (self, "focus-event", self->priv->selected, &return_val); |
1065 | atk_focus_tracker_notify (ATK_OBJECT (self)); |
1066 | |
1067 | - g_debug ("[LAUNCHER-ICON]: selected state changed (%p:%i:%s)", |
1068 | - self, found, atk_object_get_name (ATK_OBJECT (self))); |
1069 | + g_debug ("[a11y][launcher-icon] selected state changed (%p:%i:%s)", |
1070 | + self, self->priv->selected, atk_object_get_name (ATK_OBJECT (self))); |
1071 | } |
1072 | } |
1073 | |
1074 | @@ -428,7 +426,7 @@ |
1075 | { |
1076 | g_return_if_fail (UNITY_IS_LAUNCHER_ICON_ACCESSIBLE (accessible)); |
1077 | |
1078 | - g_debug ("[a11y] launcher_icon_focus_handler (%p:%s:%i)", |
1079 | + g_debug ("[a11y][launcher-icon] focus_handler (%p:%s:%i)", |
1080 | accessible, atk_object_get_name (accessible), focus_in); |
1081 | |
1082 | atk_object_notify_state_change (accessible, ATK_STATE_FOCUSED, focus_in); |
1083 | |
1084 | === added file 'src/unity-places-view-accessible.cpp' |
1085 | --- src/unity-places-view-accessible.cpp 1970-01-01 00:00:00 +0000 |
1086 | +++ src/unity-places-view-accessible.cpp 2011-03-28 12:38:26 +0000 |
1087 | @@ -0,0 +1,112 @@ |
1088 | +/* |
1089 | + * Copyright (C) 2011 Canonical Ltd |
1090 | + * |
1091 | + * This program is free software: you can redistribute it and/or modify |
1092 | + * it under the terms of the GNU General Public License version 3 as |
1093 | + * published by the Free Software Foundation. |
1094 | + * |
1095 | + * This program is distributed in the hope that it will be useful, |
1096 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1097 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1098 | + * GNU General Public License for more details. |
1099 | + * |
1100 | + * You should have received a copy of the GNU General Public License |
1101 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1102 | + * |
1103 | + * Authored by: Alejandro Piñeiro Iglesias <apinheiro@igalia.com> |
1104 | + */ |
1105 | + |
1106 | +/** |
1107 | + * SECTION:unity-places_view-accessible |
1108 | + * @Title: UnityPlacesViewAccessible |
1109 | + * @short_description: Implementation of the ATK interfaces for #PlacesView |
1110 | + * @see_also: PlacesView |
1111 | + * |
1112 | + * #UnityPlacesViewAccessible implements the required ATK interfaces for |
1113 | + * #PlacesView, ie: exposing the different PlacesViewIcon on the model as |
1114 | + * #child of the object. |
1115 | + * |
1116 | + */ |
1117 | + |
1118 | +#include <glib/gi18n.h> |
1119 | + |
1120 | +#include "unity-places-view-accessible.h" |
1121 | + |
1122 | +#include "unitya11y.h" |
1123 | +#include "PlacesView.h" |
1124 | + |
1125 | +/* GObject */ |
1126 | +static void unity_places_view_accessible_class_init (UnityPlacesViewAccessibleClass *klass); |
1127 | +static void unity_places_view_accessible_init (UnityPlacesViewAccessible *self); |
1128 | +static void unity_places_view_accessible_finalize (GObject *object); |
1129 | + |
1130 | +/* AtkObject.h */ |
1131 | +static void unity_places_view_accessible_initialize (AtkObject *accessible, |
1132 | + gpointer data); |
1133 | + |
1134 | +G_DEFINE_TYPE (UnityPlacesViewAccessible, unity_places_view_accessible, NUX_TYPE_VIEW_ACCESSIBLE) |
1135 | + |
1136 | +#define UNITY_PLACES_VIEW_ACCESSIBLE_GET_PRIVATE(obj) \ |
1137 | + (G_TYPE_INSTANCE_GET_PRIVATE ((obj), UNITY_TYPE_PLACES_VIEW_ACCESSIBLE, \ |
1138 | + UnityPlacesViewAccessiblePrivate)) |
1139 | + |
1140 | +struct _UnityPlacesViewAccessiblePrivate |
1141 | +{ |
1142 | + |
1143 | +}; |
1144 | + |
1145 | + |
1146 | +static void |
1147 | +unity_places_view_accessible_class_init (UnityPlacesViewAccessibleClass *klass) |
1148 | +{ |
1149 | + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
1150 | + AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass); |
1151 | + |
1152 | + gobject_class->finalize = unity_places_view_accessible_finalize; |
1153 | + |
1154 | + /* AtkObject */ |
1155 | + atk_class->initialize = unity_places_view_accessible_initialize; |
1156 | + |
1157 | + g_type_class_add_private (gobject_class, sizeof (UnityPlacesViewAccessiblePrivate)); |
1158 | +} |
1159 | + |
1160 | +static void |
1161 | +unity_places_view_accessible_init (UnityPlacesViewAccessible *self) |
1162 | +{ |
1163 | + UnityPlacesViewAccessiblePrivate *priv = |
1164 | + UNITY_PLACES_VIEW_ACCESSIBLE_GET_PRIVATE (self); |
1165 | + |
1166 | + self->priv = priv; |
1167 | +} |
1168 | + |
1169 | +static void |
1170 | +unity_places_view_accessible_finalize (GObject *object) |
1171 | +{ |
1172 | + G_OBJECT_CLASS (unity_places_view_accessible_parent_class)->finalize (object); |
1173 | +} |
1174 | + |
1175 | +AtkObject* |
1176 | +unity_places_view_accessible_new (nux::Object *object) |
1177 | +{ |
1178 | + AtkObject *accessible = NULL; |
1179 | + |
1180 | + g_return_val_if_fail (dynamic_cast<PlacesView *>(object), NULL); |
1181 | + |
1182 | + accessible = ATK_OBJECT (g_object_new (UNITY_TYPE_PLACES_VIEW_ACCESSIBLE, NULL)); |
1183 | + |
1184 | + atk_object_initialize (accessible, object); |
1185 | + atk_object_set_name (accessible, _("Places")); |
1186 | + |
1187 | + return accessible; |
1188 | +} |
1189 | + |
1190 | +/* AtkObject.h */ |
1191 | +static void |
1192 | +unity_places_view_accessible_initialize (AtkObject *accessible, |
1193 | + gpointer data) |
1194 | +{ |
1195 | + ATK_OBJECT_CLASS (unity_places_view_accessible_parent_class)->initialize (accessible, data); |
1196 | + |
1197 | + accessible->role = ATK_ROLE_PANEL; |
1198 | +} |
1199 | + |
1200 | |
1201 | === added file 'src/unity-places-view-accessible.h' |
1202 | --- src/unity-places-view-accessible.h 1970-01-01 00:00:00 +0000 |
1203 | +++ src/unity-places-view-accessible.h 2011-03-28 12:38:26 +0000 |
1204 | @@ -0,0 +1,57 @@ |
1205 | +/* |
1206 | + * Copyright (C) 2011 Canonical Ltd |
1207 | + * |
1208 | + * This program is free software: you can redistribute it and/or modify |
1209 | + * it under the terms of the GNU General Public License version 3 as |
1210 | + * published by the Free Software Foundation. |
1211 | + * |
1212 | + * This program is distributed in the hope that it will be useful, |
1213 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1214 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1215 | + * GNU General Public License for more details. |
1216 | + * |
1217 | + * You should have received a copy of the GNU General Public License |
1218 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1219 | + * |
1220 | + * Authored by: Alejandro Piñeiro Iglesias <apinheiro@igalia.com> |
1221 | + */ |
1222 | + |
1223 | +#ifndef UNITY_PLACES_VIEW_ACCESSIBLE_H |
1224 | +#define UNITY_PLACES_VIEW_ACCESSIBLE_H |
1225 | + |
1226 | +#include <atk/atk.h> |
1227 | + |
1228 | +#include "nux-view-accessible.h" |
1229 | + |
1230 | +G_BEGIN_DECLS |
1231 | + |
1232 | +#define UNITY_TYPE_PLACES_VIEW_ACCESSIBLE (unity_places_view_accessible_get_type ()) |
1233 | +#define UNITY_PLACES_VIEW_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_TYPE_PLACES_VIEW_ACCESSIBLE, UnityPlacesViewAccessible)) |
1234 | +#define UNITY_PLACES_VIEW_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_TYPE_PLACES_VIEW_ACCESSIBLE, UnityPlacesViewAccessibleClass)) |
1235 | +#define UNITY_IS_PLACES_VIEW_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_TYPE_PLACES_VIEW_ACCESSIBLE)) |
1236 | +#define UNITY_IS_PLACES_VIEW_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_TYPE_PLACES_VIEW_ACCESSIBLE)) |
1237 | +#define UNITY_PLACES_VIEW_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_TYPE_PLACES_VIEW_ACCESSIBLE, UnityPlacesViewAccessibleClass)) |
1238 | + |
1239 | +typedef struct _UnityPlacesViewAccessible UnityPlacesViewAccessible; |
1240 | +typedef struct _UnityPlacesViewAccessibleClass UnityPlacesViewAccessibleClass; |
1241 | +typedef struct _UnityPlacesViewAccessiblePrivate UnityPlacesViewAccessiblePrivate; |
1242 | + |
1243 | +struct _UnityPlacesViewAccessible |
1244 | +{ |
1245 | + NuxViewAccessible parent; |
1246 | + |
1247 | + /*< private >*/ |
1248 | + UnityPlacesViewAccessiblePrivate *priv; |
1249 | +}; |
1250 | + |
1251 | +struct _UnityPlacesViewAccessibleClass |
1252 | +{ |
1253 | + NuxViewAccessibleClass parent_class; |
1254 | +}; |
1255 | + |
1256 | +GType unity_places_view_accessible_get_type (void); |
1257 | +AtkObject *unity_places_view_accessible_new (nux::Object *object); |
1258 | + |
1259 | +G_END_DECLS |
1260 | + |
1261 | +#endif /* __UNITY_PLACES_VIEW_ACCESSIBLE_H__ */ |
1262 | |
1263 | === modified file 'src/unity-root-accessible.cpp' |
1264 | --- src/unity-root-accessible.cpp 2011-03-21 20:06:16 +0000 |
1265 | +++ src/unity-root-accessible.cpp 2011-03-28 12:38:26 +0000 |
1266 | @@ -23,7 +23,6 @@ |
1267 | * #UnityRootAccessible is the root object of the accessibility |
1268 | * tree-like hierarchy, exposing the application level. |
1269 | * |
1270 | - * Implementation notes: FIXME, RIGHT NOW IS JUST A DUMMY IMPLEMENTATION |
1271 | */ |
1272 | |
1273 | #include "unity-root-accessible.h" |
1274 | @@ -172,14 +171,14 @@ |
1275 | * temporal. This method should be a internal root method, as part of |
1276 | * a basewindow::show callback, as in the case of gail |
1277 | */ |
1278 | -void |
1279 | +AtkObject * |
1280 | unity_root_accessible_add_window (UnityRootAccessible *self, |
1281 | nux::BaseWindow *window) |
1282 | { |
1283 | AtkObject *window_accessible = NULL; |
1284 | gint index = 0; |
1285 | |
1286 | - g_return_if_fail (UNITY_IS_ROOT_ACCESSIBLE (self)); |
1287 | + g_return_val_if_fail (UNITY_IS_ROOT_ACCESSIBLE (self), NULL); |
1288 | |
1289 | window_accessible = |
1290 | unity_a11y_get_accessible (window); |
1291 | @@ -193,6 +192,8 @@ |
1292 | |
1293 | g_signal_emit_by_name (self, "children-changed::add", |
1294 | index, window_accessible, NULL); |
1295 | + |
1296 | + return window_accessible; |
1297 | } |
1298 | |
1299 | /* private */ |
1300 | |
1301 | === modified file 'src/unity-root-accessible.h' |
1302 | --- src/unity-root-accessible.h 2011-01-13 01:59:18 +0000 |
1303 | +++ src/unity-root-accessible.h 2011-03-28 12:38:26 +0000 |
1304 | @@ -53,7 +53,8 @@ |
1305 | GType unity_root_accessible_get_type (void); |
1306 | AtkObject *unity_root_accessible_new (void); |
1307 | |
1308 | -void unity_root_accessible_add_window (UnityRootAccessible *self, nux::BaseWindow *window); |
1309 | +AtkObject *unity_root_accessible_add_window (UnityRootAccessible *self, |
1310 | + nux::BaseWindow *window); |
1311 | |
1312 | G_END_DECLS |
1313 | |
1314 | |
1315 | === added file 'src/unity-search-bar-accessible.cpp' |
1316 | --- src/unity-search-bar-accessible.cpp 1970-01-01 00:00:00 +0000 |
1317 | +++ src/unity-search-bar-accessible.cpp 2011-03-28 12:38:26 +0000 |
1318 | @@ -0,0 +1,132 @@ |
1319 | +/* |
1320 | + * Copyright (C) 2011 Canonical Ltd |
1321 | + * |
1322 | + * This program is free software: you can redistribute it and/or modify |
1323 | + * it under the terms of the GNU General Public License version 3 as |
1324 | + * published by the Free Software Foundation. |
1325 | + * |
1326 | + * This program is distributed in the hope that it will be useful, |
1327 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1328 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1329 | + * GNU General Public License for more details. |
1330 | + * |
1331 | + * You should have received a copy of the GNU General Public License |
1332 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1333 | + * |
1334 | + * Authored by: Alejandro Piñeiro Iglesias <apinheiro@igalia.com> |
1335 | + */ |
1336 | + |
1337 | +/** |
1338 | + * SECTION:unity-search_bar-accessible |
1339 | + * @Title: UnitySearchBarAccessible |
1340 | + * @short_description: Implementation of the ATK interfaces for #SearchBar |
1341 | + * @see_also: SearchBar |
1342 | + * |
1343 | + * #UnitySearchBarAccessible implements the required ATK interfaces for |
1344 | + * #SearchBar, ie: exposing the different SearchBarIcon on the model as |
1345 | + * #child of the object. |
1346 | + * |
1347 | + */ |
1348 | + |
1349 | +#include <glib/gi18n.h> |
1350 | + |
1351 | +#include "unity-search-bar-accessible.h" |
1352 | + |
1353 | +#include "unitya11y.h" |
1354 | +#include "PlacesSearchBar.h" |
1355 | + |
1356 | +/* GObject */ |
1357 | +static void unity_search_bar_accessible_class_init (UnitySearchBarAccessibleClass *klass); |
1358 | +static void unity_search_bar_accessible_init (UnitySearchBarAccessible *self); |
1359 | +static void unity_search_bar_accessible_finalize (GObject *object); |
1360 | + |
1361 | +/* AtkObject.h */ |
1362 | +static void unity_search_bar_accessible_initialize (AtkObject *accessible, |
1363 | + gpointer data); |
1364 | + |
1365 | +G_DEFINE_TYPE (UnitySearchBarAccessible, unity_search_bar_accessible, NUX_TYPE_VIEW_ACCESSIBLE) |
1366 | + |
1367 | +#define UNITY_SEARCH_BAR_ACCESSIBLE_GET_PRIVATE(obj) \ |
1368 | + (G_TYPE_INSTANCE_GET_PRIVATE ((obj), UNITY_TYPE_SEARCH_BAR_ACCESSIBLE, \ |
1369 | + UnitySearchBarAccessiblePrivate)) |
1370 | + |
1371 | +struct _UnitySearchBarAccessiblePrivate |
1372 | +{ |
1373 | + |
1374 | +}; |
1375 | + |
1376 | + |
1377 | +static void |
1378 | +unity_search_bar_accessible_class_init (UnitySearchBarAccessibleClass *klass) |
1379 | +{ |
1380 | + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
1381 | + AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass); |
1382 | + |
1383 | + gobject_class->finalize = unity_search_bar_accessible_finalize; |
1384 | + |
1385 | + /* AtkObject */ |
1386 | + atk_class->initialize = unity_search_bar_accessible_initialize; |
1387 | + |
1388 | + g_type_class_add_private (gobject_class, sizeof (UnitySearchBarAccessiblePrivate)); |
1389 | +} |
1390 | + |
1391 | +static void |
1392 | +unity_search_bar_accessible_init (UnitySearchBarAccessible *self) |
1393 | +{ |
1394 | + UnitySearchBarAccessiblePrivate *priv = |
1395 | + UNITY_SEARCH_BAR_ACCESSIBLE_GET_PRIVATE (self); |
1396 | + |
1397 | + self->priv = priv; |
1398 | +} |
1399 | + |
1400 | +static void |
1401 | +unity_search_bar_accessible_finalize (GObject *object) |
1402 | +{ |
1403 | + G_OBJECT_CLASS (unity_search_bar_accessible_parent_class)->finalize (object); |
1404 | +} |
1405 | + |
1406 | +AtkObject* |
1407 | +unity_search_bar_accessible_new (nux::Object *object) |
1408 | +{ |
1409 | + AtkObject *accessible = NULL; |
1410 | + |
1411 | + g_return_val_if_fail (dynamic_cast<PlacesSearchBar *>(object), NULL); |
1412 | + |
1413 | + accessible = ATK_OBJECT (g_object_new (UNITY_TYPE_SEARCH_BAR_ACCESSIBLE, NULL)); |
1414 | + |
1415 | + atk_object_initialize (accessible, object); |
1416 | + atk_object_set_name (accessible, _("Search Bar")); |
1417 | + |
1418 | + return accessible; |
1419 | +} |
1420 | + |
1421 | +/* AtkObject.h */ |
1422 | +static void |
1423 | +unity_search_bar_accessible_initialize (AtkObject *accessible, |
1424 | + gpointer data) |
1425 | +{ |
1426 | + nux::Object *nux_object = NULL; |
1427 | + PlacesSearchBar *search_bar = NULL; |
1428 | + nux::TextEntry *text_entry = NULL; |
1429 | + |
1430 | + ATK_OBJECT_CLASS (unity_search_bar_accessible_parent_class)->initialize (accessible, data); |
1431 | + |
1432 | + accessible->role = ATK_ROLE_PANEL; |
1433 | + |
1434 | + nux_object = nux_object_accessible_get_object (NUX_OBJECT_ACCESSIBLE (accessible)); |
1435 | + search_bar = dynamic_cast<PlacesSearchBar *>(nux_object); |
1436 | + |
1437 | + text_entry = search_bar->GetTextEntry (); |
1438 | + |
1439 | + if (text_entry != NULL) |
1440 | + { |
1441 | + AtkObject *atk_object = unity_a11y_get_accessible (text_entry); |
1442 | + |
1443 | + /* FIXME: this is the general search bar, but right now it is |
1444 | + only supported the Run Command dialog. When a full Places |
1445 | + support is finished, this would change */ |
1446 | + |
1447 | + atk_object_set_name (atk_object, _("Run Command Search Entry")); |
1448 | + } |
1449 | +} |
1450 | + |
1451 | |
1452 | === added file 'src/unity-search-bar-accessible.h' |
1453 | --- src/unity-search-bar-accessible.h 1970-01-01 00:00:00 +0000 |
1454 | +++ src/unity-search-bar-accessible.h 2011-03-28 12:38:26 +0000 |
1455 | @@ -0,0 +1,57 @@ |
1456 | +/* |
1457 | + * Copyright (C) 2011 Canonical Ltd |
1458 | + * |
1459 | + * This program is free software: you can redistribute it and/or modify |
1460 | + * it under the terms of the GNU General Public License version 3 as |
1461 | + * published by the Free Software Foundation. |
1462 | + * |
1463 | + * This program is distributed in the hope that it will be useful, |
1464 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1465 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1466 | + * GNU General Public License for more details. |
1467 | + * |
1468 | + * You should have received a copy of the GNU General Public License |
1469 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1470 | + * |
1471 | + * Authored by: Alejandro Piñeiro Iglesias <apinheiro@igalia.com> |
1472 | + */ |
1473 | + |
1474 | +#ifndef UNITY_SEARCH_BAR_ACCESSIBLE_H |
1475 | +#define UNITY_SEARCH_BAR_ACCESSIBLE_H |
1476 | + |
1477 | +#include <atk/atk.h> |
1478 | + |
1479 | +#include "nux-view-accessible.h" |
1480 | + |
1481 | +G_BEGIN_DECLS |
1482 | + |
1483 | +#define UNITY_TYPE_SEARCH_BAR_ACCESSIBLE (unity_search_bar_accessible_get_type ()) |
1484 | +#define UNITY_SEARCH_BAR_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_TYPE_SEARCH_BAR_ACCESSIBLE, UnitySearchBarAccessible)) |
1485 | +#define UNITY_SEARCH_BAR_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_TYPE_SEARCH_BAR_ACCESSIBLE, UnitySearchBarAccessibleClass)) |
1486 | +#define UNITY_IS_SEARCH_BAR_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_TYPE_SEARCH_BAR_ACCESSIBLE)) |
1487 | +#define UNITY_IS_SEARCH_BAR_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_TYPE_SEARCH_BAR_ACCESSIBLE)) |
1488 | +#define UNITY_SEARCH_BAR_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_TYPE_SEARCH_BAR_ACCESSIBLE, UnitySearchBarAccessibleClass)) |
1489 | + |
1490 | +typedef struct _UnitySearchBarAccessible UnitySearchBarAccessible; |
1491 | +typedef struct _UnitySearchBarAccessibleClass UnitySearchBarAccessibleClass; |
1492 | +typedef struct _UnitySearchBarAccessiblePrivate UnitySearchBarAccessiblePrivate; |
1493 | + |
1494 | +struct _UnitySearchBarAccessible |
1495 | +{ |
1496 | + NuxViewAccessible parent; |
1497 | + |
1498 | + /*< private >*/ |
1499 | + UnitySearchBarAccessiblePrivate *priv; |
1500 | +}; |
1501 | + |
1502 | +struct _UnitySearchBarAccessibleClass |
1503 | +{ |
1504 | + NuxViewAccessibleClass parent_class; |
1505 | +}; |
1506 | + |
1507 | +GType unity_search_bar_accessible_get_type (void); |
1508 | +AtkObject *unity_search_bar_accessible_new (nux::Object *object); |
1509 | + |
1510 | +G_END_DECLS |
1511 | + |
1512 | +#endif /* __UNITY_SEARCH_BAR_ACCESSIBLE_H__ */ |
1513 | |
1514 | === modified file 'src/unity-util-accessible.cpp' |
1515 | --- src/unity-util-accessible.cpp 2011-03-16 18:12:57 +0000 |
1516 | +++ src/unity-util-accessible.cpp 2011-03-28 12:38:26 +0000 |
1517 | @@ -24,6 +24,8 @@ |
1518 | #include "unity-util-accessible.h" |
1519 | #include "unity-root-accessible.h" |
1520 | |
1521 | +#include "nux-base-window-accessible.h" |
1522 | + |
1523 | static void unity_util_accessible_class_init (UnityUtilAccessibleClass *klass); |
1524 | static void unity_util_accessible_init (UnityUtilAccessible *unity_util_accessible); |
1525 | |
1526 | @@ -144,7 +146,11 @@ |
1527 | listener_idx++; |
1528 | } |
1529 | else |
1530 | - g_debug ("Signal type %s not supported\n", signal_name); |
1531 | + { |
1532 | + /* Mainly becase some "window::xxx" methods not implemented |
1533 | + on NuxBaseWindowAccessible */ |
1534 | + g_debug ("Signal type %s not supported\n", signal_name); |
1535 | + } |
1536 | } |
1537 | else |
1538 | g_warning ("Invalid object type %s\n", object_type); |
1539 | @@ -152,6 +158,15 @@ |
1540 | return rc; |
1541 | } |
1542 | |
1543 | +static void |
1544 | +do_window_event_initialization (void) |
1545 | +{ |
1546 | + /* |
1547 | + * Ensure that NuxBaseWindowClass exists |
1548 | + */ |
1549 | + g_type_class_unref (g_type_class_ref (NUX_TYPE_BASE_WINDOW_ACCESSIBLE)); |
1550 | +} |
1551 | + |
1552 | static guint |
1553 | unity_util_accessible_add_global_event_listener (GSignalEmissionHook listener, |
1554 | const gchar* event_type) |
1555 | @@ -164,8 +179,16 @@ |
1556 | { |
1557 | if (g_str_equal ("window", split_string[0])) |
1558 | { |
1559 | - /* FIXME: need to specifically process window: events (create, destroy, |
1560 | - minimize, maximize, restore, activate, deactivate) */ |
1561 | + /* Using NuxBaseWindow as the toplevelwindow */ |
1562 | + static gboolean initialized = FALSE; |
1563 | + |
1564 | + if (initialized == FALSE) |
1565 | + { |
1566 | + do_window_event_initialization (); |
1567 | + initialized = TRUE; |
1568 | + } |
1569 | + |
1570 | + rc = add_listener (listener, "NuxBaseWindowAccessible", split_string [1], event_type); |
1571 | } |
1572 | else |
1573 | { |
1574 | @@ -421,11 +444,15 @@ |
1575 | } |
1576 | |
1577 | /* Public */ |
1578 | -void |
1579 | +AtkObject * |
1580 | unity_util_accessible_add_window (nux::BaseWindow *window) |
1581 | { |
1582 | - unity_root_accessible_add_window |
1583 | + AtkObject *atk_obj = NULL; |
1584 | + |
1585 | + atk_obj = unity_root_accessible_add_window |
1586 | (UNITY_ROOT_ACCESSIBLE (unity_util_accessible_get_root ()), window); |
1587 | + |
1588 | + return atk_obj; |
1589 | } |
1590 | |
1591 | void |
1592 | |
1593 | === modified file 'src/unity-util-accessible.h' |
1594 | --- src/unity-util-accessible.h 2011-03-16 18:12:57 +0000 |
1595 | +++ src/unity-util-accessible.h 2011-03-28 12:38:26 +0000 |
1596 | @@ -52,8 +52,8 @@ |
1597 | |
1598 | GType unity_util_accessible_get_type (void); |
1599 | |
1600 | -void unity_util_accessible_add_window (nux::BaseWindow *window); |
1601 | -void unity_util_accessible_set_window_thread (nux::WindowThread *wt); |
1602 | +AtkObject* unity_util_accessible_add_window (nux::BaseWindow *window); |
1603 | +void unity_util_accessible_set_window_thread (nux::WindowThread *wt); |
1604 | |
1605 | G_END_DECLS |
1606 | |
1607 | |
1608 | === modified file 'src/unitya11y.cpp' |
1609 | --- src/unitya11y.cpp 2011-03-16 18:12:57 +0000 |
1610 | +++ src/unitya11y.cpp 2011-03-28 12:38:26 +0000 |
1611 | @@ -36,10 +36,13 @@ |
1612 | #include "LauncherIcon.h" |
1613 | #include "SimpleLauncherIcon.h" |
1614 | #include "PanelView.h" |
1615 | +#include "PlacesView.h" |
1616 | #include "unity-launcher-accessible.h" |
1617 | #include "unity-launcher-icon-accessible.h" |
1618 | #include "unity-panel-view-accessible.h" |
1619 | #include "unity-panel-home-button-accessible.h" |
1620 | +#include "unity-places-view-accessible.h" |
1621 | +#include "unity-search-bar-accessible.h" |
1622 | |
1623 | static GHashTable *accessible_table = NULL; |
1624 | /* FIXME: remove accessible objects when not required anymore */ |
1625 | @@ -264,6 +267,12 @@ |
1626 | if (object->Type().IsDerivedFromType (PanelHomeButton::StaticObjectType)) |
1627 | return unity_panel_home_button_accessible_new (object); |
1628 | |
1629 | + if (object->Type().IsDerivedFromType (PlacesView::StaticObjectType)) |
1630 | + return unity_places_view_accessible_new (object); |
1631 | + |
1632 | + if (object->Type().IsDerivedFromType (PlacesSearchBar::StaticObjectType)) |
1633 | + return unity_search_bar_accessible_new (object); |
1634 | + |
1635 | /* NUX classes */ |
1636 | if (object->Type().IsDerivedFromType (nux::BaseWindow::StaticObjectType)) |
1637 | return nux_base_window_accessible_new (object); |
1638 | |
1639 | === modified file 'src/unityshell.cpp' |
1640 | --- src/unityshell.cpp 2011-03-24 01:29:39 +0000 |
1641 | +++ src/unityshell.cpp 2011-03-28 12:38:26 +0000 |
1642 | @@ -898,7 +898,13 @@ |
1643 | /* FIXME: this should not be manual, should be managed with a |
1644 | show/hide callback like in GAIL*/ |
1645 | if (unity_a11y_initialized () == TRUE) |
1646 | - unity_util_accessible_add_window (self->placesController->GetWindow ()); |
1647 | + { |
1648 | + AtkObject *atk_obj = NULL; |
1649 | + |
1650 | + atk_obj = unity_util_accessible_add_window (self->placesController->GetWindow ()); |
1651 | + |
1652 | + atk_object_set_name (atk_obj, _("Places")); |
1653 | + } |
1654 | |
1655 | self->launcher->SetHideMode (Launcher::LAUNCHER_HIDE_DODGE_WINDOWS); |
1656 | self->launcher->SetLaunchAnimation (Launcher::LAUNCH_ANIMATION_PULSE); |
Run command dialog and places window seem to work ok with orca, but none of the buttons in the places window seem to be accessible at all (I guess that's intended though, as this branch doesn't seem to include stuff to do that). Also, the extents of both windows seem to be wrong when selecting them in accerciser.
I'll keep doing some more tests and doing the code review