7#include <QtGui/qwindow.h>
8#include <QtGui/qguiapplication.h>
13#include <QtCore/qloggingcategory.h>
14#include <QtCore/qtversion.h>
16#if QT_CONFIG(accessibility)
17#include "socket_interface.h"
19#include <QtCore/private/qstringiterator_p.h>
20#include <QtGui/private/qaccessiblebridgeutils_p.h>
34#if ATSPI_COORD_TYPE_COUNT < 3
35#define ATSPI_COORD_TYPE_PARENT 2
40#if !defined(ATSPI_MAJOR_VERSION) || !defined(ATSPI_MINOR_VERSION) || ATSPI_MAJOR_VERSION < 2 || ATSPI_MINOR_VERSION < 50
41#define ATSPI_LIVE_POLITE 1
42#define ATSPI_LIVE_ASSERTIVE 2
56 , sendObject_active_descendant_changed(0)
57 , sendObject_announcement(0)
58 , sendObject_attributes_changed(0)
59 , sendObject_bounds_changed(0)
60 , sendObject_children_changed(0)
63 , sendObject_column_deleted(0)
64 , sendObject_column_inserted(0)
65 , sendObject_column_reordered(0)
66 , sendObject_link_selected(0)
67 , sendObject_model_changed(0)
68 , sendObject_property_change(0)
69 , sendObject_property_change_accessible_description(0)
70 , sendObject_property_change_accessible_name(0)
71 , sendObject_property_change_accessible_parent(0)
72 , sendObject_property_change_accessible_role(0)
73 , sendObject_property_change_accessible_table_caption(0)
74 , sendObject_property_change_accessible_table_column_description(0)
75 , sendObject_property_change_accessible_table_column_header(0)
76 , sendObject_property_change_accessible_table_row_description(0)
77 , sendObject_property_change_accessible_table_row_header(0)
78 , sendObject_property_change_accessible_table_summary(0)
79 , sendObject_property_change_accessible_value(0)
80 , sendObject_row_deleted(0)
81 , sendObject_row_inserted(0)
82 , sendObject_row_reordered(0)
83 , sendObject_selection_changed(0)
84 , sendObject_state_changed(0)
85 , sendObject_text_attributes_changed(0)
86 , sendObject_text_bounds_changed(0)
87 , sendObject_text_caret_moved(0)
88 , sendObject_text_changed(0)
91 , sendObject_text_selection_changed(0)
92 , sendObject_value_changed(0)
93 , sendObject_visible_data_changed(0)
95 , sendWindow_activate(0)
97 , sendWindow_create(0)
98 , sendWindow_deactivate(0)
101 , sendWindow_lower(0)
102 , sendWindow_maximize(0)
103 , sendWindow_minimize(0)
105 , sendWindow_raise(0)
106 , sendWindow_reparent(0)
107 , sendWindow_resize(0)
108 , sendWindow_restore(0)
109 , sendWindow_restyle(0)
110 , sendWindow_shade(0)
111 , sendWindow_unshade(0)
116 updateEventListeners();
117 bool success = m_dbus->connection().connect(
"org.a11y.atspi.Registry"_L1,
"/org/a11y/atspi/registry"_L1,
118 "org.a11y.atspi.Registry"_L1,
"EventListenerRegistered"_L1,
this,
120 success = success && m_dbus->connection().connect(
"org.a11y.atspi.Registry"_L1,
"/org/a11y/atspi/registry"_L1,
121 "org.a11y.atspi.Registry"_L1,
"EventListenerDeregistered"_L1,
this,
135 " <interface name=\"org.a11y.atspi.Accessible\">\n"
136 " <property access=\"read\" type=\"s\" name=\"Name\"/>\n"
137 " <property access=\"read\" type=\"s\" name=\"Description\"/>\n"
138 " <property access=\"read\" type=\"(so)\" name=\"Parent\">\n"
139 " <annotation value=\"QSpiObjectReference\" name=\"org.qtproject.QtDBus.QtTypeName\"/>\n"
141 " <property access=\"read\" type=\"i\" name=\"ChildCount\"/>\n"
142 " <method name=\"GetChildAtIndex\">\n"
143 " <arg direction=\"in\" type=\"i\" name=\"index\"/>\n"
144 " <arg direction=\"out\" type=\"(so)\"/>\n"
145 " <annotation value=\"QSpiObjectReference\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
147 " <method name=\"GetChildren\">\n"
148 " <arg direction=\"out\" type=\"a(so)\"/>\n"
149 " <annotation value=\"QSpiObjectReferenceArray\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
151 " <method name=\"GetIndexInParent\">\n"
152 " <arg direction=\"out\" type=\"i\"/>\n"
154 " <method name=\"GetRelationSet\">\n"
155 " <arg direction=\"out\" type=\"a(ua(so))\"/>\n"
156 " <annotation value=\"QSpiRelationArray\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
158 " <method name=\"GetRole\">\n"
159 " <arg direction=\"out\" type=\"u\"/>\n"
161 " <method name=\"GetRoleName\">\n"
162 " <arg direction=\"out\" type=\"s\"/>\n"
164 " <method name=\"GetLocalizedRoleName\">\n"
165 " <arg direction=\"out\" type=\"s\"/>\n"
167 " <method name=\"GetState\">\n"
168 " <arg direction=\"out\" type=\"au\"/>\n"
169 " <annotation value=\"QSpiUIntList\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
171 " <method name=\"GetAttributes\">\n"
172 " <arg direction=\"out\" type=\"a{ss}\"/>\n"
173 " <annotation value=\"QSpiAttributeSet\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
175 " <method name=\"GetApplication\">\n"
176 " <arg direction=\"out\" type=\"(so)\"/>\n"
177 " <annotation value=\"QSpiObjectReference\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
179 " <method name=\"GetAccessibleId\">\n"
180 " <arg direction=\"out\" type=\"s\"/>\n"
186 " <interface name=\"org.a11y.atspi.Action\">\n"
187 " <property access=\"read\" type=\"i\" name=\"NActions\"/>\n"
188 " <method name=\"GetDescription\">\n"
189 " <arg direction=\"in\" type=\"i\" name=\"index\"/>\n"
190 " <arg direction=\"out\" type=\"s\"/>\n"
192 " <method name=\"GetName\">\n"
193 " <arg direction=\"in\" type=\"i\" name=\"index\"/>\n"
194 " <arg direction=\"out\" type=\"s\"/>\n"
196 " <method name=\"GetKeyBinding\">\n"
197 " <arg direction=\"in\" type=\"i\" name=\"index\"/>\n"
198 " <arg direction=\"out\" type=\"s\"/>\n"
200 " <method name=\"GetActions\">\n"
201 " <arg direction=\"out\" type=\"a(sss)\" name=\"index\"/>\n"
202 " <annotation value=\"QSpiActionArray\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
204 " <method name=\"DoAction\">\n"
205 " <arg direction=\"in\" type=\"i\" name=\"index\"/>\n"
206 " <arg direction=\"out\" type=\"b\"/>\n"
212 " <interface name=\"org.a11y.atspi.Application\">\n"
213 " <property access=\"read\" type=\"s\" name=\"ToolkitName\"/>\n"
214 " <property access=\"read\" type=\"s\" name=\"Version\"/>\n"
215 " <property access=\"readwrite\" type=\"i\" name=\"Id\"/>\n"
216 " <method name=\"GetLocale\">\n"
217 " <arg direction=\"in\" type=\"u\" name=\"lctype\"/>\n"
218 " <arg direction=\"out\" type=\"s\"/>\n"
220 " <method name=\"GetApplicationBusAddress\">\n"
221 " <arg direction=\"out\" type=\"s\" name=\"address\"/>\n"
227 " <interface name=\"org.a11y.atspi.Component\">\n"
228 " <method name=\"Contains\">\n"
229 " <arg direction=\"in\" type=\"i\" name=\"x\"/>\n"
230 " <arg direction=\"in\" type=\"i\" name=\"y\"/>\n"
231 " <arg direction=\"in\" type=\"u\" name=\"coord_type\"/>\n"
232 " <arg direction=\"out\" type=\"b\"/>\n"
234 " <method name=\"GetAccessibleAtPoint\">\n"
235 " <arg direction=\"in\" type=\"i\" name=\"x\"/>\n"
236 " <arg direction=\"in\" type=\"i\" name=\"y\"/>\n"
237 " <arg direction=\"in\" type=\"u\" name=\"coord_type\"/>\n"
238 " <arg direction=\"out\" type=\"(so)\"/>\n"
239 " <annotation value=\"QSpiObjectReference\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
241 " <method name=\"GetExtents\">\n"
242 " <arg direction=\"in\" type=\"u\" name=\"coord_type\"/>\n"
243 " <arg direction=\"out\" type=\"(iiii)\"/>\n"
244 " <annotation value=\"QSpiRect\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
246 " <method name=\"GetPosition\">\n"
247 " <arg direction=\"in\" type=\"u\" name=\"coord_type\"/>\n"
248 " <arg direction=\"out\" type=\"i\" name=\"x\"/>\n"
249 " <arg direction=\"out\" type=\"i\" name=\"y\"/>\n"
251 " <method name=\"GetSize\">\n"
252 " <arg direction=\"out\" type=\"i\" name=\"width\"/>\n"
253 " <arg direction=\"out\" type=\"i\" name=\"height\"/>\n"
255 " <method name=\"GetLayer\">\n"
256 " <arg direction=\"out\" type=\"u\"/>\n"
258 " <method name=\"GetMDIZOrder\">\n"
259 " <arg direction=\"out\" type=\"n\"/>\n"
261 " <method name=\"GrabFocus\">\n"
262 " <arg direction=\"out\" type=\"b\"/>\n"
264 " <method name=\"GetAlpha\">\n"
265 " <arg direction=\"out\" type=\"d\"/>\n"
267 " <method name=\"SetExtents\">\n"
268 " <arg direction=\"in\" type=\"i\" name=\"x\"/>\n"
269 " <arg direction=\"in\" type=\"i\" name=\"y\"/>\n"
270 " <arg direction=\"in\" type=\"i\" name=\"width\"/>\n"
271 " <arg direction=\"in\" type=\"i\" name=\"height\"/>\n"
272 " <arg direction=\"in\" type=\"u\" name=\"coord_type\"/>\n"
273 " <arg direction=\"out\" type=\"b\"/>\n"
275 " <method name=\"SetPosition\">\n"
276 " <arg direction=\"in\" type=\"i\" name=\"x\"/>\n"
277 " <arg direction=\"in\" type=\"i\" name=\"y\"/>\n"
278 " <arg direction=\"in\" type=\"u\" name=\"coord_type\"/>\n"
279 " <arg direction=\"out\" type=\"b\"/>\n"
281 " <method name=\"SetSize\">\n"
282 " <arg direction=\"in\" type=\"i\" name=\"width\"/>\n"
283 " <arg direction=\"in\" type=\"i\" name=\"height\"/>\n"
284 " <arg direction=\"out\" type=\"b\"/>\n"
290 " <interface name=\"org.a11y.atspi.EditableText\">\n"
291 " <method name=\"SetTextContents\">\n"
292 " <arg direction=\"in\" type=\"s\" name=\"newContents\"/>\n"
293 " <arg direction=\"out\" type=\"b\"/>\n"
295 " <method name=\"InsertText\">\n"
296 " <arg direction=\"in\" type=\"i\" name=\"position\"/>\n"
297 " <arg direction=\"in\" type=\"s\" name=\"text\"/>\n"
298 " <arg direction=\"in\" type=\"i\" name=\"length\"/>\n"
299 " <arg direction=\"out\" type=\"b\"/>\n"
301 " <method name=\"CopyText\">\n"
302 " <arg direction=\"in\" type=\"i\" name=\"startPos\"/>\n"
303 " <arg direction=\"in\" type=\"i\" name=\"endPos\"/>\n"
305 " <method name=\"CutText\">\n"
306 " <arg direction=\"in\" type=\"i\" name=\"startPos\"/>\n"
307 " <arg direction=\"in\" type=\"i\" name=\"endPos\"/>\n"
308 " <arg direction=\"out\" type=\"b\"/>\n"
310 " <method name=\"DeleteText\">\n"
311 " <arg direction=\"in\" type=\"i\" name=\"startPos\"/>\n"
312 " <arg direction=\"in\" type=\"i\" name=\"endPos\"/>\n"
313 " <arg direction=\"out\" type=\"b\"/>\n"
315 " <method name=\"PasteText\">\n"
316 " <arg direction=\"in\" type=\"i\" name=\"position\"/>\n"
317 " <arg direction=\"out\" type=\"b\"/>\n"
323 " <interface name=\"org.a11y.atspi.Selection\">\n"
324 " <property name=\"NSelectedChildren\" type=\"i\" access=\"read\"/>\n"
325 " <method name=\"GetSelectedChild\">\n"
326 " <arg direction=\"in\" name=\"selectedChildIndex\" type=\"i\"/>\n"
327 " <arg direction=\"out\" type=\"(so)\"/>\n"
328 " <annotation name=\"org.qtproject.QtDBus.QtTypeName.Out0\" value=\"QSpiObjectReference\"/>\n"
330 " <method name=\"SelectChild\">\n"
331 " <arg direction=\"in\" name=\"childIndex\" type=\"i\"/>\n"
332 " <arg direction=\"out\" type=\"b\"/>\n"
334 " <method name=\"DeselectSelectedChild\">\n"
335 " <arg direction=\"in\" name=\"selectedChildIndex\" type=\"i\"/>\n"
336 " <arg direction=\"out\" type=\"b\"/>\n"
338 " <method name=\"IsChildSelected\">\n"
339 " <arg direction=\"in\" name=\"childIndex\" type=\"i\"/>\n"
340 " <arg direction=\"out\" type=\"b\"/>\n"
342 " <method name=\"SelectAll\">\n"
343 " <arg direction=\"out\" type=\"b\"/>\n"
345 " <method name=\"ClearSelection\">\n"
346 " <arg direction=\"out\" type=\"b\"/>\n"
348 " <method name=\"DeselectChild\">\n"
349 " <arg direction=\"in\" name=\"childIndex\" type=\"i\"/>\n"
350 " <arg direction=\"out\" type=\"b\"/>\n"
356 " <interface name=\"org.a11y.atspi.Table\">\n"
357 " <property access=\"read\" type=\"i\" name=\"NRows\"/>\n"
358 " <property access=\"read\" type=\"i\" name=\"NColumns\"/>\n"
359 " <property access=\"read\" type=\"(so)\" name=\"Caption\">\n"
360 " <annotation value=\"QSpiObjectReference\" name=\"org.qtproject.QtDBus.QtTypeName\"/>\n"
362 " <property access=\"read\" type=\"(so)\" name=\"Summary\">\n"
363 " <annotation value=\"QSpiObjectReference\" name=\"org.qtproject.QtDBus.QtTypeName\"/>\n"
365 " <property access=\"read\" type=\"i\" name=\"NSelectedRows\"/>\n"
366 " <property access=\"read\" type=\"i\" name=\"NSelectedColumns\"/>\n"
367 " <method name=\"GetAccessibleAt\">\n"
368 " <arg direction=\"in\" type=\"i\" name=\"row\"/>\n"
369 " <arg direction=\"in\" type=\"i\" name=\"column\"/>\n"
370 " <arg direction=\"out\" type=\"(so)\"/>\n"
371 " <annotation value=\"QSpiObjectReference\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
373 " <method name=\"GetIndexAt\">\n"
374 " <arg direction=\"in\" type=\"i\" name=\"row\"/>\n"
375 " <arg direction=\"in\" type=\"i\" name=\"column\"/>\n"
376 " <arg direction=\"out\" type=\"i\"/>\n"
378 " <method name=\"GetRowAtIndex\">\n"
379 " <arg direction=\"in\" type=\"i\" name=\"index\"/>\n"
380 " <arg direction=\"out\" type=\"i\"/>\n"
382 " <method name=\"GetColumnAtIndex\">\n"
383 " <arg direction=\"in\" type=\"i\" name=\"index\"/>\n"
384 " <arg direction=\"out\" type=\"i\"/>\n"
386 " <method name=\"GetRowDescription\">\n"
387 " <arg direction=\"in\" type=\"i\" name=\"row\"/>\n"
388 " <arg direction=\"out\" type=\"s\"/>\n"
390 " <method name=\"GetColumnDescription\">\n"
391 " <arg direction=\"in\" type=\"i\" name=\"column\"/>\n"
392 " <arg direction=\"out\" type=\"s\"/>\n"
394 " <method name=\"GetRowExtentAt\">\n"
395 " <arg direction=\"in\" type=\"i\" name=\"row\"/>\n"
396 " <arg direction=\"in\" type=\"i\" name=\"column\"/>\n"
397 " <arg direction=\"out\" type=\"i\"/>\n"
399 " <method name=\"GetColumnExtentAt\">\n"
400 " <arg direction=\"in\" type=\"i\" name=\"row\"/>\n"
401 " <arg direction=\"in\" type=\"i\" name=\"column\"/>\n"
402 " <arg direction=\"out\" type=\"i\"/>\n"
404 " <method name=\"GetRowHeader\">\n"
405 " <arg direction=\"in\" type=\"i\" name=\"row\"/>\n"
406 " <arg direction=\"out\" type=\"(so)\"/>\n"
407 " <annotation value=\"QSpiObjectReference\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
409 " <method name=\"GetColumnHeader\">\n"
410 " <arg direction=\"in\" type=\"i\" name=\"column\"/>\n"
411 " <arg direction=\"out\" type=\"(so)\"/>\n"
412 " <annotation value=\"QSpiObjectReference\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
414 " <method name=\"GetSelectedRows\">\n"
415 " <arg direction=\"out\" type=\"ai\"/>\n"
416 " <annotation value=\"QSpiIntList\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
418 " <method name=\"GetSelectedColumns\">\n"
419 " <arg direction=\"out\" type=\"ai\"/>\n"
420 " <annotation value=\"QSpiIntList\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
422 " <method name=\"IsRowSelected\">\n"
423 " <arg direction=\"in\" type=\"i\" name=\"row\"/>\n"
424 " <arg direction=\"out\" type=\"b\"/>\n"
426 " <method name=\"IsColumnSelected\">\n"
427 " <arg direction=\"in\" type=\"i\" name=\"column\"/>\n"
428 " <arg direction=\"out\" type=\"b\"/>\n"
430 " <method name=\"IsSelected\">\n"
431 " <arg direction=\"in\" type=\"i\" name=\"row\"/>\n"
432 " <arg direction=\"in\" type=\"i\" name=\"column\"/>\n"
433 " <arg direction=\"out\" type=\"b\"/>\n"
435 " <method name=\"AddRowSelection\">\n"
436 " <arg direction=\"in\" type=\"i\" name=\"row\"/>\n"
437 " <arg direction=\"out\" type=\"b\"/>\n"
439 " <method name=\"AddColumnSelection\">\n"
440 " <arg direction=\"in\" type=\"i\" name=\"column\"/>\n"
441 " <arg direction=\"out\" type=\"b\"/>\n"
443 " <method name=\"RemoveRowSelection\">\n"
444 " <arg direction=\"in\" type=\"i\" name=\"row\"/>\n"
445 " <arg direction=\"out\" type=\"b\"/>\n"
447 " <method name=\"RemoveColumnSelection\">\n"
448 " <arg direction=\"in\" type=\"i\" name=\"column\"/>\n"
449 " <arg direction=\"out\" type=\"b\"/>\n"
451 " <method name=\"GetRowColumnExtentsAtIndex\">\n"
452 " <arg direction=\"in\" type=\"i\" name=\"index\"/>\n"
453 " <arg direction=\"out\" type=\"b\"/>\n"
454 " <arg direction=\"out\" type=\"i\" name=\"row\"/>\n"
455 " <arg direction=\"out\" type=\"i\" name=\"col\"/>\n"
456 " <arg direction=\"out\" type=\"i\" name=\"row_extents\"/>\n"
457 " <arg direction=\"out\" type=\"i\" name=\"col_extents\"/>\n"
458 " <arg direction=\"out\" type=\"b\" name=\"is_selected\"/>\n"
464 " <interface name=\"org.a11y.atspi.TableCell\">\n"
465 " <property access=\"read\" name=\"ColumnSpan\" type=\"i\" />\n"
466 " <property access=\"read\" name=\"Position\" type=\"(ii)\">\n"
467 " <annotation name=\"org.qtproject.QtDBus.QtTypeName\" value=\"QPoint\"/>\n"
469 " <property access=\"read\" name=\"RowSpan\" type=\"i\" />\n"
470 " <property access=\"read\" name=\"Table\" type=\"(so)\" >\n"
471 " <annotation name=\"org.qtproject.QtDBus.QtTypeName\" value=\"QSpiObjectReference\"/>\n"
473 " <method name=\"GetRowColumnSpan\">\n"
474 " <arg direction=\"out\" type=\"b\" />\n"
475 " <arg direction=\"out\" name=\"row\" type=\"i\" />\n"
476 " <arg direction=\"out\" name=\"col\" type=\"i\" />\n"
477 " <arg direction=\"out\" name=\"row_extents\" type=\"i\" />\n"
478 " <arg direction=\"out\" name=\"col_extents\" type=\"i\" />\n"
480 " <method name=\"GetColumnHeaderCells\">\n"
481 " <arg direction=\"out\" type=\"a(so)\"/>\n"
482 " <annotation value=\"QSpiObjectReferenceArray\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
484 " <method name=\"GetRowHeaderCells\">\n"
485 " <arg direction=\"out\" type=\"a(so)\"/>\n"
486 " <annotation value=\"QSpiObjectReferenceArray\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
492 " <interface name=\"org.a11y.atspi.Text\">\n"
493 " <property access=\"read\" type=\"i\" name=\"CharacterCount\"/>\n"
494 " <property access=\"read\" type=\"i\" name=\"CaretOffset\"/>\n"
495 " <method name=\"GetStringAtOffset\">\n"
496 " <arg direction=\"in\" name=\"offset\" type=\"i\"/>\n"
497 " <arg direction=\"in\" name=\"granularity\" type=\"u\"/>\n"
498 " <arg direction=\"out\" type=\"s\"/>\n"
499 " <arg direction=\"out\" name=\"startOffset\" type=\"i\"/>\n"
500 " <arg direction=\"out\" name=\"endOffset\" type=\"i\"/>\n"
502 " <method name=\"GetText\">\n"
503 " <arg direction=\"in\" type=\"i\" name=\"startOffset\"/>\n"
504 " <arg direction=\"in\" type=\"i\" name=\"endOffset\"/>\n"
505 " <arg direction=\"out\" type=\"s\"/>\n"
507 " <method name=\"SetCaretOffset\">\n"
508 " <arg direction=\"in\" type=\"i\" name=\"offset\"/>\n"
509 " <arg direction=\"out\" type=\"b\"/>\n"
511 " <method name=\"GetTextBeforeOffset\">\n"
512 " <arg direction=\"in\" type=\"i\" name=\"offset\"/>\n"
513 " <arg direction=\"in\" type=\"u\" name=\"type\"/>\n"
514 " <arg direction=\"out\" type=\"s\"/>\n"
515 " <arg direction=\"out\" type=\"i\" name=\"startOffset\"/>\n"
516 " <arg direction=\"out\" type=\"i\" name=\"endOffset\"/>\n"
518 " <method name=\"GetTextAtOffset\">\n"
519 " <arg direction=\"in\" type=\"i\" name=\"offset\"/>\n"
520 " <arg direction=\"in\" type=\"u\" name=\"type\"/>\n"
521 " <arg direction=\"out\" type=\"s\"/>\n"
522 " <arg direction=\"out\" type=\"i\" name=\"startOffset\"/>\n"
523 " <arg direction=\"out\" type=\"i\" name=\"endOffset\"/>\n"
525 " <method name=\"GetTextAfterOffset\">\n"
526 " <arg direction=\"in\" type=\"i\" name=\"offset\"/>\n"
527 " <arg direction=\"in\" type=\"u\" name=\"type\"/>\n"
528 " <arg direction=\"out\" type=\"s\"/>\n"
529 " <arg direction=\"out\" type=\"i\" name=\"startOffset\"/>\n"
530 " <arg direction=\"out\" type=\"i\" name=\"endOffset\"/>\n"
532 " <method name=\"GetCharacterAtOffset\">\n"
533 " <arg direction=\"in\" type=\"i\" name=\"offset\"/>\n"
534 " <arg direction=\"out\" type=\"i\"/>\n"
536 " <method name=\"GetAttributeValue\">\n"
537 " <arg direction=\"in\" type=\"i\" name=\"offset\"/>\n"
538 " <arg direction=\"in\" type=\"s\" name=\"attributeName\"/>\n"
539 " <arg direction=\"out\" type=\"s\"/>\n"
541 " <method name=\"GetAttributes\">\n"
542 " <arg direction=\"in\" type=\"i\" name=\"offset\"/>\n"
543 " <arg direction=\"out\" type=\"a{ss}\"/>\n"
544 " <arg direction=\"out\" type=\"i\" name=\"startOffset\"/>\n"
545 " <arg direction=\"out\" type=\"i\" name=\"endOffset\"/>\n"
546 " <annotation value=\"QSpiAttributeSet\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
548 " <method name=\"GetDefaultAttributes\">\n"
549 " <arg direction=\"out\" type=\"a{ss}\"/>\n"
550 " <annotation value=\"QSpiAttributeSet\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
552 " <method name=\"GetCharacterExtents\">\n"
553 " <arg direction=\"in\" type=\"i\" name=\"offset\"/>\n"
554 " <arg direction=\"out\" type=\"i\" name=\"x\"/>\n"
555 " <arg direction=\"out\" type=\"i\" name=\"y\"/>\n"
556 " <arg direction=\"out\" type=\"i\" name=\"width\"/>\n"
557 " <arg direction=\"out\" type=\"i\" name=\"height\"/>\n"
558 " <arg direction=\"in\" type=\"u\" name=\"coordType\"/>\n"
560 " <method name=\"GetOffsetAtPoint\">\n"
561 " <arg direction=\"in\" type=\"i\" name=\"x\"/>\n"
562 " <arg direction=\"in\" type=\"i\" name=\"y\"/>\n"
563 " <arg direction=\"in\" type=\"u\" name=\"coordType\"/>\n"
564 " <arg direction=\"out\" type=\"i\"/>\n"
566 " <method name=\"GetNSelections\">\n"
567 " <arg direction=\"out\" type=\"i\"/>\n"
569 " <method name=\"GetSelection\">\n"
570 " <arg direction=\"in\" type=\"i\" name=\"selectionNum\"/>\n"
571 " <arg direction=\"out\" type=\"i\" name=\"startOffset\"/>\n"
572 " <arg direction=\"out\" type=\"i\" name=\"endOffset\"/>\n"
574 " <method name=\"AddSelection\">\n"
575 " <arg direction=\"in\" type=\"i\" name=\"startOffset\"/>\n"
576 " <arg direction=\"in\" type=\"i\" name=\"endOffset\"/>\n"
577 " <arg direction=\"out\" type=\"b\"/>\n"
579 " <method name=\"RemoveSelection\">\n"
580 " <arg direction=\"in\" type=\"i\" name=\"selectionNum\"/>\n"
581 " <arg direction=\"out\" type=\"b\"/>\n"
583 " <method name=\"SetSelection\">\n"
584 " <arg direction=\"in\" type=\"i\" name=\"selectionNum\"/>\n"
585 " <arg direction=\"in\" type=\"i\" name=\"startOffset\"/>\n"
586 " <arg direction=\"in\" type=\"i\" name=\"endOffset\"/>\n"
587 " <arg direction=\"out\" type=\"b\"/>\n"
589 " <method name=\"GetRangeExtents\">\n"
590 " <arg direction=\"in\" type=\"i\" name=\"startOffset\"/>\n"
591 " <arg direction=\"in\" type=\"i\" name=\"endOffset\"/>\n"
592 " <arg direction=\"out\" type=\"i\" name=\"x\"/>\n"
593 " <arg direction=\"out\" type=\"i\" name=\"y\"/>\n"
594 " <arg direction=\"out\" type=\"i\" name=\"width\"/>\n"
595 " <arg direction=\"out\" type=\"i\" name=\"height\"/>\n"
596 " <arg direction=\"in\" type=\"u\" name=\"coordType\"/>\n"
598 " <method name=\"GetBoundedRanges\">\n"
599 " <arg direction=\"in\" type=\"i\" name=\"x\"/>\n"
600 " <arg direction=\"in\" type=\"i\" name=\"y\"/>\n"
601 " <arg direction=\"in\" type=\"i\" name=\"width\"/>\n"
602 " <arg direction=\"in\" type=\"i\" name=\"height\"/>\n"
603 " <arg direction=\"in\" type=\"u\" name=\"coordType\"/>\n"
604 " <arg direction=\"in\" type=\"u\" name=\"xClipType\"/>\n"
605 " <arg direction=\"in\" type=\"u\" name=\"yClipType\"/>\n"
606 " <arg direction=\"out\" type=\"a(iisv)\"/>\n"
607 " <annotation value=\"QSpiRangeList\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
609 " <method name=\"GetAttributeRun\">\n"
610 " <arg direction=\"in\" type=\"i\" name=\"offset\"/>\n"
611 " <arg direction=\"in\" type=\"b\" name=\"includeDefaults\"/>\n"
612 " <arg direction=\"out\" type=\"a{ss}\"/>\n"
613 " <arg direction=\"out\" type=\"i\" name=\"startOffset\"/>\n"
614 " <arg direction=\"out\" type=\"i\" name=\"endOffset\"/>\n"
615 " <annotation value=\"QSpiAttributeSet\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
617 " <method name=\"GetDefaultAttributeSet\">\n"
618 " <arg direction=\"out\" type=\"a{ss}\"/>\n"
619 " <annotation value=\"QSpiAttributeSet\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
621 " <method name=\"ScrollSubstringTo\">\n"
622 " <arg direction=\"in\" name=\"startOffset\" type=\"i\"/>\n"
623 " <arg direction=\"in\" name=\"endOffset\" type=\"i\"/>\n"
624 " <arg direction=\"in\" name=\"type\" type=\"u\"/>\n"
625 " <arg direction=\"out\" type=\"b\"/>\n"
631 " <interface name=\"org.a11y.atspi.Value\">\n"
632 " <property access=\"read\" type=\"d\" name=\"MinimumValue\"/>\n"
633 " <property access=\"read\" type=\"d\" name=\"MaximumValue\"/>\n"
634 " <property access=\"read\" type=\"d\" name=\"MinimumIncrement\"/>\n"
635 " <property access=\"readwrite\" type=\"d\" name=\"CurrentValue\"/>\n"
636 " <method name=\"SetCurrentValue\">\n"
637 " <arg direction=\"in\" type=\"d\" name=\"value\"/>\n"
642 QAccessibleInterface *
interface = interfaceFromPath(path);
644 qCWarning(lcAccessibilityAtspi) <<
"Could not find accessible on path:" <<
path;
651 xml.append(accessibleIntrospection);
654 xml.append(componentIntrospection);
656 xml.append(textIntrospection);
658 xml.append(editableTextIntrospection);
660 xml.append(actionIntrospection);
662 xml.append(selectionIntrospection);
664 xml.append(tableIntrospection);
665 if (interfaces.contains(ATSPI_DBUS_INTERFACE_TABLE_CELL
""_L1))
666 xml.append(tableCellIntrospection);
668 xml.append(valueIntrospection);
670 xml.append(applicationIntrospection);
675void AtSpiAdaptor::setBitFlag(
const QString &flag)
680 switch (flag.
at(0).toLower().toLatin1()) {
682 if (flag.
size() <= 8) {
687 }
else if (
right.startsWith(
"ActiveDescendantChanged"_L1)) {
688 sendObject_active_descendant_changed = 1;
689 }
else if (
right.startsWith(
"Announcement"_L1)) {
690 sendObject_announcement = 1;
691 }
else if (
right.startsWith(
"AttributesChanged"_L1)) {
692 sendObject_attributes_changed = 1;
693 }
else if (
right.startsWith(
"BoundsChanged"_L1)) {
694 sendObject_bounds_changed = 1;
695 }
else if (
right.startsWith(
"ChildrenChanged"_L1)) {
696 sendObject_children_changed = 1;
697 }
else if (
right.startsWith(
"ColumnDeleted"_L1)) {
698 sendObject_column_deleted = 1;
699 }
else if (
right.startsWith(
"ColumnInserted"_L1)) {
700 sendObject_column_inserted = 1;
701 }
else if (
right.startsWith(
"ColumnReordered"_L1)) {
702 sendObject_column_reordered = 1;
703 }
else if (
right.startsWith(
"LinkSelected"_L1)) {
704 sendObject_link_selected = 1;
705 }
else if (
right.startsWith(
"ModelChanged"_L1)) {
706 sendObject_model_changed = 1;
707 }
else if (
right.startsWith(
"PropertyChange"_L1)) {
708 if (
right ==
"PropertyChange:AccessibleDescription"_L1) {
709 sendObject_property_change_accessible_description = 1;
710 }
else if (
right ==
"PropertyChange:AccessibleName"_L1) {
711 sendObject_property_change_accessible_name = 1;
712 }
else if (
right ==
"PropertyChange:AccessibleParent"_L1) {
713 sendObject_property_change_accessible_parent = 1;
714 }
else if (
right ==
"PropertyChange:AccessibleRole"_L1) {
715 sendObject_property_change_accessible_role = 1;
716 }
else if (
right ==
"PropertyChange:TableCaption"_L1) {
717 sendObject_property_change_accessible_table_caption = 1;
718 }
else if (
right ==
"PropertyChange:TableColumnDescription"_L1) {
719 sendObject_property_change_accessible_table_column_description = 1;
720 }
else if (
right ==
"PropertyChange:TableColumnHeader"_L1) {
721 sendObject_property_change_accessible_table_column_header = 1;
722 }
else if (
right ==
"PropertyChange:TableRowDescription"_L1) {
723 sendObject_property_change_accessible_table_row_description = 1;
724 }
else if (
right ==
"PropertyChange:TableRowHeader"_L1) {
725 sendObject_property_change_accessible_table_row_header = 1;
726 }
else if (
right ==
"PropertyChange:TableSummary"_L1) {
727 sendObject_property_change_accessible_table_summary = 1;
728 }
else if (
right ==
"PropertyChange:AccessibleValue"_L1) {
729 sendObject_property_change_accessible_value = 1;
731 sendObject_property_change = 1;
733 }
else if (
right.startsWith(
"RowDeleted"_L1)) {
734 sendObject_row_deleted = 1;
735 }
else if (
right.startsWith(
"RowInserted"_L1)) {
736 sendObject_row_inserted = 1;
737 }
else if (
right.startsWith(
"RowReordered"_L1)) {
738 sendObject_row_reordered = 1;
739 }
else if (
right.startsWith(
"SelectionChanged"_L1)) {
740 sendObject_selection_changed = 1;
741 }
else if (
right.startsWith(
"StateChanged"_L1)) {
742 sendObject_state_changed = 1;
743 }
else if (
right.startsWith(
"TextAttributesChanged"_L1)) {
744 sendObject_text_attributes_changed = 1;
745 }
else if (
right.startsWith(
"TextBoundsChanged"_L1)) {
746 sendObject_text_bounds_changed = 1;
747 }
else if (
right.startsWith(
"TextCaretMoved"_L1)) {
748 sendObject_text_caret_moved = 1;
749 }
else if (
right.startsWith(
"TextChanged"_L1)) {
750 sendObject_text_changed = 1;
751 }
else if (
right.startsWith(
"TextSelectionChanged"_L1)) {
752 sendObject_text_selection_changed = 1;
753 }
else if (
right.startsWith(
"ValueChanged"_L1)) {
754 sendObject_value_changed = 1;
755 }
else if (
right.startsWith(
"VisibleDataChanged"_L1)
756 ||
right.startsWith(
"VisibledataChanged"_L1)) {
757 sendObject_visible_data_changed = 1;
759 qCWarning(lcAccessibilityAtspi) <<
"Subscription string not handled:" << flag;
765 if (flag.
size() <= 8) {
770 }
else if (
right.startsWith(
"Activate"_L1)) {
771 sendWindow_activate = 1;
772 }
else if (
right.startsWith(
"Close"_L1)) {
774 }
else if (
right.startsWith(
"Create"_L1)) {
775 sendWindow_create = 1;
776 }
else if (
right.startsWith(
"Deactivate"_L1)) {
777 sendWindow_deactivate = 1;
778 }
else if (
right.startsWith(
"Lower"_L1)) {
779 sendWindow_lower = 1;
780 }
else if (
right.startsWith(
"Maximize"_L1)) {
781 sendWindow_maximize = 1;
782 }
else if (
right.startsWith(
"Minimize"_L1)) {
783 sendWindow_minimize = 1;
784 }
else if (
right.startsWith(
"Move"_L1)) {
786 }
else if (
right.startsWith(
"Raise"_L1)) {
787 sendWindow_raise = 1;
788 }
else if (
right.startsWith(
"Reparent"_L1)) {
789 sendWindow_reparent = 1;
790 }
else if (
right.startsWith(
"Resize"_L1)) {
791 sendWindow_resize = 1;
792 }
else if (
right.startsWith(
"Restore"_L1)) {
793 sendWindow_restore = 1;
794 }
else if (
right.startsWith(
"Restyle"_L1)) {
795 sendWindow_restyle = 1;
796 }
else if (
right.startsWith(
"Shade"_L1)) {
797 sendWindow_shade = 1;
798 }
else if (
right.startsWith(
"Unshade"_L1)) {
799 sendWindow_unshade = 1;
800 }
else if (
right.startsWith(
"DesktopCreate"_L1)) {
802 }
else if (
right.startsWith(
"DesktopDestroy"_L1)) {
805 qCWarning(lcAccessibilityAtspi) <<
"Subscription string not handled:" << flag;
824 qCWarning(lcAccessibilityAtspi) <<
"Subscription string not handled:" << flag;
831void AtSpiAdaptor::updateEventListeners()
834 "/org/a11y/atspi/registry"_L1,
835 "org.a11y.atspi.Registry"_L1,
"GetRegisteredEvents"_L1);
836 QDBusReply<QSpiEventListenerArray> listenersReply = m_dbus->
connection().
call(
m);
837 if (listenersReply.isValid()) {
840 setBitFlag(ev.eventName);
841 m_applicationAdaptor->
sendEvents(!evList.isEmpty());
843 qCDebug(lcAccessibilityAtspi) <<
"Could not query active accessibility event listeners.";
850 updateEventListeners();
856 updateEventListeners();
865 if (!(sendWindow || sendWindow_activate))
868 QAccessibleInterface *
iface = QAccessible::queryAccessibleInterface(
window);
870 if (iface ==
nullptr)
876 if (
iface->isValid())
884 QString status = active ?
"Activate"_L1 :
"Deactivate"_L1;
888 QVariantList stateArgs = packDBusSignalArguments(
"active"_L1, active ? 1 : 0, 0, variantForPath(
path));
914QAccessibleInterface *AtSpiAdaptor::interfaceFromPath(
const QString& dbusPath)
const
917 return QAccessible::queryAccessibleInterface(
qApp);
920 if (parts.size() != 6) {
925 QString objectString = parts.at(5);
926 QAccessible::Id
id = objectString.toUInt();
930 qCWarning(lcAccessibilityAtspi) <<
"No accessible object found for id: " <<
id;
932 return QAccessible::accessibleInterface(
id);
942void AtSpiAdaptor::sendAnnouncement(QAccessibleAnnouncementEvent *
event)
944 QAccessibleInterface *
iface =
event->accessibleInterface();
946 qCWarning(lcAccessibilityAtspi,
"Announcement event has no accessible set.");
949 if (!
iface->isValid()) {
950 qCWarning(lcAccessibilityAtspi) <<
"Announcement event with invalid accessible: " <<
iface;
956 const QAccessible::AnnouncementPriority prio =
event->priority();
957 const int politeness = (prio == QAccessible::AnnouncementPriority::Assertive) ? ATSPI_LIVE_ASSERTIVE : ATSPI_LIVE_POLITE;
968 switch (
event->type()) {
969 case QAccessible::ObjectCreated:
970 if (sendObject || sendObject_children_changed)
971 notifyAboutCreation(
event->accessibleInterface());
973 case QAccessible::ObjectShow: {
974 if (sendObject || sendObject_state_changed) {
975 notifyStateChange(
event->accessibleInterface(),
"showing"_L1, 1);
979 case QAccessible::ObjectHide: {
980 if (sendObject || sendObject_state_changed) {
981 notifyStateChange(
event->accessibleInterface(),
"showing"_L1, 0);
985 case QAccessible::ObjectDestroyed: {
986 if (sendObject || sendObject_state_changed)
987 notifyAboutDestruction(
event->accessibleInterface());
990 case QAccessible::ObjectReorder: {
991 if (sendObject || sendObject_children_changed)
992 childrenChanged(
event->accessibleInterface());
995 case QAccessible::NameChanged: {
996 if (sendObject || sendObject_property_change || sendObject_property_change_accessible_name) {
997 QAccessibleInterface *
iface =
event->accessibleInterface();
1000 "NameChanged event from invalid accessible.");
1006 "accessible-name"_L1, 0, 0,
1009 "PropertyChange"_L1,
args);
1013 case QAccessible::DescriptionChanged: {
1014 if (sendObject || sendObject_property_change || sendObject_property_change_accessible_description) {
1015 QAccessibleInterface *
iface =
event->accessibleInterface();
1018 "DescriptionChanged event from invalid accessible.");
1024 "accessible-description"_L1, 0, 0,
1027 "PropertyChange"_L1,
args);
1031 case QAccessible::Focus: {
1032 if (sendFocus || sendObject || sendObject_state_changed)
1033 sendFocusChanged(
event->accessibleInterface());
1037 case QAccessible::Announcement: {
1038 if (sendObject || sendObject_announcement) {
1039 QAccessibleAnnouncementEvent *announcementEvent =
static_cast<QAccessibleAnnouncementEvent*
>(
event);
1040 sendAnnouncement(announcementEvent);
1044 case QAccessible::TextInserted:
1045 case QAccessible::TextRemoved:
1046 case QAccessible::TextUpdated: {
1047 if (sendObject || sendObject_text_changed) {
1048 QAccessibleInterface *
iface =
event->accessibleInterface();
1049 if (!iface || !
iface->textInterface()) {
1050 qCWarning(lcAccessibilityAtspi) <<
"Received text event for invalid interface.";
1055 int changePosition = 0;
1056 int cursorPosition = 0;
1060 if (
event->type() == QAccessible::TextInserted) {
1061 QAccessibleTextInsertEvent *textEvent =
static_cast<QAccessibleTextInsertEvent*
>(
event);
1062 textInserted = textEvent->textInserted();
1063 changePosition = textEvent->changePosition();
1064 cursorPosition = textEvent->cursorPosition();
1065 }
else if (
event->type() == QAccessible::TextRemoved) {
1066 QAccessibleTextRemoveEvent *textEvent =
static_cast<QAccessibleTextRemoveEvent*
>(
event);
1067 textRemoved = textEvent->textRemoved();
1068 changePosition = textEvent->changePosition();
1069 cursorPosition = textEvent->cursorPosition();
1070 }
else if (
event->type() == QAccessible::TextUpdated) {
1071 QAccessibleTextUpdateEvent *textEvent =
static_cast<QAccessibleTextUpdateEvent*
>(
event);
1072 textInserted = textEvent->textInserted();
1073 textRemoved = textEvent->textRemoved();
1074 changePosition = textEvent->changePosition();
1075 cursorPosition = textEvent->cursorPosition();
1080 if (!textRemoved.isEmpty()) {
1084 "TextChanged"_L1,
args);
1087 if (!textInserted.isEmpty()) {
1091 "TextChanged"_L1,
args);
1104 case QAccessible::TextCaretMoved: {
1105 if (sendObject || sendObject_text_caret_moved) {
1106 QAccessibleInterface *
iface =
event->accessibleInterface();
1107 if (!iface || !
iface->textInterface()) {
1108 qCWarning(lcAccessibilityAtspi) <<
"Sending TextCaretMoved from object that does not implement text interface: " <<
iface;
1114 int pos =
iface->textInterface()->cursorPosition();
1118 "TextCaretMoved"_L1,
args);
1122 case QAccessible::TextSelectionChanged: {
1123 if (sendObject || sendObject_text_selection_changed) {
1124 QAccessibleInterface *
iface =
event->accessibleInterface();
1128 "TextSelectionChanged"_L1,
args);
1132 case QAccessible::ValueChanged: {
1133 if (sendObject || sendObject_value_changed || sendObject_property_change_accessible_value) {
1134 QAccessibleInterface *
iface =
event->accessibleInterface();
1136 qCWarning(lcAccessibilityAtspi) <<
"ValueChanged event from invalid accessible.";
1139 if (
iface->valueInterface()) {
1141 QVariantList args = packDBusSignalArguments(
"accessible-value"_L1, 0, 0, variantForPath(
path));
1143 "PropertyChange"_L1,
args);
1144 }
else if (
iface->role() == QAccessible::ComboBox) {
1149 "accessible-name"_L1, 0, 0,
1152 "PropertyChange"_L1, args1);
1155 "SelectionChanged"_L1, args2);
1157 qCWarning(lcAccessibilityAtspi) <<
"ValueChanged event and no ValueInterface or ComboBox: " <<
iface;
1162 case QAccessible::SelectionAdd:
1163 case QAccessible::SelectionRemove:
1164 case QAccessible::Selection: {
1165 QAccessibleInterface *
iface =
event->accessibleInterface();
1167 qCWarning(lcAccessibilityAtspi) <<
"Selection event from invalid accessible.";
1172 int selected =
iface->state().selected ? 1 : 0;
1173 QVariantList stateArgs = packDBusSignalArguments(
"selected"_L1, selected, 0, variantForPath(
path));
1179 qCDebug(lcAccessibilityAtspi) <<
"No valid parent in selection event.";
1189 case QAccessible::SelectionWithin: {
1190 QAccessibleInterface *
iface =
event->accessibleInterface();
1192 qCWarning(lcAccessibilityAtspi) <<
"SelectionWithin event from invalid accessible.";
1201 case QAccessible::StateChanged: {
1202 if (sendObject || sendObject_state_changed || sendWindow || sendWindow_activate) {
1204 if (stateChange.checked) {
1205 QAccessibleInterface *
iface =
event->accessibleInterface();
1207 qCWarning(lcAccessibilityAtspi) <<
"StateChanged event from invalid accessible.";
1210 int checked =
iface->state().checked;
1211 notifyStateChange(iface,
"checked"_L1, checked);
1212 }
else if (stateChange.active) {
1213 QAccessibleInterface *
iface =
event->accessibleInterface();
1214 if (!iface || !(
iface->role() == QAccessible::Window && (sendWindow || sendWindow_activate)))
1224 notifyStateChange(iface,
"active"_L1,
isActive);
1225 }
else if (stateChange.disabled) {
1226 QAccessibleInterface *
iface =
event->accessibleInterface();
1230 notifyStateChange(iface,
"enabled"_L1,
enabled);
1231 notifyStateChange(iface,
"sensitive"_L1,
enabled);
1232 }
else if (stateChange.focused) {
1233 QAccessibleInterface *
iface =
event->accessibleInterface();
1235 bool focused =
state.focused;
1236 notifyStateChange(iface,
"focused"_L1, focused);
1241 case QAccessible::TableModelChanged: {
1242 QAccessibleInterface *
interface =
event->accessibleInterface();
1244 qCWarning(lcAccessibilityAtspi) <<
"TableModelChanged event from invalid accessible.";
1249 QAccessibleTableModelChangeEvent *tableModelEvent =
static_cast<QAccessibleTableModelChangeEvent*
>(
event);
1250 switch (tableModelEvent->modelChangeType()) {
1251 case QAccessibleTableModelChangeEvent::ColumnsInserted: {
1252 if (sendObject || sendObject_column_inserted) {
1253 const int firstColumn = tableModelEvent->firstColumn();
1254 const int insertedColumnCount = tableModelEvent->lastColumn() - firstColumn + 1;
1260 case QAccessibleTableModelChangeEvent::ColumnsRemoved: {
1261 if (sendObject || sendObject_column_deleted) {
1262 const int firstColumn = tableModelEvent->firstColumn();
1263 const int removedColumnCount = tableModelEvent->lastColumn() - firstColumn + 1;
1269 case QAccessibleTableModelChangeEvent::RowsInserted: {
1270 if (sendObject || sendObject_row_inserted) {
1271 const int firstRow = tableModelEvent->firstRow();
1272 const int insertedRowCount = tableModelEvent->lastRow() - firstRow + 1;
1278 case QAccessibleTableModelChangeEvent::RowsRemoved: {
1279 if (sendObject || sendObject_row_deleted) {
1280 const int firstRow = tableModelEvent->firstRow();
1281 const int removedRowCount = tableModelEvent->lastRow() - firstRow + 1;
1287 case QAccessibleTableModelChangeEvent::ModelChangeType::ModelReset: {
1288 if (sendObject || sendObject_model_changed) {
1294 case QAccessibleTableModelChangeEvent::DataChanged: {
1295 if (sendObject || sendObject_visible_data_changed) {
1306 case QAccessible::ParentChanged:
1307 case QAccessible::DialogStart:
1308 case QAccessible::DialogEnd:
1309 case QAccessible::PopupMenuStart:
1310 case QAccessible::PopupMenuEnd:
1311 case QAccessible::SoundPlayed:
1312 case QAccessible::Alert:
1313 case QAccessible::ForegroundChanged:
1314 case QAccessible::MenuStart:
1315 case QAccessible::MenuEnd:
1316 case QAccessible::ContextHelpStart:
1317 case QAccessible::ContextHelpEnd:
1318 case QAccessible::DragDropStart:
1319 case QAccessible::DragDropEnd:
1320 case QAccessible::ScrollingStart:
1321 case QAccessible::ScrollingEnd:
1322 case QAccessible::MenuCommand:
1323 case QAccessible::ActionChanged:
1324 case QAccessible::ActiveDescendantChanged:
1325 case QAccessible::AttributeChanged:
1326 case QAccessible::DocumentContentChanged:
1327 case QAccessible::DocumentLoadComplete:
1328 case QAccessible::DocumentLoadStopped:
1329 case QAccessible::DocumentReload:
1330 case QAccessible::HyperlinkEndIndexChanged:
1331 case QAccessible::HyperlinkNumberOfAnchorsChanged:
1332 case QAccessible::HyperlinkSelectedLinkChanged:
1333 case QAccessible::HypertextLinkActivated:
1334 case QAccessible::HypertextLinkSelected:
1335 case QAccessible::HyperlinkStartIndexChanged:
1336 case QAccessible::HypertextChanged:
1337 case QAccessible::HypertextNLinksChanged:
1338 case QAccessible::ObjectAttributeChanged:
1339 case QAccessible::PageChanged:
1340 case QAccessible::SectionChanged:
1341 case QAccessible::TableCaptionChanged:
1342 case QAccessible::TableColumnDescriptionChanged:
1343 case QAccessible::TableColumnHeaderChanged:
1344 case QAccessible::TableRowDescriptionChanged:
1345 case QAccessible::TableRowHeaderChanged:
1346 case QAccessible::TableSummaryChanged:
1347 case QAccessible::TextAttributeChanged:
1348 case QAccessible::TextColumnChanged:
1349 case QAccessible::VisibleDataChanged:
1350 case QAccessible::LocationChanged:
1351 case QAccessible::HelpChanged:
1352 case QAccessible::DefaultActionChanged:
1353 case QAccessible::AcceleratorChanged:
1354 case QAccessible::InvalidEvent:
1359void AtSpiAdaptor::sendFocusChanged(QAccessibleInterface *
interface)
const
1363 if (!lastFocusPath.isEmpty()) {
1364 QVariantList stateArgs = packDBusSignalArguments(
"focused"_L1, 0, 0, variantForPath(lastFocusPath));
1366 "StateChanged"_L1, stateArgs);
1372 QVariantList stateArgs = packDBusSignalArguments(
"focused"_L1, 1, 0, variantForPath(
path));
1374 "StateChanged"_L1, stateArgs);
1378 lastFocusPath =
path;
1382void AtSpiAdaptor::childrenChanged(QAccessibleInterface *
interface)
const
1385 int childCount =
interface->childCount();
1388 QVariantList args = packDBusSignalArguments(
"add"_L1, childCount, 0, childPath);
1393void AtSpiAdaptor::notifyAboutCreation(QAccessibleInterface *
interface)
const
1398 qCDebug(lcAccessibilityAtspi) <<
"AtSpiAdaptor::notifyAboutCreation: Could not find parent for " <<
interface->object();
1402 int childCount =
parent->childCount();
1408void AtSpiAdaptor::notifyAboutDestruction(QAccessibleInterface *
interface)
const
1415 qCDebug(lcAccessibilityAtspi) <<
"AtSpiAdaptor::notifyAboutDestruction: Could not find parent for " <<
interface->object();
1422 int childIndex = -1;
1441 QAccessibleInterface * accessible = interfaceFromPath(
message.path());
1443 qCWarning(lcAccessibilityAtspi) <<
"Could not find accessible on path:" <<
message.path();
1446 if (!accessible->isValid()) {
1447 qCWarning(lcAccessibilityAtspi) <<
"Accessible invalid:" << accessible <<
message.path();
1451 QString interface = message.interface();
1456 if (function ==
"Introspect"_L1) {
1462 if (
interface ==
"org.freedesktop.DBus.Properties"_L1) {
1463 interface = message.arguments().
at(0).
toString();
1465 function =
message.member() +
message.arguments().at(1).toString();
1487 if (
interface == ATSPI_DBUS_INTERFACE_TABLE_CELL
""_L1)
1490 qCDebug(lcAccessibilityAtspi) <<
"AtSpiAdaptor::handleMessage with unknown interface: " <<
message.path() <<
interface << function;
1502 if (function ==
"SetId"_L1) {
1506 m_applicationId =
value.toInt();
1509 if (function ==
"GetId"_L1) {
1514 if (function ==
"GetToolkitName"_L1) {
1519 if (function ==
"GetVersion"_L1) {
1524 if (function ==
"GetLocale"_L1) {
1529 qCDebug(lcAccessibilityAtspi) <<
"AtSpiAdaptor::applicationInterface " <<
message.path() <<
interface << function;
1538 OrgA11yAtspiSocketInterface *registry;
1542 QDBusPendingReply<QSpiObjectReference>
reply;
1545 reply.waitForFinished();
1546 if (
reply.isValid ()) {
1550 qCWarning(lcAccessibilityAtspi) <<
"Error in contacting registry:"
1558QString accessibleIdForAccessible(QAccessibleInterface *accessible)
1561 while (accessible) {
1564 if (
auto obj = accessible->object()) {
1566 if (!
name.isEmpty())
1571 accessible = accessible->parent();
1580 if (function ==
"GetRole"_L1) {
1582 }
else if (function ==
"GetName"_L1) {
1584 }
else if (function ==
"GetRoleName"_L1) {
1586 }
else if (function ==
"GetLocalizedRoleName"_L1) {
1588 }
else if (function ==
"GetChildCount"_L1) {
1590 }
else if (function ==
"GetIndexInParent"_L1) {
1591 int childIndex = -1;
1595 if (childIndex < 0) {
1596 qCDebug(lcAccessibilityAtspi) <<
"GetIndexInParent get invalid index: " << childIndex <<
interface;
1600 }
else if (function ==
"GetParent"_L1) {
1604 path = ATSPI_DBUS_PATH_NULL
""_L1;
1605 }
else if (
parent->role() == QAccessible::Application) {
1613 }
else if (function ==
"GetChildAtIndex"_L1) {
1623 }
else if (function ==
"GetInterfaces"_L1) {
1625 }
else if (function ==
"GetDescription"_L1) {
1627 }
else if (function ==
"GetState"_L1) {
1635 QAccessible::Role role =
interface->role();
1636 if (role == QAccessible::TreeItem ||
1637 role == QAccessible::ListItem) {
1646 }
else if (function ==
"GetAttributes"_L1) {
1648 }
else if (function ==
"GetRelationSet"_L1) {
1650 }
else if (function ==
"GetApplication"_L1) {
1653 }
else if (function ==
"GetChildren"_L1) {
1655 const int numChildren =
interface->childCount();
1657 for (
int i = 0;
i < numChildren; ++
i) {
1663 }
else if (function ==
"GetAccessibleId"_L1) {
1667 qCWarning(lcAccessibilityAtspi) <<
"AtSpiAdaptor::accessibleInterface does not implement" << function <<
message.path();
1673AtspiRole AtSpiAdaptor::getRole(QAccessibleInterface *
interface)
const
1675 if ((
interface->role() == QAccessible::EditableText) &&
interface->state().passwordEdit)
1676 return ATSPI_ROLE_PASSWORD_TEXT;
1683 qCDebug(lcAccessibilityAtspiCreation) <<
"AtSpiAdaptor::accessibleInterfaces create: " <<
interface->object();
1688 (
interface->role() == QAccessible::ListItem) ||
1689 (
interface->role() == QAccessible::Cell) ||
1690 (
interface->role() == QAccessible::TreeItem) ||
1691 (
interface->role() == QAccessible::Row) ||
1696 qCDebug(lcAccessibilityAtspiCreation) <<
" IS NOT a component";
1698 if (
interface->role() == QAccessible::Application)
1720 ifaces << u
"" ATSPI_DBUS_INTERFACE_TABLE_CELL
""_s;
1727 typedef QPair<QAccessibleInterface*, QAccessible::Relation> RelationPair;
1728 const QList<RelationPair> relationInterfaces =
interface->relations();
1731 for (
const RelationPair &pair : relationInterfaces) {
1756 if (inheritsQAction(
object)) {
1757 qCWarning(lcAccessibilityAtspi) <<
"AtSpiAdaptor::pathForObject: Creating path with QAction as object.";
1760 QAccessibleInterface *
iface = QAccessible::queryAccessibleInterface(
object);
1761 return pathForInterface(iface);
1764QString AtSpiAdaptor::pathForInterface(QAccessibleInterface *
interface)
const
1767 return u
"" ATSPI_DBUS_PATH_NULL
""_s;
1768 if (
interface->role() == QAccessible::Application)
1771 QAccessible::Id
id = QAccessible::uniqueId(
interface);
1776bool AtSpiAdaptor::inheritsQAction(
QObject *
object)
1781 if (cn ==
"QAction"_L1)
1783 mo =
mo->superClass();
1789static QAccessibleInterface * getWindow(QAccessibleInterface *
interface)
1793 QAccessibleInterface*
app = QAccessible::queryAccessibleInterface(
qApp);
1803 if (function ==
"Contains"_L1) {
1805 int x =
message.arguments().at(0).toInt();
1806 int y =
message.arguments().at(1).toInt();
1812 }
else if (function ==
"GetAccessibleAtPoint"_L1) {
1819 QAccessibleInterface * childInterface(
interface->childAt(screenPos.
x(), screenPos.
y()));
1820 QAccessibleInterface *
iface =
nullptr;
1821 while (childInterface) {
1822 iface = childInterface;
1823 childInterface =
iface->childAt(screenPos.
x(), screenPos.
y());
1833 }
else if (function ==
"GetAlpha"_L1) {
1835 }
else if (function ==
"GetExtents"_L1) {
1840 }
else if (function ==
"GetLayer"_L1) {
1842 }
else if (function ==
"GetMDIZOrder"_L1) {
1844 }
else if (function ==
"GetPosition"_L1) {
1852 }
else if (function ==
"GetSize"_L1) {
1857 }
else if (function ==
"GrabFocus"_L1) {
1858 QAccessibleActionInterface *actionIface =
interface->actionInterface();
1859 if (actionIface && actionIface->actionNames().contains(QAccessibleActionInterface::setFocusAction())) {
1860 actionIface->doAction(QAccessibleActionInterface::setFocusAction());
1865 }
else if (function ==
"SetExtents"_L1) {
1871 qCDebug(lcAccessibilityAtspi) <<
"SetExtents is not implemented.";
1873 }
else if (function ==
"SetPosition"_L1) {
1877 qCDebug(lcAccessibilityAtspi) <<
"SetPosition is not implemented.";
1879 }
else if (function ==
"SetSize"_L1) {
1882 qCDebug(lcAccessibilityAtspi) <<
"SetSize is not implemented.";
1885 qCWarning(lcAccessibilityAtspi) <<
"AtSpiAdaptor::componentInterface does not implement" << function <<
message.path();
1899 if (function ==
"GetNActions"_L1) {
1902 }
else if (function ==
"DoAction"_L1) {
1905 if (index < 0 || index >= actionNames.size())
1910 }
else if (function ==
"GetActions"_L1) {
1912 }
else if (function ==
"GetName"_L1) {
1915 if (index < 0 || index >= actionNames.size())
1918 }
else if (function ==
"GetDescription"_L1) {
1921 if (index < 0 || index >= actionNames.size())
1924 if (QAccessibleActionInterface *actionIface =
interface->actionInterface())
1925 description = actionIface->localizedActionDescription(actionNames.at(
index));
1927 description = qAccessibleLocalizedActionDescription(actionNames.at(
index));
1929 }
else if (function ==
"GetKeyBinding"_L1) {
1932 if (index < 0 || index >= actionNames.size())
1935 if (QAccessibleActionInterface *actionIface =
interface->actionInterface())
1936 keyBindings = actionIface->keyBindingsForAction(actionNames.at(
index));
1937 if (keyBindings.isEmpty()) {
1940 keyBindings.append(acc);
1942 if (keyBindings.size() > 0)
1947 qCWarning(lcAccessibilityAtspi) <<
"AtSpiAdaptor::actionInterface does not implement" << function <<
message.path();
1955 QAccessibleActionInterface *actionInterface =
interface->actionInterface();
1958 actions.reserve(actionNames.size());
1959 for (
const QString &actionName : actionNames) {
1962 action.
name = actionName;
1963 if (actionInterface) {
1964 action.
description = actionInterface->localizedActionDescription(actionName);
1965 const QStringList keyBindings = actionInterface->keyBindingsForAction(actionName);
1966 if (!keyBindings.isEmpty())
1969 action.
description = qAccessibleLocalizedActionDescription(actionName);
1972 actions.append(std::move(action));
1984 if (function ==
"GetCaretOffset"_L1) {
1986 }
else if (function ==
"GetCharacterCount"_L1) {
1990 }
else if (function ==
"AddSelection"_L1) {
1991 int startOffset =
message.arguments().at(0).toInt();
1992 int endOffset =
message.arguments().at(1).toInt();
1993 int lastSelection =
interface->textInterface()->selectionCount();
1994 interface->textInterface()->setSelection(lastSelection, startOffset, endOffset);
1996 }
else if (function ==
"GetAttributeRun"_L1) {
1998 bool includeDefaults =
message.arguments().at(1).toBool();
2001 }
else if (function ==
"GetAttributeValue"_L1) {
2005 }
else if (function ==
"GetAttributes"_L1) {
2008 }
else if (function ==
"GetBoundedRanges"_L1) {
2009 int x =
message.arguments().at(0).toInt();
2010 int y =
message.arguments().at(1).toInt();
2014 uint xClipType =
message.arguments().at(5).toUInt();
2015 uint yClipType =
message.arguments().at(6).toUInt();
2023 qCDebug(lcAccessibilityAtspi) <<
"Not implemented: QSpiAdaptor::GetBoundedRanges";
2025 }
else if (function ==
"GetCharacterAtOffset"_L1) {
2033 if (stringIt.hasNext())
2034 codePoint =
static_cast<int>(stringIt.peekNext());
2036 }
else if (function ==
"GetCharacterExtents"_L1) {
2040 }
else if (function ==
"GetDefaultAttributeSet"_L1 || function ==
"GetDefaultAttributes"_L1) {
2044 }
else if (function ==
"GetNSelections"_L1) {
2046 }
else if (function ==
"GetOffsetAtPoint"_L1) {
2056 }
else if (function ==
"GetRangeExtents"_L1) {
2057 int startOffset =
message.arguments().at(0).toInt();
2058 int endOffset =
message.arguments().at(1).toInt();
2061 }
else if (function ==
"GetSelection"_L1) {
2062 int selectionNum =
message.arguments().at(0).toInt();
2070 }
else if (function ==
"GetStringAtOffset"_L1) {
2072 uint granularity =
message.arguments().at(1).toUInt();
2073 if (!isValidAtspiTextGranularity(granularity))
2075 int startOffset, endOffset;
2076 QString text =
interface->textInterface()->textAtOffset(
offset, qAccessibleBoundaryTypeFromAtspiTextGranularity(granularity), &startOffset, &endOffset);
2078 ret <<
text << startOffset << endOffset;
2080 }
else if (function ==
"GetText"_L1) {
2081 int startOffset =
message.arguments().at(0).toInt();
2082 int endOffset =
message.arguments().at(1).toInt();
2083 if (endOffset == -1)
2084 endOffset =
interface->textInterface()->characterCount();
2086 }
else if (function ==
"GetTextAfterOffset"_L1) {
2089 int startOffset, endOffset;
2090 QString text =
interface->textInterface()->textAfterOffset(
offset, qAccessibleBoundaryTypeFromAtspiBoundaryType(
type), &startOffset, &endOffset);
2092 ret <<
text << startOffset << endOffset;
2094 }
else if (function ==
"GetTextAtOffset"_L1) {
2097 int startOffset, endOffset;
2100 ret <<
text << startOffset << endOffset;
2102 }
else if (function ==
"GetTextBeforeOffset"_L1) {
2105 int startOffset, endOffset;
2106 QString text =
interface->textInterface()->textBeforeOffset(
offset, qAccessibleBoundaryTypeFromAtspiBoundaryType(
type), &startOffset, &endOffset);
2108 ret <<
text << startOffset << endOffset;
2110 }
else if (function ==
"RemoveSelection"_L1) {
2111 int selectionNum =
message.arguments().at(0).toInt();
2112 interface->textInterface()->removeSelection(selectionNum);
2114 }
else if (function ==
"SetCaretOffset"_L1) {
2118 }
else if (function ==
"ScrollSubstringTo"_L1) {
2119 int startOffset =
message.arguments().at(0).toInt();
2120 int endOffset =
message.arguments().at(1).toInt();
2122 qCInfo(lcAccessibilityAtspi) <<
"AtSpiAdaptor::ScrollSubstringTo doesn'take take scroll type into account.";
2123 interface->textInterface()->scrollToSubstring(startOffset, endOffset);
2125 }
else if (function ==
"SetSelection"_L1) {
2126 int selectionNum =
message.arguments().at(0).toInt();
2127 int startOffset =
message.arguments().at(1).toInt();
2128 int endOffset =
message.arguments().at(2).toInt();
2129 interface->textInterface()->setSelection(selectionNum, startOffset, endOffset);
2132 qCWarning(lcAccessibilityAtspi) <<
"AtSpiAdaptor::textInterface does not implement" << function <<
message.path();
2138QAccessible::TextBoundaryType AtSpiAdaptor::qAccessibleBoundaryTypeFromAtspiBoundaryType(
int atspiTextBoundaryType)
2140 switch (atspiTextBoundaryType) {
2141 case ATSPI_TEXT_BOUNDARY_CHAR:
2142 return QAccessible::CharBoundary;
2143 case ATSPI_TEXT_BOUNDARY_WORD_START:
2144 case ATSPI_TEXT_BOUNDARY_WORD_END:
2145 return QAccessible::WordBoundary;
2146 case ATSPI_TEXT_BOUNDARY_SENTENCE_START:
2147 case ATSPI_TEXT_BOUNDARY_SENTENCE_END:
2148 return QAccessible::SentenceBoundary;
2149 case ATSPI_TEXT_BOUNDARY_LINE_START:
2150 case ATSPI_TEXT_BOUNDARY_LINE_END:
2151 return QAccessible::LineBoundary;
2153 Q_ASSERT_X(0,
"",
"Requested invalid boundary type.");
2154 return QAccessible::CharBoundary;
2157bool AtSpiAdaptor::isValidAtspiTextGranularity(
uint atspiTextGranularity)
2159 if (atspiTextGranularity == ATSPI_TEXT_GRANULARITY_CHAR
2160 || atspiTextGranularity == ATSPI_TEXT_GRANULARITY_WORD
2161 || atspiTextGranularity == ATSPI_TEXT_GRANULARITY_SENTENCE
2162 || atspiTextGranularity == ATSPI_TEXT_GRANULARITY_LINE
2163 || atspiTextGranularity == ATSPI_TEXT_GRANULARITY_PARAGRAPH)
2166 qCWarning(lcAccessibilityAtspi) <<
"Unknown value" << atspiTextGranularity <<
"for AT-SPI text granularity type";
2170QAccessible::TextBoundaryType AtSpiAdaptor::qAccessibleBoundaryTypeFromAtspiTextGranularity(
uint atspiTextGranularity)
2172 Q_ASSERT(isValidAtspiTextGranularity(atspiTextGranularity));
2174 switch (atspiTextGranularity) {
2175 case ATSPI_TEXT_GRANULARITY_CHAR:
2176 return QAccessible::CharBoundary;
2177 case ATSPI_TEXT_GRANULARITY_WORD:
2178 return QAccessible::WordBoundary;
2179 case ATSPI_TEXT_GRANULARITY_SENTENCE:
2180 return QAccessible::SentenceBoundary;
2181 case ATSPI_TEXT_GRANULARITY_LINE:
2182 return QAccessible::LineBoundary;
2183 case ATSPI_TEXT_GRANULARITY_PARAGRAPH:
2184 return QAccessible::ParagraphBoundary;
2186 return QAccessible::CharBoundary;
2191 struct AtSpiAttribute {
2201 return ia2Color.
mid(4, ia2Color.size() - (4+1)).
replace(u
"\\,"_s, u
","_s);
2207 return ia2Size.
left(ia2Size.size() - 2);
2210 AtSpiAttribute atspiTextAttribute(
const QString &ia2Name,
const QString &ia2Value)
2222 if (ia2Name ==
"background-color"_L1) {
2225 }
else if (ia2Name ==
"font-family"_L1) {
2227 }
else if (ia2Name ==
"color"_L1) {
2230 }
else if (ia2Name ==
"text-align"_L1) {
2232 if (
value ==
"justify"_L1) {
2234 }
else if (
value !=
"left"_L1 &&
value !=
"right"_L1 &&
value !=
"center"_L1) {
2235 qCDebug(lcAccessibilityAtspi) <<
"Unknown text-align attribute value \""
2236 <<
value <<
"\" cannot be translated to AT-SPI.";
2239 }
else if (ia2Name ==
"font-size"_L1) {
2242 }
else if (ia2Name ==
"font-style"_L1) {
2244 if (
value !=
"normal"_L1 &&
value !=
"italic"_L1 &&
value !=
"oblique"_L1) {
2245 qCDebug(lcAccessibilityAtspi) <<
"Unknown font-style attribute value \"" <<
value
2246 <<
"\" cannot be translated to AT-SPI.";
2249 }
else if (ia2Name ==
"text-underline-type"_L1) {
2251 if (
value !=
"none"_L1 &&
value !=
"single"_L1 &&
value !=
"double"_L1) {
2252 qCDebug(lcAccessibilityAtspi) <<
"Unknown text-underline-type attribute value \""
2253 <<
value <<
"\" cannot be translated to AT-SPI.";
2256 }
else if (ia2Name ==
"font-weight"_L1) {
2258 if (
value ==
"normal"_L1)
2263 }
else if (((ia2Name ==
"text-line-through-style"_L1 || ia2Name ==
"text-line-through-type"_L1) && (ia2Value !=
"none"_L1))
2264 || (ia2Name ==
"text-line-through-text"_L1 && !ia2Value.isEmpty())) {
2270 }
else if (ia2Name ==
"text-position"_L1) {
2272 if (
value !=
"baseline"_L1 &&
value !=
"super"_L1 &&
value !=
"sub"_L1) {
2273 qCDebug(lcAccessibilityAtspi) <<
"Unknown text-position attribute value \"" <<
value
2274 <<
"\" cannot be translated to AT-SPI.";
2277 }
else if (ia2Name ==
"writing-mode"_L1) {
2279 if (
value ==
"lr"_L1)
2281 else if (
value ==
"rl"_L1)
2283 else if (
value ==
"tb"_L1) {
2286 qCDebug(lcAccessibilityAtspi) <<
"writing-mode attribute value \"tb\" translated only w.r.t. horizontal direction; vertical direction ignored";
2288 qCDebug(lcAccessibilityAtspi) <<
"Unknown writing-mode attribute value \"" <<
value
2289 <<
"\" cannot be translated to AT-SPI.";
2292 }
else if (ia2Name ==
"language"_L1) {
2294 }
else if (ia2Name ==
"invalid"_L1) {
2316 for (
const QString &attr : attributes) {
2339 joined =
interface->textInterface()->attributes(
offset, &startOffset, &endOffset);
2341 for (
const QString& attr : attributes) {
2348 return map[attributeName];
2355 return QList<QVariant>() <<
rect.x() <<
rect.y() <<
rect.width() <<
rect.height();
2358QList<QVariant> AtSpiAdaptor::getRangeExtents(QAccessibleInterface *
interface,
2361 if (endOffset == -1)
2362 endOffset =
interface->textInterface()->characterCount();
2364 QAccessibleTextInterface *textInterface =
interface->textInterface();
2365 if (endOffset <= startOffset || !textInterface)
2366 return QList<QVariant>() << -1 << -1 << 0 << 0;
2368 QRect rect = textInterface->characterRect(startOffset);
2369 for (
int i=startOffset + 1;
i <= endOffset;
i++)
2370 rect =
rect | textInterface->characterRect(
i);
2373 return QList<QVariant>() <<
rect.x() <<
rect.y() <<
rect.width() <<
rect.height();
2381 qCWarning(lcAccessibilityAtspi) <<
"Unknown value" <<
coordType <<
"for AT-SPI coord type";
2385QRect AtSpiAdaptor::translateFromScreenCoordinates(QAccessibleInterface *
interface,
const QRect &screenRect,
uint targetCoordType)
2387 Q_ASSERT(isValidCoordType(targetCoordType));
2389 QAccessibleInterface *upper =
nullptr;
2390 if (targetCoordType == ATSPI_COORD_TYPE_WINDOW)
2392 else if (targetCoordType == ATSPI_COORD_TYPE_PARENT)
2404 Q_ASSERT(isValidCoordType(fromCoordType));
2406 QAccessibleInterface *upper =
nullptr;
2407 if (fromCoordType == ATSPI_COORD_TYPE_WINDOW)
2409 else if (fromCoordType == ATSPI_COORD_TYPE_PARENT)
2414 screenPos += upper->rect().topLeft();
2420static QString textForRange(QAccessibleInterface *accessible,
int startOffset,
int endOffset)
2422 if (QAccessibleTextInterface *textIface = accessible->textInterface()) {
2423 if (endOffset == -1)
2424 endOffset = textIface->characterCount();
2425 return textIface->text(startOffset, endOffset);
2427 QString txt = accessible->text(QAccessible::Value);
2428 if (endOffset == -1)
2430 return txt.mid(startOffset, endOffset - startOffset);
2433static void replaceTextFallback(QAccessibleInterface *accessible,
long startOffset,
long endOffset,
const QString &
txt)
2435 QString t = textForRange(accessible, 0, -1);
2436 if (endOffset == -1)
2437 endOffset =
t.size();
2438 if (endOffset - startOffset == 0)
2439 t.insert(startOffset,
txt);
2441 t.replace(startOffset, endOffset - startOffset,
txt);
2442 accessible->setText(QAccessible::Value,
t);
2447 if (function ==
"CopyText"_L1) {
2448#ifndef QT_NO_CLIPBOARD
2449 int startOffset =
message.arguments().at(0).toInt();
2450 int endOffset =
message.arguments().at(1).toInt();
2455 }
else if (function ==
"CutText"_L1) {
2456#ifndef QT_NO_CLIPBOARD
2457 int startOffset =
message.arguments().at(0).toInt();
2458 int endOffset =
message.arguments().at(1).toInt();
2460 if (QAccessibleEditableTextInterface *editableTextIface =
interface->editableTextInterface())
2461 editableTextIface->deleteText(startOffset, endOffset);
2467 }
else if (function ==
"DeleteText"_L1) {
2468 int startOffset =
message.arguments().at(0).toInt();
2469 int endOffset =
message.arguments().at(1).toInt();
2470 if (QAccessibleEditableTextInterface *editableTextIface =
interface->editableTextInterface())
2471 editableTextIface->deleteText(startOffset, endOffset);
2475 }
else if (function ==
"InsertText"_L1) {
2480 if (QAccessibleEditableTextInterface *editableTextIface =
interface->editableTextInterface())
2485 }
else if (function ==
"PasteText"_L1) {
2486#ifndef QT_NO_CLIPBOARD
2489 if (QAccessibleEditableTextInterface *editableTextIface =
interface->editableTextInterface())
2495 }
else if (function ==
"SetTextContents"_L1) {
2497 if (QAccessibleEditableTextInterface *editableTextIface =
interface->editableTextInterface())
2498 editableTextIface->replaceText(0,
interface->textInterface()->characterCount(), newContents);
2500 replaceTextFallback(
interface, 0, -1, newContents);
2502 }
else if (function.isEmpty()) {
2505 qCWarning(lcAccessibilityAtspi) <<
"AtSpiAdaptor::editableTextInterface does not implement" << function <<
message.path();
2514 QAccessibleValueInterface *valueIface =
interface->valueInterface();
2518 if (function ==
"SetCurrentValue"_L1) {
2520 double value =
v.variant().toDouble();
2523 valueIface->setCurrentValue(
value);
2527 if (function ==
"GetCurrentValue"_L1)
2528 value = valueIface->currentValue();
2529 else if (function ==
"GetMaximumValue"_L1)
2530 value = valueIface->maximumValue();
2531 else if (function ==
"GetMinimumIncrement"_L1)
2532 value = valueIface->minimumStepSize();
2533 else if (function ==
"GetMinimumValue"_L1)
2534 value = valueIface->minimumValue();
2536 qCWarning(lcAccessibilityAtspi) <<
"AtSpiAdaptor::valueInterface does not implement" << function <<
message.path();
2539 if (!
value.canConvert<
double>()) {
2540 qCWarning(lcAccessibilityAtspi) <<
"AtSpiAdaptor::valueInterface: Could not convert to double:" <<
function;
2554 QAccessibleSelectionInterface* selectionInterface =
interface->selectionInterface();
2555 if (!selectionInterface) {
2560 if (function ==
"ClearSelection"_L1 ) {
2562 }
else if (function ==
"DeselectChild"_L1 ) {
2563 int childIndex =
message.arguments().at(0).toInt();
2567 ret = selectionInterface->unselect(
child);
2569 }
else if (function ==
"DeselectSelectedChild"_L1 ) {
2570 int selectionIndex =
message.arguments().at(0).toInt();
2572 QAccessibleInterface *selectedChild = selectionInterface->selectedItem(selectionIndex);
2574 ret = selectionInterface->unselect(selectedChild);
2576 }
else if (function ==
"GetNSelectedChildren"_L1) {
2579 }
else if (function ==
"GetSelectedChild"_L1) {
2580 int selectionIndex =
message.arguments().at(0).toInt();
2583 }
else if (function ==
"IsChildSelected"_L1 ) {
2584 int childIndex =
message.arguments().at(0).toInt();
2588 ret = selectionInterface->isSelected(
child);
2590 }
else if (function ==
"SelectAll"_L1 ) {
2592 }
else if (function ==
"SelectChild"_L1 ) {
2593 int childIndex =
message.arguments().at(0).toInt();
2597 ret = selectionInterface->select(
child);
2600 qCWarning(lcAccessibilityAtspi) <<
"AtSpiAdaptor::selectionInterface does not implement " << function <<
message.path();
2612 qCWarning(lcAccessibilityAtspi) <<
"Qt AtSpiAdaptor: Could not find table interface for:" <<
message.path() <<
interface;
2616 if (function ==
"GetCaption"_L1) {
2617 QAccessibleInterface * captionInterface=
interface->tableInterface()->caption();
2618 if (captionInterface) {
2625 }
else if (function ==
"GetNColumns"_L1) {
2628 }
else if (function ==
"GetNRows"_L1) {
2631 }
else if (function ==
"GetNSelectedColumns"_L1) {
2634 }
else if (function ==
"GetNSelectedRows"_L1) {
2637 }
else if (function ==
"GetSummary"_L1) {
2638 QAccessibleInterface *summary =
interface->tableInterface() ?
interface->tableInterface()->summary() :
nullptr;
2641 }
else if (function ==
"GetAccessibleAt"_L1) {
2648 qCWarning(lcAccessibilityAtspi) <<
"Invalid index for tableInterface GetAccessibleAt (" <<
row <<
"," <<
column <<
')';
2662 }
else if (function ==
"GetIndexAt"_L1) {
2671 qCDebug(lcAccessibilityAtspi) <<
"QSpiAdaptor::GetIndexAt row:" <<
row <<
" col:" <<
column <<
" logical index:" <<
index;
2674 }
else if ((function ==
"GetColumnAtIndex"_L1) || (function ==
"GetRowAtIndex"_L1)) {
2680 if (function ==
"GetColumnAtIndex"_L1) {
2681 if (cell->role() == QAccessible::ColumnHeader) {
2683 }
else if (cell->role() == QAccessible::RowHeader) {
2686 if (!cell->tableCellInterface()) {
2687 qCWarning(lcAccessibilityAtspi).nospace() <<
"AtSpiAdaptor::" << function <<
" No table cell interface: " << cell;
2690 ret = cell->tableCellInterface()->columnIndex();
2693 if (cell->role() == QAccessible::ColumnHeader) {
2695 }
else if (cell->role() == QAccessible::RowHeader) {
2698 if (!cell->tableCellInterface()) {
2699 qCWarning(lcAccessibilityAtspi).nospace() <<
"AtSpiAdaptor::" << function <<
" No table cell interface: " << cell;
2702 ret = cell->tableCellInterface()->rowIndex();
2706 qCWarning(lcAccessibilityAtspi).nospace() <<
"AtSpiAdaptor::" << function <<
" No cell at index: " <<
index <<
" " <<
interface;
2712 }
else if (function ==
"GetColumnDescription"_L1) {
2715 }
else if (function ==
"GetRowDescription"_L1) {
2721 }
else if (function ==
"GetRowColumnExtentsAtIndex"_L1) {
2723 bool success =
false;
2727 int rowExtents = -1;
2728 int colExtents = -1;
2729 bool isSelected =
false;
2731 int cols =
interface->tableInterface()->columnCount();
2735 if (QAccessibleInterface *cell =
interface->tableInterface()->cellAt(
row, col)) {
2736 if (QAccessibleTableCellInterface *cellIface = cell->tableCellInterface()) {
2737 row = cellIface->rowIndex();
2738 col = cellIface->columnIndex();
2739 rowExtents = cellIface->rowExtent();
2740 colExtents = cellIface->columnExtent();
2741 isSelected = cellIface->isSelected();
2747 list << success <<
row << col << rowExtents << colExtents << isSelected;
2750 }
else if (function ==
"GetColumnExtentAt"_L1) {
2753 int columnExtent = 0;
2755 if (QAccessibleTableCellInterface *cellIface = cell->tableCellInterface())
2756 columnExtent = cellIface->columnExtent();
2760 }
else if (function ==
"GetRowExtentAt"_L1) {
2765 if (QAccessibleTableCellInterface *cellIface = cell->tableCellInterface())
2766 rowExtent = cellIface->rowExtent();
2770 }
else if (function ==
"GetColumnHeader"_L1) {
2774 QAccessibleInterface * cell(
interface->tableInterface()->cellAt(0,
column));
2775 if (cell && cell->tableCellInterface()) {
2776 QList<QAccessibleInterface*>
header = cell->tableCellInterface()->columnHeaderCells();
2783 }
else if (function ==
"GetRowHeader"_L1) {
2786 QAccessibleInterface *cell =
interface->tableInterface()->cellAt(
row, 0);
2787 if (cell && cell->tableCellInterface()) {
2788 QList<QAccessibleInterface*>
header = cell->tableCellInterface()->rowHeaderCells();
2795 }
else if (function ==
"GetSelectedColumns"_L1) {
2797 }
else if (function ==
"GetSelectedRows"_L1) {
2799 }
else if (function ==
"IsColumnSelected"_L1) {
2802 }
else if (function ==
"IsRowSelected"_L1) {
2805 }
else if (function ==
"IsSelected"_L1) {
2808 bool selected =
false;
2810 if (QAccessibleTableCellInterface *cellIface = cell->tableCellInterface())
2811 selected = cellIface->isSelected();
2814 }
else if (function ==
"AddColumnSelection"_L1) {
2817 }
else if (function ==
"AddRowSelection"_L1) {
2820 }
else if (function ==
"RemoveColumnSelection"_L1) {
2823 }
else if (function ==
"RemoveRowSelection"_L1) {
2827 qCWarning(lcAccessibilityAtspi) <<
"AtSpiAdaptor::tableInterface does not implement" << function <<
message.path();
2836 QAccessibleTableCellInterface* cellInterface =
interface->tableCellInterface();
2837 if (!cellInterface) {
2842 if (function ==
"GetColumnHeaderCells"_L1) {
2844 const auto headerCellInterfaces = cellInterface->columnHeaderCells();
2845 headerCells.
reserve(headerCellInterfaces.size());
2846 for (QAccessibleInterface *cell : headerCellInterfaces) {
2847 const QString childPath = pathForInterface(cell);
2852 }
else if (function ==
"GetColumnSpan"_L1) {
2855 }
else if (function ==
"GetPosition"_L1) {
2856 const int row = cellInterface->rowIndex();
2857 const int column = cellInterface->columnIndex();
2860 }
else if (function ==
"GetRowHeaderCells"_L1) {
2862 const auto headerCellInterfaces = cellInterface->rowHeaderCells();
2863 headerCells.
reserve(headerCellInterfaces.size());
2864 for (QAccessibleInterface *cell : headerCellInterfaces) {
2865 const QString childPath = pathForInterface(cell);
2870 }
else if (function ==
"GetRowSpan"_L1) {
2873 }
else if (function ==
"GetRowColumnSpan"_L1) {
2875 list << cellInterface->rowIndex() << cellInterface->columnIndex() << cellInterface->rowExtent() << cellInterface->columnExtent();
2877 }
else if (function ==
"GetTable"_L1) {
2879 QAccessibleInterface*
table = cellInterface->table();
2884 qCWarning(lcAccessibilityAtspi) <<
"AtSpiAdaptor::tableCellInterface does not implement" << function <<
message.path();
2893#include "moc_atspiadaptor_p.cpp"
QString introspect(const QString &path) const override
void notify(QAccessibleEvent *event)
void windowActivated(QObject *window, bool active)
void registerApplication()
void eventListenerDeregistered(const QString &bus, const QString &path)
bool handleMessage(const QDBusMessage &message, const QDBusConnection &connection) override
This function needs to handle all messages to the path of the virtual object, when the SubPath option...
void eventListenerRegistered(const QString &bus, const QString &path)
Connects to the accessibility dbus.
QDBusConnection connection() const
Returns the DBus connection that got established.
bool send(const QDBusMessage &message) const
Sends the message over this connection, without waiting for a reply.
QDBusMessage call(const QDBusMessage &message, QDBus::CallMode mode=QDBus::Block, int timeout=-1) const
Sends the message over this connection and blocks, waiting for a reply, for at most timeout milliseco...
static QDBusMessage createSignal(const QString &path, const QString &interface, const QString &name)
Constructs a new DBus message with the given path, interface and name, representing a signal emission...
static QDBusMessage createMethodCall(const QString &destination, const QString &path, const QString &interface, const QString &method)
Constructs a new DBus message representing a method call.
void setVariant(const QVariant &variant)
Assigns the value of the given Qt variant to this D-Bus variant.
static QClipboard * clipboard()
Returns the object for interacting with the clipboard.
bool isEmpty() const noexcept
qsizetype count() const noexcept
void reserve(qsizetype size)
void append(parameter_type t)
T value(const Key &key, const T &defaultValue=T()) const
NetworkError error() const
Returns the error that was found during the processing of this request.
const QObjectList & children() const
Returns a list of child objects.
QObject * parent() const
Returns a pointer to the parent object.
bool inherits(const char *classname) const
Returns true if this object is an instance of a class that inherits className or a QObject subclass t...
bool isWidgetType() const
Returns true if the object is a widget; otherwise returns false.
\inmodule QtCore\reentrant
constexpr int x() const noexcept
Returns the x coordinate of this point.
constexpr int y() const noexcept
Returns the y coordinate of this point.
\inmodule QtCore\reentrant
constexpr void translate(int dx, int dy) noexcept
Moves the rectangle dx along the x axis and dy along the y axis, relative to the current position.
static RoleNames namesForRole(QAccessible::Role role)
void sendEvents(bool active)
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString left(qsizetype n) const &
QString & replace(qsizetype i, qsizetype len, QChar after)
QStringList split(const QString &sep, Qt::SplitBehavior behavior=Qt::KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Splits the string into substrings wherever sep occurs, and returns the list of those strings.
QString mid(qsizetype position, qsizetype n=-1) const &
qsizetype size() const noexcept
Returns the number of characters in this string.
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
const QChar at(qsizetype i) const
Returns the character at the given index position in the string.
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString & prepend(QChar c)
void resize(qsizetype size)
Sets the size of the string to size characters.
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
QMap< QString, QString > map
[6]
void sendReply(RequestData *data)
[10]
QList< QVariant > arguments
QStringList effectiveActionNames(QAccessibleInterface *iface)
bool performEffectiveAction(QAccessibleInterface *iface, const QString &actionName)
Combined button and popup list for selecting options.
constexpr QBindableInterface iface
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction function
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char * interface
DBusConnection * connection
static QString header(const QString &name)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
EGLOutputLayerEXT EGLint attribute
#define Q_LOGGING_CATEGORY(name,...)
#define qCInfo(category,...)
#define qCWarning(category,...)
#define qCDebug(category,...)
GLsizei const GLfloat * v
[13]
GLint GLint GLint GLint GLint x
[0]
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint GLenum GLsizei length
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLuint GLsizei const GLchar * message
GLenum GLuint GLintptr offset
GLsizei const GLubyte GLsizei GLenum coordType
GLenum GLenum GLsizei void GLsizei void * column
GLsizei const GLchar *const * path
GLenum GLenum GLsizei void * row
GLenum GLenum GLsizei void * table
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
#define Q_ASSERT_X(cond, x, msg)
#define ATSPI_DBUS_INTERFACE_EVENT_WINDOW
#define ATSPI_DBUS_INTERFACE_TABLE
#define ATSPI_DBUS_PATH_ROOT
#define ATSPI_DBUS_INTERFACE_EVENT_FOCUS
#define QSPI_OBJECT_PATH_PREFIX
#define ATSPI_DBUS_INTERFACE_SELECTION
#define QSPI_OBJECT_PATH_ROOT
#define ATSPI_DBUS_INTERFACE_APPLICATION
#define ATSPI_DBUS_INTERFACE_ACCESSIBLE
AtspiRelationType qAccessibleRelationToAtSpiRelation(QAccessible::Relation relation)
#define ATSPI_DBUS_INTERFACE_COMPONENT
quint64 spiStatesFromQState(QAccessible::State state)
#define ATSPI_DBUS_INTERFACE_EVENT_OBJECT
void setSpiStateBit(quint64 *state, AtspiStateType spiState)
QSpiUIntList spiStateSetFromSpiStates(quint64 states)
#define ATSPI_DBUS_INTERFACE_ACTION
#define ATSPI_DBUS_INTERFACE_VALUE
#define ATSPI_DBUS_INTERFACE_EDITABLE_TEXT
#define ATSPI_DBUS_INTERFACE_TEXT
#define QSPI_REGISTRY_NAME
QList< QSpiTextRange > QSpiTextRangeList
QMap< QString, QString > QSpiAttributeSet
QList< QSpiRelationArrayEntry > QSpiRelationArray
QList< QSpiAction > QSpiActionArray
QList< QSpiEventListener > QSpiEventListenerArray
QPair< unsigned int, QSpiObjectReferenceArray > QSpiRelationArrayEntry
QLatin1StringView QLatin1String
#define QStringLiteral(str)
QT_BEGIN_NAMESPACE Q_CORE_EXPORT Q_DECL_CONST_FUNCTION const char * qVersion(void) Q_DECL_NOEXCEPT
unsigned long long quint64
static QString windowTitle(HWND hwnd)
QFuture< QSet< QChar > > set
[10]
connect(quitButton, &QPushButton::clicked, &app, &QCoreApplication::quit, Qt::QueuedConnection)
QApplication app(argc, argv)
[0]
char * toString(const MyType &t)
[31]