2 * AT-SPI - Assistive Technology Service Provider Interface
3 * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
5 * Copyright 2001 Sun Microsystems Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
23 #include <Accessibility_Event.idl>
24 #include <Accessibility_Application.idl>
25 #include <Accessibility_Desktop.idl>
27 #ifndef _ACCESSIBILITY_REGISTRY_IDL_
28 #define _ACCESSIBILITY_REGISTRY_IDL_
30 module Accessibility {
32 typedef sequence<Desktop> DesktopSeq;
34 interface DeviceEventController;
37 * The Registry is a service through which applications providing
38 * accessibility services (servers) can rendezvous with consumers of those
39 * services (Assistive Technologies). The Registry is the first "port of call" for
40 * accessible applications and for assistive technologies wishing to query and
41 * interact with those applications.
43 * The Registry service provides four basic functions to Assistive Technology (AT) clients:
44 * \li it provides a list of the applications who have registered with the AT-SPI
45 * framework, thereby announcing their participation in the AT-SPI framework;
46 * \li it allows AT clients to register for notification of changes in application
47 * state (at-spi Events);
48 * \li it dispatches/relays said events from participating applications to
49 * the registered listeners;
50 * \li it gives access to system device events via the associated DeviceEventController
53 * From the point of view of accessible applications (i.e. AT-SPI service producers),
54 * the Registry is primarily a registration and event delivery service. Applications
55 * normally only call the registerApplication and deregisterApplication Registry methods,
56 * and its inherited EventListener::notifyEvent method.
58 * @note Although all application events are dispatched via the Registry, other AT client
59 * calls are serviced directly by the applications, rather than being relayed via the
60 * Registry. The AT client obtains references to these application objects
61 * via the enumeration of Desktop instances whose children are Application instances
62 * (Registry::getDesktopList) and via examination of the 'source' member of the Event
65 * The Registry normally lives in its own process space; communication via Registry and
66 * both application services and AT clients takes place via IPC. A process space diagram
67 * illustrating the relationship between applications, Registry, and AT is shown below.
68 * @image html "http://developer.gnome.org/projects/gap/tech-docs/SPIBlockDiagram.png"
71 * @see Desktop, Application, Event, EventListener
73 interface Registry : EventListener {
76 * Register a new application with the accessibility broker.
77 * @param application: a reference to the requesting Application
79 oneway void registerApplication (in Application application);
82 * De-register an application previously registered with the broker.
83 * deregisterApplication:
84 * @param application: a reference to the Application
87 void deregisterApplication (in Application application);
90 * Register a client's interest in (all) application events of
92 * @param listener: a reference to the requesting ::EventListener.
93 * @param eventName: a string which indicates the type of events about
94 * which the client desires notification.
96 void registerGlobalEventListener (in EventListener listener,
100 * deregisterGlobalEventListenerAll:
101 * @param listener: the requesting EventListener
103 * Request that a previously registered client stop receiving
104 * global notifications for all events for which it was registered.
107 void deregisterGlobalEventListenerAll (in EventListener listener);
110 * deregisterGlobalEventListener:
111 * @param listener: the requesting EventListener
112 * @param eventName: a string indicating the type of events
114 * Request that a previously registered client stop receiving
115 * global notifications for events of a certain type.
118 void deregisterGlobalEventListener (in EventListener listener,
119 in string eventName);
121 * event types: "Window" "Desktop"
122 * "Window:Create" "Window:Destroy"
123 * "Window:Iconify" "Window:Restore"
124 * "Window:Fullscreen" "Window:Resize"
125 * "Desktop:Create" "Desktop:Destroy"
126 * "Desktop:Focus" "Desktop:Defocus"
130 * "GObject:notify:<propertyname>"
132 * ( not sure we should allow these last 2 forms,
133 * since they are toolkit-specific, but they're powerful )
140 * Get the current number of desktops.
141 * @returns a short integer indicating the current number of
144 short getDesktopCount ();
148 * @n: the index of the requested Desktop.
150 * Get the nth accessible desktop.
152 * @returns a reference to the requested Desktop.
154 Desktop getDesktop (in short n);
157 * Get a list of accessible desktops.
159 * @returns: a sequence containing references to
162 DesktopSeq getDesktopList ();
165 * Obtain an object which can be used to request device event notifications.
167 * @returns: an object implementing DeviceEventController
169 DeviceEventController getDeviceEventController ();
174 * placeholders for future expansion.
176 void unImplemented ();
177 void unImplemented2 ();
178 void unImplemented3 ();
179 void unImplemented4 ();
180 void unImplemented5 ();
181 void unImplemented6 ();
185 /** Deprecated, DO NOT USE! */
191 /** Used to specify the event types of interest to an EventListener, or
192 * to identify the type of an event for which notification has been sent.
193 * @see EventTypeSeq, DeviceEvent::type
196 KEY_PRESSED_EVENT, /**< key on a keyboard device was pressed. */
197 KEY_RELEASED_EVENT, /**< key on a keyboard device was released. */
198 BUTTON_PRESSED_EVENT,/**< button on a non-keyboard human interface device
199 * (HID) was pressed */
200 BUTTON_RELEASED_EVENT /**< button on a non-keyboard human interface device
201 * (HID) was pressed */
204 /** Used when synthesizing keyboard input via DeviceEventController:generateKeyboardEvent.*/
206 KEY_PRESS,/** emulate the pressing of a hardware keyboard key. */
207 KEY_RELEASE,/** emulate the release of a hardware keyboard key. */
208 KEY_PRESSRELEASE,/** a hardware keyboard key is pressed and immediately released. */
209 KEY_SYM,/** a symbolic key event is generated, without specifying a hardware key.
210 * @note if the keysym is not present in the current keyboard map,
211 * the DeviceEventController instance has a limited ability to generate
212 * such keysyms on-the-fly. Reliability of generateKeyboardEvent calls
213 * using out-of-keymap keysyms will vary from system to system, and on the
214 * number of different out-of-keymap being generated in quick succession.
215 * In practice this is rarely significant, since the keysyms of interest to
216 * AT clients and keyboard emulators are usually part of the current keymap, i.e.
217 * present on the system keyboard for the current locale (even if a physical
218 * hardware keyboard is not connected.
220 KEY_STRING /** a string is converted to its equivalent keyboard events and emitted.
221 * If the string consists of complex character or composed characters
222 * which are not in the current keymap, string emission is subject to the
223 * out-of-keymap limitations described for KeySynthType::KEY_SYM.
224 * In practice this limitation primarily effects Chinese and Japanese locales.
229 MODIFIER_SHIFT, /** The left or right 'Shift' key */
230 MODIFIER_SHIFTLOCK, /** The ShiftLock or CapsLock key */
231 MODIFIER_CONTROL,/** 'Control'/'Ctrl' */
232 MODIFIER_ALT,/** The Alt key (as opposed to AltGr) */
233 MODIFIER_META,/** depending on the platform this may map to 'Window', 'Function', 'Meta',
234 * 'Menu', or 'NumLock'.
235 * Such 'Meta keys' will map to one of META, META2, META3.
236 * On X Windows platforms these META values map to
237 * the modifier masks Mod1Mask, Mod2Mask, Mod3Mask, e.g. an event having
238 * ModifierType::MODIFIER_META2 means that the 'Mod2Mask' bit is
239 * set in the corresponding XEvent.
243 MODIFIER_NUMLOCK/** A symbolic meta key name that is mapped by AT-SPI to the
244 * appropriate META value, for the convenience of the client.
248 /** A structure that encapsulates the characteristics of the event notifications
249 * that should be sent to an EventListener in response to a call to
250 * DeviceEventController::registerKeystrokeListener or
251 * DeviceEventController::registerDeviceEventListener. */
252 struct EventListenerMode {
253 boolean synchronous; /**< If \c True, specifies that
254 * DeviceEventController should block while waiting
255 * for client to process the requested event notifications;
256 * ordinarily should be used only when client needs to perform
257 * operations synchronously with event delivery. Note that because
258 * of the architecture of device event systems in general,
259 * use of this flag may not block delivery of the event to
260 * the currently focussed application unless it is used in
261 * conjunction with the preemptive flag. */
262 boolean preemptive; /**< If \c True, specifies that
263 * Listener is allowed to pre-empt the delivery of the event,
264 * effectively "consuming" it such that it is not delivered
265 * to the currently focussed desktop application.
266 * Key events consumed via this API will not be
267 * available for use by other applications or services, so this
268 * option should be used sparingly. */
269 boolean global; /**< If \c True, specifies that
270 * Event notifications should be sent regardless of whether the
271 * currently focussed application participates in the AT-SPI
272 * infrastructure. On systems with the XEvIE X extension, this flag
273 * also allows access to events which are already subject to
274 * interception via a "system keygrab" (as described in the X Window System
275 * documentation for XGrabKey). The 'global' and 'preemptive' flags
276 * should only be used together for the purposes of registering
277 * "system global key shortcuts" i.e. command keys for use by the
278 * assistive technology. */
282 * an unsigned short int consisting of zero or more of the following
283 * values OR'ed together:
285 * \li \c 1<<::KEY_PRESSED_EVENT = 1
286 * \li \c 1<<::KEY_RELEASED_EVENT = 2
287 * \li \c 1<<::BUTTON_PRESSED_EVENT = 3,
288 * \li \c 1<<::BUTTON_RELEASED_EVENT = 4
290 typedef unsigned long ControllerEventMask;
292 /** A structure which encapsulates information about a device event. */
294 EventType type; /**< Identifies the type of the containing DeviceEvent. */
295 long id; /**< an identifier which identifies this event in the event stream.
296 * On X Window systems this corresponds to the XEvent serial number.
298 short hw_code; /**< a numeric code which is hardware and system-dependent, identifying the
299 * specific hardware button or key on the device for which the event has
300 * occurred. On X Window systems, for global key notifications and for most
301 * non-global key notifications as well, this code corresponds to the
302 * XKeycode. For switch and button events it indicates the switch
305 * For technical reasons, this code may differ from the XKeycode
306 * when generated by Java applications for consumption by non-global
307 * key listeners. This is subject to change in future versions of the
308 * DeviceEventController implementation.
311 unsigned short modifiers; /**< an unsigned short int consisting of zero or more of the following
312 * values OR'ed together:
313 * \li \c 1<<::MODIFIER_SHIFT (=1, corresponds to Xlib's ShiftMask)
314 * \li \c 1<<::MODIFIER_SHIFTLOCK (=2, corresponds to Xlib's LockMask)
315 * \li \c 1<<::MODIFIER_CONTROL (=4, corresponds to Xlib's ControlMask)
316 * \li \c 1<<::MODIFIER_ALT (=8, corresponds to Xlib's Mod1Mask)
317 * \li \c 1<<::MODIFIER_META (=16, corresponds to Xlib's Mod2Mask)
318 * \li \c 1<<::MODIFIER_META2 (=32, corresponds to Xlib's Mod3Mask)
319 * \li \c 1<<::MODIFIER_META3 (=64, corresponds to Xlib's Mod4Mask)
321 unsigned long timestamp; /**< an unsigned integer representing the time that the
322 * event occurred. On X Window systems this event is
323 * a time in milliseconds from some arbitrary starting
324 * point; it therefore has a cycle time of approximately
327 string event_string; /**< A string representation of the event. If is_text is
328 * \c True, then this string represents the character or typographic
329 * sequence that would be received by a focussed text input field.
330 * event_string is in general suitable for exposure to the
331 * end-user for purposes of keyboard echo.
333 boolean is_text; /**< \c True if the event results in the insertion of characters
334 * into an input text buffer, or would do so if delivered to a focussed
335 * text input field. ¨Typographical¨ key events have this field set to
336 * \c True, whereas ¨control¨ key events generally do not.
341 * A structure which defines the identity of a key for which notifications
342 * are to be requested. The data in the members of a ::KeyDefinition are used to
343 * determine which keyboard events 'match' the notification request filed by a client.
345 * @note Ordinarily a KeyDefinition specifies one and only one of the criteria below;
346 * the result of using a KeyDefinition with multiple members defined as nonzero is
349 * @param keycode if nonzero, the numeric, system-dependent value corresponding to a
350 * physical key on the keyboard. Keycode values have no semantic meaning to the end-user,
351 * and may depend on the user's hardware and operating environment. They therefore are
352 * rarely useful "as-is" to AT clients, unless the client has used operating system
353 * services to identify the hardward keycode associated with a particular key symbol.
354 * Notifications for key events requested by keycode are less dependent on modifier state
355 * than \c keysym based notifications, but some hardware (notably many laptops) may generate
356 * more than one keycode for the same physical key, depending on the state of physical
357 * shift/modifier keys.
358 * @param keysym if nonzero, the numeric value corresponding to the X Keysym of the key for which
359 * notification is requested. Note that the presence of active modifiers will affect
360 * whether notification for key events requested via "keysym" specification takes place,
361 * since the keysym depends on the modifier state for most keys.
362 * @param keystring if non-NULL, the string value of the inserted characters if the corresponding
363 * key event has ::KeyEvent:is_text set to \c True, or the string representing the
364 * 'name' of the key. On X11 systems, the string 'name' of non-printing keysyms corresponds
365 * to the values in "keysymdef.h" as provided by Xlib, with the leading "XK_" stripped off.
367 struct KeyDefinition {
374 typedef sequence< KeyDefinition > KeySet;
375 typedef sequence< EventType > KeyEventTypeSeq;
376 typedef sequence< EventType > EventTypeSeq;
378 /** This interface should be implemented by AT-SPI clients who wish to
379 * make use of the DeviceEventController to receive device event notifications.
380 * DeviceEvents include keyboard events and mouse button/motion events.
382 interface DeviceEventListener : Bonobo::Unknown {
383 /** Notify an interested DeviceEventListener that a DeviceEvent has occurred.
384 * @returns \c True if the recipient/consumer wishes to consume the event, i.e.
385 * prevent it from being delivered to the desktop, \c False if the event should
386 * continue to be delivered as normal.
388 boolean notifyEvent (in DeviceEvent event);
390 void unImplemented__ ();
391 void unImplemented_2_ ();
392 void unImplemented_3_ ();
393 void unImplemented_4_ ();
394 void unImplemented_5_ ();
395 void unImplemented_6_ ();
400 * The interface via which clients request notification of device events, and
401 * through which device events may be simulated.
403 interface DeviceEventController : Bonobo::Unknown {
406 * Register to intercept keyboard events, and either pass them on or
409 * @param listener: a DeviceEventListener which will intercept key events.
410 * @param keys: a KeySet indicating which keys to intercept, or KEYSET_ALL_KEYS.
411 * @param mask: a ControllerEventMask filtering the intercepted key events.
412 * @param type: a KeyEventTypeSeq that may created by ORing event types together.
413 * @param mode: an EventListenerMode indicating whether the listener should
414 * receive the events synchronously, potentially consuming them,
415 * or just be notified asynchronously of those events that have
417 * @note Some platforms have limited support for global, preemptive EventListenerMode.
418 * Such a registration may fail if another client already has priority for preemptive
419 * access to one or more of the members of the KeySet. AT consumers have the option
420 * of re-trying the request without the global flag, or without the preemptive flag,
421 * or of re-trying with a different KeySet. The best support for pre-emptive
422 * global keyboard listeners is provided on platforms whose Xserver implementation
423 * provides the XEvIE extension.
425 * @returns \c True if the DeviceEventListener was successfully registered
426 * for the requested KeySet, ControllerEventMask, event types, and EventListenerMode;
427 * otherwise returns \c False.
429 boolean registerKeystrokeListener (in DeviceEventListener listener,
431 in ControllerEventMask mask,
432 in KeyEventTypeSeq type,
433 in EventListenerMode mode);
436 * De-register a previously registered keyboard eventlistener.
437 * @param listener: a DeviceEventListener which will intercept key events.
438 * @param keys: a KeySet indicating which keys to intercept, or KEYSET_ALL_KEYS.
439 * @param mask: a ControllerEventMask filtering the intercepted key events.
440 * @param type: an EventType mask that may created by ORing event types together.
442 void deregisterKeystrokeListener (in DeviceEventListener listener,
444 in ControllerEventMask mask,
445 in KeyEventTypeSeq type);
448 * Register to intercept events, and either pass them on or
449 * consume them. To listen to keyboard events use registerKeystrokeListener
451 * @param listener: a DeviceEventListener which will intercept events.
452 * @param typeseq: an EventTypeSeq indicating which event types to listen for.
453 * @returns \c True if successful, \c False if not
455 boolean registerDeviceEventListener (in DeviceEventListener listener,
456 in EventTypeSeq typeseq);
459 * De-register a previously registered keyboard eventlistener.
460 * @param listener: a DeviceEventListener which will intercept events.
461 * @param typeseq: an EventTypeSeq indicating which event types to stop
464 void deregisterDeviceEventListener (in DeviceEventListener listener,
465 in EventTypeSeq typeseq);
468 * Notify the Registry instance that a device event has taken place, and
469 * allow pre-emptive listeners the opportunity to 'consume' the event
470 * and thus prevent its further issuance/forwarding. This is the
471 * method used by accessibility bridges to forward "toolkit dependent"
472 * device events to the Registry from the application's process space.
474 * @note AT clients do not normally need to use this method, it is intended for use
475 * by toolkit bridges and special-purpose applications.
477 * @returns \c True if the event was consumed by a (pre-emptive) listener,
478 * \c False if not (in which case the device event will be forwarded
479 * as normal to any application which would normally receive it, e.g.
480 * the currently active application in the case of mouse or keyboard events).
482 boolean notifyListenersSync (in DeviceEvent event);
485 * Notify the Registry instance that a device event has taken place in
486 * an asynchronous manner. This is the
487 * method used by accessibility bridges to forward "toolkit dependent"
488 * device events to the Registry from the application's process space.
489 * If the event in question is potentially pre-emptible.
490 * ::notifyListenersSync should be used instead.
492 * @note AT clients do not normally need to use this method, it is intended for use
493 * by toolkit bridges and special-purpose applications.
495 oneway void notifyListenersAsync (in DeviceEvent event);
498 * Synthesize a keyboard event.
499 * @param keycode: a long integer indicating the keycode of
500 * the keypress to be synthesized.
501 * @param keystring: an optional UTF-8 string indicating a complex
502 * keyboard input event.
503 * @param type: a KeySynthType indicating the type of event(s) to be
504 * synthesized: a key press, release, press-release pair,
505 * or a complex input string (for instance from an
506 * internationalized or complex text input method, or
507 * a composed character).
509 * @note keycode may be truncated before being
510 * processed, as keycode length may be platform-dependent
511 * and keycode ranges are generally much smaller than
513 * One or the other of keycode or keystring are generally NULL,
514 * (but not both), depending on the value of \c type.
517 void generateKeyboardEvent (in long keycode,
519 in KeySynthType type);
522 * Synthesize a mouse event.
523 * @param x: a long integer indicating the screen x coord for the mouse event.
524 * @param y: a long integer indicating the screen y coord for the mouse event.
525 * @param eventName: a string indicating the type of mouse event, e.g. "button1up"
527 void generateMouseEvent (in long x, in long y, in string eventName);
532 * placeholders for future expansion.
534 void unImplemented ();
535 void unImplemented2 ();
536 void unImplemented3 ();
537 void unImplemented4 ();