* AT-SPI - Assistive Technology Service Provider Interface
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
*
- * Copyright 2001 Sun Microsystems Inc.
+ * Copyright 2001, 2002 Sun Microsystems Inc.,
+ * Copyright 2001, 2002 Ximian, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* object:column-reordered
* object:column-deleted
* object:model-changed
+ * object:active-descendant-changed
*
* (window events)
*
* window:unshade
* window:restyle
*
+ * (other events)
+ *
+ * focus:
+ * mouse:abs
+ * mouse:rel
+ * mouse:b1p
+ * mouse:b1r
+ * mouse:b2p
+ * mouse:b2r
+ * mouse:b3p
+ * mouse:b3r
+ *
* NOTE: this string may be UTF-8, but should not contain byte value 56
* (ascii ':'), except as a delimiter, since non-UTF-8 string
* delimiting functions are used internally.
* @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 #CSPI_KEYSET_ALL_KEYS.
+ * keystroke events are requested, or #SPI_KEYSET_ALL_KEYS
+ * to indicate that all keycodes and keyvals for the specified
+ * modifier set are to be included.
* @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
* the behavior of the notification/listener transaction.
*
* Register a listener for keystroke events, either pre-emptively for
- * all windows (CSPI_KEYLISTENER_ALL_WINDOWS), or
- * non-preemptively (CSPI_KEYLISTENER_NOSYNC).
- * ( Other sync_type values may be available in the future.)
+ * all windows (SPI_KEYLISTENER_ALL_WINDOWS),
+ * non-preemptively (SPI_KEYLISTENER_NOSYNC), or
+ * pre-emptively at the toolkit level (SPI_KEYLISTENER_CANCONSUME).
+ * If ALL_WINDOWS or CANCONSUME are used, the event is consumed
+ * upon receipt if one of @listener's callbacks returns #TRUE.
+ * ( Other sync_type values may be available in the future )
*
* Returns: #TRUE if successful, otherwise #FALSE.
**/
AccessibleKeyEventMask eventmask,
AccessibleKeyListenerSyncType sync_type)
{
- gint i, mask;
+ gint i;
Accessibility_KeySet key_set;
Accessibility_KeyEventTypeSeq key_events;
Accessibility_ControllerEventMask controller_event_mask;
Accessibility_DeviceEventController device_event_controller;
Accessibility_EventListenerMode listener_mode;
+ Accessibility_EventType key_event_types [2];
SPIBoolean retval = FALSE;
if (!listener)
key_set._buffer[i].keysym = keys->keysyms[i];
if (keys->keystrings && keys->keystrings[i])
{
- key_set._buffer[i].keystring = keys->keystrings[i];
+ key_set._buffer[i].keystring = CORBA_string_dup(keys->keystrings[i]);
}
else
{
}
/* copy the event filter values from the C api into the CORBA KeyEventTypeSeq */
- mask = 1;
- i = 0;
- do
- {
- if (mask & eventmask)
- {
- ++i;
- }
- mask <<= 1;
- }
- while (mask & 0xFFFF);
-
- key_events._buffer = Accessibility_KeyEventTypeSeq_allocbuf (i);
i = 0;
+ key_events._buffer = key_event_types;
if (eventmask & SPI_KEY_PRESSED)
{
- key_events._buffer[i++] = Accessibility_KEY_PRESSED;
+ key_events._buffer[i++] = Accessibility_KEY_PRESSED_EVENT;
}
if (eventmask & SPI_KEY_RELEASED)
{
- key_events._buffer[i++] = Accessibility_KEY_RELEASED;
+ key_events._buffer[i++] = Accessibility_KEY_RELEASED_EVENT;
}
key_events._length = i;
&listener_mode,
cspi_ev ());
+ CORBA_free (key_set._buffer);
+
cspi_return_val_if_ev ("registering keystroke listener", FALSE);
cspi_release_unref (device_event_controller);
}
/**
+ * SPI_registerDeviceEventListener:
+ * @listener: a pointer to the #AccessibleDeviceListener which requests
+ * the events.
+ * @eventmask: an #AccessibleDeviceEventMask mask indicating which
+ * types of key events are requested (#SPI_KEY_PRESSED, etc.).
+ * @filter: Unused parameter.
+ *
+ * Register a listener for device events, for instance button events.
+ *
+ * Returns: #TRUE if successful, otherwise #FALSE.
+ **/
+SPIBoolean
+SPI_registerDeviceEventListener (AccessibleDeviceListener *listener,
+ AccessibleDeviceEventMask eventmask,
+ void *filter)
+{
+ Accessibility_DeviceEventController device_event_controller;
+ SPIBoolean retval = FALSE;
+ Accessibility_EventTypeSeq event_types;
+ Accessibility_EventType event_type_buffer[2];
+ gint i;
+
+ if (!listener)
+ {
+ return retval;
+ }
+
+ device_event_controller =
+ Accessibility_Registry_getDeviceEventController (cspi_registry (), cspi_ev ());
+
+ cspi_return_val_if_ev ("getting event controller", FALSE);
+
+ /* copy the event filter values from the C api into the CORBA KeyEventTypeSeq */
+
+ event_types._buffer = event_type_buffer;
+ i = 0;
+
+ if (eventmask & SPI_BUTTON_PRESSED)
+ {
+ event_types._buffer[i++] = Accessibility_BUTTON_PRESSED_EVENT;
+ }
+ if (eventmask & SPI_BUTTON_RELEASED)
+ {
+ event_types._buffer[i++] = Accessibility_BUTTON_RELEASED_EVENT;
+ }
+
+ event_types._length = i;
+
+ retval = Accessibility_DeviceEventController_registerDeviceEventListener (
+ device_event_controller,
+ cspi_event_listener_get_corba (listener),
+ &event_types,
+ cspi_ev ());
+
+ cspi_return_val_if_ev ("registering keystroke listener", FALSE);
+
+ cspi_release_unref (device_event_controller);
+
+ return retval;
+}
+
+/**
+ * SPI_deregisterDeviceEventListener:
+ * @listener: a pointer to the #AccessibleDeviceListener for which
+ * device events are requested.
+ * @filter: Unused parameter.
+ *
+ * Removes a device event listener from the registry's listener queue,
+ * ceasing notification of events of the specified type.
+ *
+ * Returns: #TRUE if successful, otherwise #FALSE.
+ **/
+SPIBoolean
+SPI_deregisterDeviceEventListener (AccessibleDeviceListener *listener,
+ void *filter)
+{
+ Accessibility_DeviceEventController device_event_controller;
+ Accessibility_EventTypeSeq event_types;
+ Accessibility_EventType event_type_buff[2];
+
+ if (!listener)
+ {
+ return FALSE;
+ }
+
+ device_event_controller =
+ Accessibility_Registry_getDeviceEventController (cspi_registry (), cspi_ev ());
+
+ cspi_return_val_if_ev ("getting keystroke listener", FALSE);
+
+ event_types._buffer = event_type_buff;
+ event_types._length = 2;
+ event_types._buffer[0] = Accessibility_BUTTON_PRESSED_EVENT;
+ event_types._buffer[1] = Accessibility_BUTTON_RELEASED_EVENT;
+
+ Accessibility_DeviceEventController_deregisterDeviceEventListener (
+ device_event_controller,
+ cspi_event_listener_get_corba (listener),
+ &event_types,
+ cspi_ev ());
+
+ cspi_release_unref (device_event_controller);
+
+ return TRUE;
+}
+
+/**
* SPI_generateKeyboardEvent:
* @keyval: a long integer indicating the keycode or keysym of the key event
* being synthesized.
char *keystring,
AccessibleKeySynthType synth_type)
{
-/* TODO: check current modifier status and
- * send keycode to alter, if necessary
- */
-
- /* TODO: implement keystring use case */
Accessibility_KeySynthType keysynth_type;
Accessibility_DeviceEventController device_event_controller =
Accessibility_Registry_getDeviceEventController (cspi_registry (), cspi_ev ());
Accessibility_DeviceEventController_generateKeyboardEvent (device_event_controller,
keyval,
- "",
+ keystring ? keystring : "",
keysynth_type,
cspi_ev ());