4 * Global functions serviced by the registry
8 /* static stuff used only by registry C bindings */
9 static GList *key_listeners = NULL;
10 static Display *display = NULL;
13 * registerGlobalEventListener:
14 * @listener: the #AccessibleEventListener to be registered against an
16 * @eventType: a character string indicating the type of events for which
17 * notification is requested. Format is
18 * EventClass:major_type:minor_type:detail
19 * where all subfields other than EventClass are optional.
20 * EventClasses include "object", "window", "mouse",
21 * and toolkit events (e.g. "Gtk", "AWT").
22 * Examples: "focus:", "Gtk:GtkWidget:button_press_event".
24 * Legal object event types:
26 * (property change events)
28 * object:property-change
29 * object:property-change:accessible-name
30 * object:property-change:accessible-state
31 * object:property-change:accessible-description
32 * object:property-change:accessible-parent
33 * object:property-change:accessible-value
34 * object:property-change:accessible-role
35 * object:property-change:accessible-table-caption
36 * object:property-change:accessible-table-column-description
37 * object:property-change:accessible-table-column-header
38 * object:property-change:accessible-table-row-description
39 * object:property-change:accessible-table-row-header
40 * object:property-change:accessible-table-summary
42 * (other object events)
44 * object:children-changed
45 * object:visible-data-changed
46 * object:selection-changed
47 * object:text-selection-changed
49 * object:text-caret-moved
51 * object:row-reordered
53 * object:column-inserted
54 * object:column-reordered
55 * object:column-deleted
56 * object:model-changed
58 * NOTE: this string may be UTF-8, but should not contain byte value 56
59 * (ascii ':'), except as a delimiter, since non-UTF-8 string
60 * delimiting functions are used internally.
61 * In general, listening to
62 * toolkit-specific events is not recommended.
64 * Add an in-process callback function to an existing AccessibleEventListener.
66 * Returns: #TRUE if successful, otherwise #FALSE.
70 registerGlobalEventListener (AccessibleEventListener *listener,
73 Accessibility_Registry_registerGlobalEventListener (
75 (Accessibility_EventListener)
76 bonobo_object_corba_objref (bonobo_object (listener)),
80 if (ev._major != CORBA_NO_EXCEPTION)
91 * deregisterGlobalEventListenerAll:
92 * @listener: the #AccessibleEventListener to be registered against
95 * deregisters an AccessibleEventListener from the registry, for all
96 * event types it may be listening to.
98 * Returns: #TRUE if successful, otherwise #FALSE.
102 deregisterGlobalEventListenerAll (AccessibleEventListener *listener)
104 Accessibility_Registry_deregisterGlobalEventListenerAll (
106 (Accessibility_EventListener)
107 CORBA_Object_duplicate (
108 bonobo_object_corba_objref (
109 bonobo_object (listener)), &ev),
112 if (ev._major != CORBA_NO_EXCEPTION)
122 * deregisterGlobalEventListener:
123 * @listener: the #AccessibleEventListener registered against an event type.
124 * @eventType: a string specifying the event type for which this
125 * listener is to be deregistered.
127 * deregisters an AccessibleEventListener from the registry, for a specific
130 * Returns: #TRUE if successful, otherwise #FALSE.
134 deregisterGlobalEventListener (AccessibleEventListener *listener,
137 Accessibility_Registry_deregisterGlobalEventListener (
139 (Accessibility_EventListener)
140 CORBA_Object_duplicate (
141 bonobo_object_corba_objref (bonobo_object (listener)), &ev),
142 (CORBA_char *) eventType,
145 if (ev._major != CORBA_NO_EXCEPTION)
158 * Get the number of virtual desktops.
159 * NOTE: currently multiple virtual desktops are not implemented, this
160 * function always returns '1'.
162 * Returns: an integer indicating the number of active virtual desktops.
168 return Accessibility_Registry_getDesktopCount (registry, &ev);
173 * @i: an integer indicating which of the accessible desktops is to be returned.
175 * Get the virtual desktop indicated by index @i.
176 * NOTE: currently multiple virtual desktops are not implemented, this
177 * function always returns '1'.
179 * Returns: a pointer to the 'i-th' virtual desktop's #Accessible representation.
185 return Obj_Add (Accessibility_Registry_getDesktop (registry, (CORBA_short) i, &ev));
190 * @list: a pointer to an array of #Accessible objects.
192 * Get the list of virtual desktops. On return, @list will point
193 * to a newly-created array of virtual desktop pointers.
194 * It is the responsibility of the caller to free this array when
195 * it is no longer needed.
197 * Not Yet Implemented : this implementation always returns a single
198 * #Accessible desktop.
200 * Returns: an integer indicating how many virtual desktops have been
201 * placed in the list pointed to by parameter @list.
204 getDesktopList (Accessible **list)
211 key_event_source_func (void *p)
213 GList *listeners = (GList *)p;
214 XEvent *x_event = g_new0 (XEvent, 1);
215 while (XPending (display))
217 XNextEvent (display, x_event);
220 /* if the listener mask matches, notify it*/
231 * registerAccessibleKeystrokeListener:
232 * @listener: a pointer to the #AccessibleKeystrokeListener for which
233 * keystroke events are requested.
234 * @keys: a pointer to the #AccessibleKeySet indicating which
235 * keystroke events are requested, or #SPI_KEYSET_ALL_KEYS.
236 * @modmask: an #AccessibleKeyMaskType mask indicating which
237 * key event modifiers must be set in combination with @keys,
238 * events will only be reported for key events for which all
239 * modifiers in @modmask are set. If you wish to listen for
240 * events with multiple modifier combinations you must call
241 * registerAccessibleKeystrokeListener() once for each combination.
242 * @eventmask: an #AccessibleKeyMaskType mask indicating which
243 * types of key events are requested (#SPI_KEY_PRESSED, etc.).
244 * @sync_type: a #AccessibleKeyListenerSyncType parameter indicating
245 * the behavior of the notification/listener transaction.
247 * Register a listener for keystroke events, either pre-emptively for
248 * all windows (SPI_KEYLISTENER_ALL_WINDOWS), or
249 * non-preemptively (SPI_KEYLISTENER_NOSYNC).
250 * ( Other sync_type values may be available in the future.)
253 registerAccessibleKeystrokeListener (AccessibleKeystrokeListener *listener,
254 AccessibleKeySet *keys,
255 AccessibleKeyMaskType modmask,
256 AccessibleKeyEventMask eventmask,
257 AccessibleKeyListenerSyncType sync_type)
259 Accessibility_ControllerEventMask *controller_event_mask =
260 Accessibility_ControllerEventMask__alloc();
261 Accessibility_DeviceEventController device_event_controller =
262 Accessibility_Registry_getDeviceEventController (registry, &ev);
263 Accessibility_KeySet *all_keys = Accessibility_KeySet__alloc();
264 Accessibility_KeyEventTypeSeq *key_events = Accessibility_KeyEventTypeSeq__alloc();
265 Accessibility_KeystrokeListener spi_listener_corba_ref;
266 Accessibility_DeviceEventController_ref (device_event_controller, &ev);
267 controller_event_mask->value = (CORBA_unsigned_long) modmask;
268 controller_event_mask->refcount = (CORBA_unsigned_short) 1;
270 spi_listener_corba_ref = (Accessibility_KeystrokeListener)
271 CORBA_Object_duplicate (bonobo_object_corba_objref (bonobo_object (listener)), &ev);
273 Accessibility_DeviceEventController_registerKeystrokeListener (
274 device_event_controller,
275 spi_listener_corba_ref,
277 controller_event_mask,
279 (CORBA_boolean) ((sync_type | SPI_KEYLISTENER_ALL_WINDOWS)!=0),
284 * deregisterAccessibleKeystrokeListener:
285 * @listener: a pointer to the #AccessibleKeystrokeListener for which
286 * keystroke events are requested.
287 * @modmask: the key modifier mask for which this listener is to be
288 * 'deregistered' (of type #AccessibleeyMaskType).
290 * Removes a keystroke event listener from the registry's listener queue,
291 * ceasing notification of events with modifiers matching @modmask.
294 deregisterAccessibleKeystrokeListener (AccessibleKeystrokeListener *listener,
295 AccessibleKeyMaskType modmask)
297 Accessibility_ControllerEventMask *controller_event_mask =
298 Accessibility_ControllerEventMask__alloc();
299 Accessibility_DeviceEventController device_event_controller =
300 Accessibility_Registry_getDeviceEventController (registry, &ev);
301 Accessibility_KeySet *all_keys = Accessibility_KeySet__alloc();
302 Accessibility_KeyEventTypeSeq *key_events = Accessibility_KeyEventTypeSeq__alloc();
303 Accessibility_KeystrokeListener spi_listener_corba_ref;
304 Accessibility_DeviceEventController_unref (device_event_controller, &ev);
305 controller_event_mask->value = (CORBA_unsigned_long) modmask;
306 controller_event_mask->refcount = (CORBA_unsigned_short) 1;
308 spi_listener_corba_ref = (Accessibility_KeystrokeListener)
309 CORBA_Object_duplicate (bonobo_object_corba_objref (bonobo_object (listener)), &ev);
311 Accessibility_DeviceEventController_deregisterKeystrokeListener (
312 device_event_controller,
313 spi_listener_corba_ref,
315 controller_event_mask,
317 (CORBA_boolean) TRUE,
323 * @keyval: a long integer indicating the keycode or keysym of the key event
325 * @synth_type: a #AccessibleKeySynthType flag indicating whether @keyval
326 * is to be interpreted as a keysym rather than a keycode
327 * (SPI_KEYSYM), or whether to synthesize
328 * SPI_KEY_PRESS, SPI_KEY_RELEASE, or both (SPI_KEY_PRESSRELEASE).
330 * Synthesize a keyboard event (as if a hardware keyboard event occurred in the
331 * current UI context).
335 generateKeyEvent (long int keyval, AccessibleKeySynthType synth_type)
337 /* TODO: check current modifier status and
338 * send keycode to alter, if necessary
340 Accessibility_DeviceEventController device_event_controller =
341 Accessibility_Registry_getDeviceEventController (registry, &ev);
342 Accessibility_DeviceEventController_generateKeyEvent (device_event_controller,
344 (unsigned long) synth_type,
349 * generateMouseEvent:
350 * @x: a #long indicating the screen x coordinate of the mouse event.
351 * @y: a #long indicating the screen y coordinate of the mouse event.
352 * @name: a string indicating which mouse event to be synthesized
353 * (e.g. "button1", "button2", "mousemove").
355 * Synthesize a mouse event at a specific screen coordinate.
356 * Most AT clients should use the #AccessibleAction interface when
357 * tempted to generate mouse events, rather than this method.
358 * Not Yet Implemented.
362 generateMouseEvent (long x, long y, char *name)