5 static CORBA_Environment ev;
6 static AccessibilityRegistry registry;
9 Obj_Add (Accessible object)
11 /* TODO: keep list of live object refs */
12 Accessible *oref = g_malloc (sizeof (Accessible));
19 * Basic SPI initialization and event loop function prototypes
26 * Connects to the accessibility registry and initializes the SPI.
28 * Returns: 0 on success, otherwise an integer error code.
37 CORBA_exception_init(&ev);
39 if (!bonobo_init (&argc, NULL))
41 g_error ("Could not initialize Bonobo");
44 obj_id = "OAFIID:Accessibility_Registry:proto0.1";
46 oclient = bonobo_activation_activate_from_id (obj_id, 0, NULL, &ev);
47 if (ev._major != CORBA_NO_EXCEPTION) {
49 ("AT-SPI error: during registry activation: %s\n"),
50 CORBA_exception_id(&ev));
51 CORBA_exception_free(&ev);
55 if (CORBA_Object_is_nil (oclient, &ev))
57 g_error ("Could not locate registry");
61 registry = (Accessibility_Registry) oclient;
70 * @isGNOMEApp: a #boolean indicating whether the client of the SPI
71 * will use the Gnome event loop or not.
73 * Starts/enters the main event loop for the SPI services.
75 * (NOTE: This method does not return control, it is exited via a call to exit()
76 * from within an event handler).
80 SPI_event_main (boolean isGNOMEApp)
82 if (isGNOMEApp) bonobo_main();
83 else CORBA_ORB_run (bonobo_orb(), &ev);
89 * Checks to see if an SPI event is waiting in the event queue.
90 * Used by clients that don't wish to use SPI_event_main().
91 * Not Yet Implemented.
93 * Returns: #TRUE if an event is waiting, otherwise #FALSE.
105 * Gets the next event in the SPI event queue; blocks if no event
107 * Used by clients that don't wish to use SPI_event_main().
108 * Not Yet Implemented.
110 * Returns: the next #AccessibleEvent in the SPI event queue.
114 SPI_nextEvent (boolean waitForEvent)
122 * Disconnects from the Accessibility Registry and releases resources.
123 * Not Yet Implemented.
133 * createEventListener:
134 * @callback : an #AccessibleEventListenerCB callback function, or NULL.
136 * Create a new #AccessibleEventListener with a specified callback function.
138 * Returns: a pointer to a newly-created #AccessibleEventListener.
141 AccessibleEventListener *
142 createEventListener (AccessibleEventListenerCB callback)
144 AccessibleEventListener *listener = accessible_event_listener_new ();
147 accessible_event_listener_add_callback (listener, callback);
153 * EventListener_addCallback:
154 * @listener: the #AccessibleEventListener instance to modify.
155 * @callback: an #AccessibleEventListenerCB function pointer.
157 * Add an in-process callback function to an existing AccessibleEventListener.
159 * Returns: #TRUE if successful, otherwise #FALSE.
163 EventListener_addCallback (AccessibleEventListener *listener,
164 AccessibleEventListenerCB callback)
166 accessible_event_listener_add_callback (listener, callback);
171 * EventListener_removeCallback:
172 * @listener: the #AccessibleEventListener instance to modify.
173 * @callback: an #AccessibleEventListenerCB function pointer.
175 * Remove an in-process callback function from an existing AccessibleEventListener.
177 * Returns: #TRUE if successful, otherwise #FALSE.
181 EventListener_removeCallback (AccessibleEventListener *listener,
182 AccessibleEventListenerCB callback)
184 accessible_event_listener_remove_callback (listener, callback);
190 * Global functions serviced by the registry
195 * registerGlobalEventListener:
196 * @listener: the #AccessibleEventListener to be registered against an event type.
197 * @callback: a character string indicating the type of events for which
198 * notification is requested. Format is
199 * EventClass:major_type:minor_type:detail
200 * where all subfields other than EventClass are optional.
201 * EventClasses include "Focus", "Window", "Mouse",
202 * and toolkit events (e.g. "Gtk", "AWT").
203 * Examples: "focus:", "Gtk:GtkWidget:button_press_event".
205 * NOTE: this string may be UTF-8, but should not contain byte value 56 (ascii ':'),
206 * except as a delimiter, since non-UTF-8 string delimiting
207 * functions are used internally. In general, listening to
208 * toolkit-specific events is not recommended.
210 * Add an in-process callback function to an existing AccessibleEventListener.
212 * Returns: #TRUE if successful, otherwise #FALSE.
216 registerGlobalEventListener (AccessibleEventListener *listener,
219 Accessibility_Registry_registerGlobalEventListener (
221 (Accessibility_EventListener)
222 bonobo_object_corba_objref (bonobo_object (listener)),
226 if (ev._major != CORBA_NO_EXCEPTION)
239 * Get the number of virtual desktops.
240 * NOTE: currently multiple virtual desktops are not implemented, this
241 * function always returns '1'.
243 * Returns: an integer indicating the number of active virtual desktops.
249 return Accessibility_Registry_getDesktopCount (registry, &ev);
254 * @i: an integer indicating which of the accessible desktops is to be returned.
256 * Get the virtual desktop indicated by index @i.
257 * NOTE: currently multiple virtual desktops are not implemented, this
258 * function always returns '1'.
260 * Returns: a pointer to the 'i-th' virtual desktop's #Accessible representation.
266 return Obj_Add (Accessibility_Registry_getDesktop (registry, (CORBA_short) n, &ev));
271 * @list: a pointer to an array of #Accessible objects.
273 * Get the list of virtual desktops. On return, @list will point
274 * to a newly-created array of virtual desktop pointers.
275 * It is the responsibility of the caller to free this array when
276 * it is no longer needed.
278 * Not Yet Implemented.
280 * Returns: an integer indicating how many virtual desktops have been
281 * placed in the list pointed to by parameter @list.
284 getDesktopList (Accessible **list)
291 * registerKeystrokeListener:
292 * @listener: a pointer to the #KeystrokeListener for which
293 * keystroke events are requested.
295 * Not Yet Implemented.
299 registerKeystrokeListener (KeystrokeListener *listener)
306 * @keycode: a #long indicating the keycode of the key event
308 * @meta: a #long indicating the key modifiers to be sent
309 * with the event, if any.
311 * Synthesize a keyboard event (as if a hardware keyboard event occurred in the
312 * current UI context).
313 * Not Yet Implemented.
317 generateKeyEvent (long keyCode, long meta)
323 * generateMouseEvent:
324 * @x: a #long indicating the screen x coordinate of the mouse event.
325 * @y: a #long indicating the screen y coordinate of the mouse event.
326 * @name: a string indicating which mouse event to be synthesized
327 * (e.g. "button1", "button2", "mousemove").
329 * Synthesize a mouse event at a specific screen coordinate.
330 * Not Yet Implemented.
334 generateMouseEvent (long x, long y, char *name)
341 * Accessible function prototypes
347 * @obj: a pointer to the #Accessible object on which to operate.
349 * Increment the reference count for an #Accessible object.
351 * Returns: (no return code implemented yet).
355 Accessible_ref (Accessible *obj)
357 Accessibility_Accessible_ref (*obj, &ev);
364 * @obj: a pointer to the #Accessible object on which to operate.
366 * Decrement the reference count for an #Accessible object.
368 * Returns: (no return code implemented yet).
372 Accessible_unref (Accessible *obj)
374 Accessibility_Accessible_unref (*obj, &ev);
379 * Accessible_getName:
380 * @obj: a pointer to the #Accessible object on which to operate.
382 * Get the name of an #Accessible object.
384 * Returns: a UTF-8 string indicating the name of the #Accessible object.
388 Accessible_getName (Accessible *obj)
390 return Accessibility_Accessible__get_name (*obj, &ev);
394 * Accessible_getDescription:
395 * @obj: a pointer to the #Accessible object on which to operate.
397 * Get the description of an #Accessible object.
399 * Returns: a UTF-8 string describing the #Accessible object.
403 Accessible_getDescription (Accessible *obj)
405 return Accessibility_Accessible__get_description (*obj, &ev);
409 * Accessible_getParent:
410 * @obj: a pointer to the #Accessible object to query.
412 * Get an #Accessible object's parent container.
414 * Returns: a pointer to the #Accessible object which contains the given
415 * #Accessible instance, or NULL if the @obj has no parent container.
419 Accessible_getParent (Accessible *obj)
421 return Obj_Add (Accessibility_Accessible__get_parent (*obj, &ev));
425 * Accessible_getChildCount:
427 * @obj: a pointer to the #Accessible object on which to operate.
429 * Get the number of children contained by an #Accessible object.
431 * Returns: a #long indicating the number of #Accessible children
432 * contained by an #Accessible object.
436 Accessible_getChildCount (Accessible *obj)
438 return Accessibility_Accessible__get_childCount (*obj, &ev);
442 * Accessible_getChildAtIndex:
444 * @obj: a pointer to the #Accessible object on which to operate.
445 * @childIndex: a #long indicating which child is specified.
447 * Get the #Accessible child of an #Accessible object at a given index.
449 * Returns: a pointer to the #Accessible child object at index
454 Accessible_getChildAtIndex (Accessible *obj,
457 return Obj_Add (Accessibility_Accessible_getChildAtIndex (*obj, childIndex, &ev));
461 * Accessible_getIndexInParent:
463 * @obj: a pointer to the #Accessible object on which to operate.
465 * Get the index of an #Accessible object in its containing #Accessible.
467 * Returns: a #long indicating the index of the #Accessible object
468 * in its parent (i.e. containing) #Accessible instance,
469 * or -1 if @obj has no containing parent.
473 Accessible_getIndexInParent (Accessible *obj)
475 return Accessibility_Accessible_getIndexInParent (*obj, &ev);
479 * Accessible_getRelationSet:
481 * Not Yet Implemented.
483 * Returns: a pointer to an array of #AccessibleRelations.
486 AccessibleRelation **
487 Accessible_getRelationSet (Accessible *obj)
493 * Accessible_getRole:
494 * @obj: a pointer to the #Accessible object on which to operate.
496 * Get the UI role of an #Accessible object.
498 * Returns: a UTF-8 string indicating the UI role of the #Accessible object.
502 Accessible_getRole (Accessible *obj)
508 * Accessible_getStateSet:
510 * Not Yet Implemented.
512 * Returns: a pointer to an #AccessibleStateSet representing the object's current state.
515 Accessible_getStateSet (Accessible *obj)
520 /* Interface query methods */
523 * Accessible_isAction:
524 * @obj: a pointer to the #Accessible instance to query.
526 * Query whether the specified #Accessible implements #AccessibleAction.
527 * Not Yet Implemented.
529 * Returns: #TRUE if @obj implements the #AccessibleAction interface,
533 Accessible_isAction (Accessible *obj)
539 * Accessible_isComponent:
540 * @obj: a pointer to the #Accessible instance to query.
542 * Query whether the specified #Accessible implements #AccessibleComponent.
544 * Returns: #TRUE if @obj implements the #AccessibleComponent interface,
548 Accessible_isComponent (Accessible *obj)
550 Bonobo_Unknown iface =
551 Accessibility_Accessible_queryInterface (*obj,
552 "IDL:Accessibility/Component:1.0",
554 return (iface != NULL) ? TRUE : FALSE;
558 * Accessible_isEditableText:
559 * @obj: a pointer to the #Accessible instance to query.
561 * Query whether the specified #Accessible implements #AccessibleEditableText.
562 * Not Yet Implemented.
564 * Returns: #TRUE if @obj implements the #AccessibleEditableText interface,
568 Accessible_isEditableText (Accessible *obj)
574 * Accessible_isHypertext:
575 * @obj: a pointer to the #Accessible instance to query.
577 * Query whether the specified #Accessible implements #AccessibleHypertext.
578 * Not Yet Implemented.
580 * Returns: #TRUE if @obj implements the #AccessibleHypertext interface,
584 Accessible_isHypertext (Accessible *obj)
590 * Accessible_isImage:
591 * @obj: a pointer to the #Accessible instance to query.
593 * Query whether the specified #Accessible implements #AccessibleImage.
594 * Not Yet Implemented.
596 * Returns: #TRUE if @obj implements the #AccessibleImage interface,
600 Accessible_isImage (Accessible *obj)
606 * Accessible_isSelection:
607 * @obj: a pointer to the #Accessible instance to query.
609 * Query whether the specified #Accessible implements #AccessibleSelection.
610 * Not Yet Implemented.
612 * Returns: #TRUE if @obj implements the #AccessibleSelection interface,
616 Accessible_isSelection (Accessible *obj)
622 * Accessible_isTable:
623 * @obj: a pointer to the #Accessible instance to query.
625 * Query whether the specified #Accessible implements #AccessibleTable.
626 * Not Yet Implemented.
628 * Returns: #TRUE if @obj implements the #AccessibleTable interface,
632 Accessible_isTable (Accessible *obj)
639 * @obj: a pointer to the #Accessible instance to query.
641 * Query whether the specified #Accessible implements #AccessibleText.
642 * Not Yet Implemented.
644 * Returns: #TRUE if @obj implements the #AccessibleText interface,
648 Accessible_isText (Accessible *obj)
654 * Accessible_getAction:
656 * Not Yet Implemented.
660 Accessible_getAction (Accessible *obj)
666 * Accessible_getComponent:
667 * @obj: a pointer to the #Accessible instance to query.
669 * Get the #AccessibleComponent interface for an #Accessible.
671 * Returns: a pointer to an #AccessibleComponent interface instance, or
672 * NULL if @obj does not implement #AccessibleComponent.
674 AccessibleComponent *
675 Accessible_getComponent (Accessible *obj)
677 AccessibleComponent iface =
678 Accessibility_Accessible_queryInterface (*obj,
679 "IDL:Accessibility/Component:1.0",
681 return Obj_Add (iface);
685 * Accessible_queryInterface:
686 * @obj: a pointer to the #Accessible instance to query.
687 * @interface_name: a UTF-8 character string specifiying the requested interface.
689 * Query an #Accessible object to for a named interface.
691 * Returns: an instance of the named interface object, if it is implemented
692 * by @obj, or NULL otherwise.
696 Accessible_queryInterface (Accessible *obj, char *interface_name)
698 GenericInterface iface;
699 iface = Accessibility_Accessible_queryInterface (*obj,
702 return (iface != NULL) ? Obj_Add (iface) : NULL;
707 * AccessibleApplication function prototypes
712 * AccessibleApplication_ref:
713 * @obj: a pointer to the #AccessibleApplication on which to operate.
715 * Increment the reference count for an #AccessibleApplication.
717 * Returns: (no return code implemented yet).
721 AccessibleApplication_ref (AccessibleApplication *obj)
723 Accessibility_Application_ref (*obj, &ev);
728 * AccessibleApplication_unref:
729 * @obj: a pointer to the #AccessibleApplication object on which to operate.
731 * Decrement the reference count for an #AccessibleApplication.
733 * Returns: (no return code implemented yet).
737 AccessibleApplication_unref (AccessibleApplication *obj)
739 Accessibility_Application_unref (*obj, &ev);
744 * AccessibleApplication_getToolkitName:
745 * @obj: a pointer to the #AccessibleApplication to query.
747 * Get the name of the UI toolkit used by an #AccessibleApplication.
749 * Returns: a UTF-8 string indicating which UI toolkit is
750 * used by an application.
754 AccessibleApplication_getToolkitName (AccessibleApplication *obj)
756 return Accessibility_Application__get_toolkitName (*obj, &ev);
760 * AccessibleApplication_getVersion:
761 * @obj: a pointer to the #AccessibleApplication being queried.
763 * Get the version of the at-spi bridge exported by an
764 * #AccessibleApplication instance.
766 * Returns: a UTF-8 string indicating the application's
771 AccessibleApplication_getVersion (AccessibleApplication *obj)
773 return Accessibility_Application__get_version (*obj, &ev);
777 * AccessibleApplication_getID:
778 * @obj: a pointer to the #AccessibleApplication being queried.
780 * Get the unique ID assigned by the Registry to an
781 * #AccessibleApplication instance.
782 * (Not Yet Implemented by the registry).
784 * Returns: a unique #long integer associated with the application
785 * by the Registry, or 0 if the application is not registered.
787 AccessibleApplication_getID (AccessibleApplication *obj)
789 return Accessibility_Application__get_id (*obj, &ev);
793 * AccessibleApplication_pause:
795 * Attempt to pause the application (used when client event queue is
797 * Not Yet Implemented.
799 * Returns: #TRUE if the application was paused successfully, #FALSE otherwise.
803 AccessibleApplication_pause (AccessibleApplication *obj)
809 * AccessibleApplication_resume:
811 * Attempt to resume the application (used after #AccessibleApplication_pause).
812 * Not Yet Implemented.
814 * Returns: #TRUE if application processing resumed successfully, #FALSE otherwise.
818 AccessibleApplication_resume (AccessibleApplication *obj)
825 * AccessibleComponent function implementations
830 * AccessibleComponent_ref:
831 * @obj: a pointer to an object implementing #AccessibleComponent on which to operate.
833 * Increment the reference count for an #AccessibleComponent.
835 * Returns: (no return code implemented yet).
839 AccessibleComponent_ref (AccessibleComponent *obj)
841 Accessibility_Component_ref (*obj, &ev);
846 * AccessibleComponent_unref:
847 * @obj: a pointer to the object implementing #AccessibleComponent on which to operate.
849 * Decrement the reference count for an #AccessibleComponent.
851 * Returns: (no return code implemented yet).
855 AccessibleComponent_unref (AccessibleComponent *obj)
857 Accessibility_Component_unref (*obj, &ev);
862 * AccessibleComponent_contains:
863 * @obj: a pointer to the #AccessibleComponent to query.
864 * @x: a #long specifying the x coordinate in question.
865 * @y: a #long specifying the y coordinate in question.
866 * @ctype: the desired coordinate system of the point (@x, @y)
867 * (e.g. COORD_TYPE_WINDOW, COORD_TYPE_SCREEN).
869 * Query whether a given #AccessibleComponent contains a particular point.
873 AccessibleComponent_contains (AccessibleComponent *obj,
876 AccessibleCoordType ctype)
878 return Accessibility_Component_contains (*obj,
886 * AccessibleComponent_getAccessibleAtPoint:
887 * @obj: a pointer to the #AccessibleComponent to query.
888 * @x: a #long specifying the x coordinate of the point in question.
889 * @y: a #long specifying the y coordinate of the point in question.
890 * @ctype: the coordinate system of the point (@x, @y)
891 * (e.g. COORD_TYPE_WINDOW, COORD_TYPE_SCREEN).
893 * Get the accessible child at a given coordinate within an #AccessibleComponent.
895 * Returns: a pointer to an #Accessible child of the specified component which
896 * contains the point (@x, @y), or NULL of no child contains the point.
899 AccessibleComponent_getAccessibleAtPoint (AccessibleComponent *obj,
902 AccessibleCoordType ctype)
905 child = Accessibility_Component_getAccessibleAtPoint(*obj,
910 return (child != NULL) ? Obj_Add (child) : NULL;
914 * AccessibleComponent_getExtents:
915 * @obj: a pointer to the #AccessibleComponent to query.
916 * @x: a pointer to a #long into which the minimum x coordinate will be returned.
917 * @y: a pointer to a #long into which the minimum y coordinate will be returned.
918 * @width: a pointer to a #long into which the x extents (width) will be returned.
919 * @height: a pointer to a #long into which the y extents (height) will be returned.
920 * @ctype: the desired coordinate system into which to return the results,
921 * (e.g. COORD_TYPE_WINDOW, COORD_TYPE_SCREEN).
923 * Get the bounding box of the specified #AccessibleComponent.
927 AccessibleComponent_getExtents (AccessibleComponent *obj,
932 AccessibleCoordType ctype)
934 /* TODO: remove assumption that CORBA_long == long in typecast */
935 Accessibility_Component_getExtents (*obj,
938 (CORBA_long *) width,
939 (CORBA_long *) height,
945 * AccessibleComponent_getPosition:
946 * @obj: a pointer to the #AccessibleComponent to query.
947 * @x: a pointer to a #long into which the minimum x coordinate will be returned.
948 * @y: a pointer to a #long into which the minimum y coordinate will be returned.
949 * @ctype: the desired coordinate system into which to return the results,
950 * (e.g. COORD_TYPE_WINDOW, COORD_TYPE_SCREEN).
952 * Get the minimum x and y coordinates of the specified #AccessibleComponent.
956 AccessibleComponent_getPosition (AccessibleComponent *obj,
959 AccessibleCoordType ctype)
961 Accessibility_Component_getPosition (*obj,
969 * AccessibleComponent_getSize:
970 * @obj: a pointer to the #AccessibleComponent to query.
971 * @width: a pointer to a #long into which the x extents (width) will be returned.
972 * @height: a pointer to a #long into which the y extents (height) will be returned.
974 * Get the size of the specified #AccessibleComponent.
978 AccessibleComponent_getSize (AccessibleComponent *obj,
982 Accessibility_Component_getSize (*obj,
983 (CORBA_long *) width,
984 (CORBA_long *) height,
988 /* Not Yet Implemented */
990 AccessibleComponent_grabFocus (AccessibleComponent *obj)