+static gboolean
+key_event_source_func (void *p)
+{
+ GList *listeners = (GList *)p;
+ XEvent *x_event = g_new0 (XEvent, 1);
+ while (XPending (display))
+ {
+ XNextEvent (display, x_event);
+ while (listeners)
+ {
+ /* if the listener mask matches, notify it*/
+ if (1)
+ {
+ ;
+ }
+ }
+ }
+ return TRUE;
+}
+
+/**
+ * registerAccessibleKeystrokeListener:
+ * @listener: a pointer to the #AccessibleKeystrokeListener for which
+ * keystroke events are requested.
+ * @keys: a pointer to the #AccessibleKeySet indicating which
+ * keystroke events are requested, or #SPI_KEYSET_ALL_KEYS.
+ * @modmask: an #AccessibleKeyMaskType mask indicating which
+ * key event modifiers must be set in combination with @keys,
+ * events will only be reported for key events for which all
+ * modifiers in @modmask are set. If you wish to listen for
+ * events with multiple modifier combinations you must call
+ * registerAccessibleKeystrokeListener() once for each combination.
+ * @eventmask: an #AccessibleKeyMaskType mask indicating which
+ * types of key events are requested (#SPI_KEY_PRESSED, etc.).
+ * @sync_type: a #AccessibleKeyListenerSyncType parameter indicating
+ * the behavior of the notification/listener transaction.
+ *
+ * Register a listener for keystroke events, either pre-emptively for
+ * all windows (SPI_KEYLISTENER_ALL_WINDOWS), or
+ * non-preemptively (SPI_KEYLISTENER_NOSYNC).
+ * ( Other sync_type values may be available in the future.)
+ **/
+void
+registerAccessibleKeystrokeListener (AccessibleKeystrokeListener *listener,
+ AccessibleKeySet *keys,
+ AccessibleKeyMaskType modmask,
+ AccessibleKeyEventMask eventmask,
+ AccessibleKeyListenerSyncType sync_type)
+{
+ Accessibility_ControllerEventMask *controller_event_mask =
+ Accessibility_ControllerEventMask__alloc();
+ Accessibility_DeviceEventController device_event_controller =
+ Accessibility_Registry_getDeviceEventController (registry, &ev);
+ Accessibility_KeySet *all_keys = Accessibility_KeySet__alloc();
+ Accessibility_KeyEventTypeSeq *key_events = Accessibility_KeyEventTypeSeq__alloc();
+ Accessibility_KeystrokeListener spi_listener_corba_ref;
+ Accessibility_DeviceEventController_ref (device_event_controller, &ev);
+ controller_event_mask->value = (CORBA_unsigned_long) modmask;
+ controller_event_mask->refcount = (CORBA_unsigned_short) 1;
+
+ spi_listener_corba_ref = (Accessibility_KeystrokeListener)
+ CORBA_Object_duplicate (bonobo_object_corba_objref (bonobo_object (listener)), &ev);
+
+ Accessibility_DeviceEventController_registerKeystrokeListener (
+ device_event_controller,
+ spi_listener_corba_ref,
+ all_keys,
+ controller_event_mask,
+ key_events,
+ (CORBA_boolean) ((sync_type | SPI_KEYLISTENER_ALL_WINDOWS)!=0),
+ &ev);
+}
+