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 event type.
15 * @callback: a character string indicating the type of events for which
16 * notification is requested. Format is
17 * EventClass:major_type:minor_type:detail
18 * where all subfields other than EventClass are optional.
19 * EventClasses include "Focus", "Window", "Mouse",
20 * and toolkit events (e.g. "Gtk", "AWT").
21 * Examples: "focus:", "Gtk:GtkWidget:button_press_event".
23 * NOTE: this string may be UTF-8, but should not contain byte value 56 (ascii ':'),
24 * except as a delimiter, since non-UTF-8 string delimiting
25 * functions are used internally. In general, listening to
26 * toolkit-specific events is not recommended.
28 * Add an in-process callback function to an existing AccessibleEventListener.
30 * Returns: #TRUE if successful, otherwise #FALSE.
34 registerGlobalEventListener (AccessibleEventListener *listener,
37 Accessibility_Registry_registerGlobalEventListener (
39 (Accessibility_EventListener)
40 bonobo_object_corba_objref (bonobo_object (listener)),
44 if (ev._major != CORBA_NO_EXCEPTION)
55 * deregisterGlobalEventListener:
56 * @listener: the #AccessibleEventListener to be registered against an event type.
58 * deregisters an AccessibleEventListener from the registry, for all event types it may be listening to.
60 * Returns: #TRUE if successful, otherwise #FALSE.
64 deregisterGlobalEventListenerAll (AccessibleEventListener *listener)
66 Accessibility_Registry_deregisterGlobalEventListenerAll (
68 (Accessibility_EventListener)
69 CORBA_Object_duplicate (bonobo_object_corba_objref (bonobo_object (listener)), &ev),
72 if (ev._major != CORBA_NO_EXCEPTION)
85 * Get the number of virtual desktops.
86 * NOTE: currently multiple virtual desktops are not implemented, this
87 * function always returns '1'.
89 * Returns: an integer indicating the number of active virtual desktops.
95 return Accessibility_Registry_getDesktopCount (registry, &ev);
100 * @i: an integer indicating which of the accessible desktops is to be returned.
102 * Get the virtual desktop indicated by index @i.
103 * NOTE: currently multiple virtual desktops are not implemented, this
104 * function always returns '1'.
106 * Returns: a pointer to the 'i-th' virtual desktop's #Accessible representation.
112 return Obj_Add (Accessibility_Registry_getDesktop (registry, (CORBA_short) n, &ev));
117 * @list: a pointer to an array of #Accessible objects.
119 * Get the list of virtual desktops. On return, @list will point
120 * to a newly-created array of virtual desktop pointers.
121 * It is the responsibility of the caller to free this array when
122 * it is no longer needed.
124 * Not Yet Implemented.
126 * Returns: an integer indicating how many virtual desktops have been
127 * placed in the list pointed to by parameter @list.
130 getDesktopList (Accessible **list)
137 key_event_source_func (void *p)
139 GList *listeners = (GList *)p;
140 XEvent *x_event = g_new0 (XEvent, 1);
141 while (XPending (display))
143 XNextEvent (display, x_event);
146 /* if the listener mask matches, notify it*/
157 * registerAccessibleKeystrokeListener:
158 * @listener: a pointer to the #AccessibleKeystrokeListener for which
159 * keystroke events are requested.
163 registerAccessibleKeystrokeListener (AccessibleKeystrokeListener *listener,
164 AccessibleKeySet *keys,
165 AccessibleKeyMaskType modmask,
166 AccessibleKeyEventMask eventmask,
167 AccessibleKeyListenerSyncType sync_type)
169 Accessibility_ControllerEventMask *controller_event_mask =
170 Accessibility_ControllerEventMask__alloc();
171 Accessibility_DeviceEventController device_event_controller =
172 Accessibility_Registry_getDeviceEventController (registry, &ev);
173 Accessibility_KeySet *all_keys = Accessibility_KeySet__alloc();
174 Accessibility_KeyEventTypeSeq *key_events = Accessibility_KeyEventTypeSeq__alloc();
175 Accessibility_KeystrokeListener spi_listener_corba_ref;
176 Accessibility_DeviceEventController_ref (device_event_controller, &ev);
177 controller_event_mask->value = (CORBA_unsigned_long) modmask;
178 controller_event_mask->refcount = (CORBA_unsigned_short) 1;
180 spi_listener_corba_ref = (Accessibility_KeystrokeListener)
181 CORBA_Object_duplicate (bonobo_object_corba_objref (bonobo_object (listener)), &ev);
183 Accessibility_DeviceEventController_registerKeystrokeListener (
184 device_event_controller,
185 spi_listener_corba_ref,
187 controller_event_mask,
189 (CORBA_boolean) ((sync_type | SPI_KEYLISTENER_ALL_WINDOWS)!=0),
194 * deregisterAccessibleKeystrokeListener:
195 * @listener: a pointer to the #AccessibleKeystrokeListener for which
196 * keystroke events are requested.
200 deregisterAccessibleKeystrokeListener (AccessibleKeystrokeListener *listener, AccessibleKeyMaskType keymask)
202 Accessibility_ControllerEventMask *controller_event_mask =
203 Accessibility_ControllerEventMask__alloc();
204 Accessibility_DeviceEventController device_event_controller =
205 Accessibility_Registry_getDeviceEventController (registry, &ev);
206 Accessibility_KeySet *all_keys = Accessibility_KeySet__alloc();
207 Accessibility_KeyEventTypeSeq *key_events = Accessibility_KeyEventTypeSeq__alloc();
208 Accessibility_KeystrokeListener spi_listener_corba_ref;
209 Accessibility_DeviceEventController_unref (device_event_controller, &ev);
210 controller_event_mask->value = (CORBA_unsigned_long) keymask;
211 controller_event_mask->refcount = (CORBA_unsigned_short) 1;
213 spi_listener_corba_ref = (Accessibility_KeystrokeListener)
214 CORBA_Object_duplicate (bonobo_object_corba_objref (bonobo_object (listener)), &ev);
216 Accessibility_DeviceEventController_deregisterKeystrokeListener (
217 device_event_controller,
218 spi_listener_corba_ref,
220 controller_event_mask,
222 (CORBA_boolean) TRUE,
228 * @keycode: a #long indicating the keycode of the key event
230 * @meta: a #long indicating the key modifiers to be sent
231 * with the event, if any.
233 * Synthesize a keyboard event (as if a hardware keyboard event occurred in the
234 * current UI context).
235 * Not Yet Implemented.
239 generateKeyEvent (long keyval, AccessibleKeySynthType type)
241 /* TODO: check current modifier status and
242 * send keycode to alter, if necessary
244 Accessibility_DeviceEventController device_event_controller =
245 Accessibility_Registry_getDeviceEventController (registry, &ev);
246 Accessibility_DeviceEventController_generateKeyEvent (device_event_controller,
248 (unsigned long) type,
253 * generateMouseEvent:
254 * @x: a #long indicating the screen x coordinate of the mouse event.
255 * @y: a #long indicating the screen y coordinate of the mouse event.
256 * @name: a string indicating which mouse event to be synthesized
257 * (e.g. "button1", "button2", "mousemove").
259 * Synthesize a mouse event at a specific screen coordinate.
260 * Not Yet Implemented.
264 generateMouseEvent (long x, long y, char *name)