X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=cspi%2Fspi_registry.c;h=40f81b77734f0ff9a18ff42a6abdee275756b8bf;hb=783e63cad5945ddb6df3ee129d20d5b53c6cce04;hp=784d642796ea63700c016f016f44b2b05effde21;hpb=b78b53c34e90b796f56f0da995066097a80922f0;p=platform%2Fcore%2Fuifw%2Fat-spi2-atk.git diff --git a/cspi/spi_registry.c b/cspi/spi_registry.c index 784d642..40f81b7 100644 --- a/cspi/spi_registry.c +++ b/cspi/spi_registry.c @@ -5,20 +5,60 @@ * */ +/* static stuff used only by registry C bindings */ +static GList *key_listeners = NULL; +static Display *display = NULL; + /** * registerGlobalEventListener: - * @listener: the #AccessibleEventListener to be registered against an event type. - * @callback: a character string indicating the type of events for which + * @listener: the #AccessibleEventListener to be registered against an + * event type. + * @eventType: a character string indicating the type of events for which * notification is requested. Format is * EventClass:major_type:minor_type:detail * where all subfields other than EventClass are optional. - * EventClasses include "Focus", "Window", "Mouse", + * EventClasses include "object", "window", "mouse", * and toolkit events (e.g. "Gtk", "AWT"). * Examples: "focus:", "Gtk:GtkWidget:button_press_event". * - * 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. In general, listening to + * Legal object event types: + * + * (property change events) + * + * object:property-change + * object:property-change:accessible-name + * object:property-change:accessible-state + * object:property-change:accessible-description + * object:property-change:accessible-parent + * object:property-change:accessible-value + * object:property-change:accessible-role + * object:property-change:accessible-table-caption + * object:property-change:accessible-table-column-description + * object:property-change:accessible-table-column-header + * object:property-change:accessible-table-row-description + * object:property-change:accessible-table-row-header + * object:property-change:accessible-table-summary + * + * (other object events) + * + * object:children-changed + * object:visible-data-changed + * object:selection-changed + * object:text-selection-changed + * object:text-changed + * object:text-caret-moved + * object:row-inserted + * object:row-reordered + * object:row-deleted + * object:column-inserted + * object:column-reordered + * object:column-deleted + * object:model-changed + * + * 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. + * In general, listening to * toolkit-specific events is not recommended. * * Add an in-process callback function to an existing AccessibleEventListener. @@ -48,6 +88,71 @@ registerGlobalEventListener (AccessibleEventListener *listener, } /** + * deregisterGlobalEventListenerAll: + * @listener: the #AccessibleEventListener to be registered against + * an event type. + * + * deregisters an AccessibleEventListener from the registry, for all + * event types it may be listening to. + * + * Returns: #TRUE if successful, otherwise #FALSE. + * + **/ +boolean +deregisterGlobalEventListenerAll (AccessibleEventListener *listener) +{ + Accessibility_Registry_deregisterGlobalEventListenerAll ( + registry, + (Accessibility_EventListener) + CORBA_Object_duplicate ( + bonobo_object_corba_objref ( + bonobo_object (listener)), &ev), + &ev); + + if (ev._major != CORBA_NO_EXCEPTION) + { + return FALSE; + } + else + { + return TRUE; + } +} +/** + * deregisterGlobalEventListener: + * @listener: the #AccessibleEventListener registered against an event type. + * @eventType: a string specifying the event type for which this + * listener is to be deregistered. + * + * deregisters an AccessibleEventListener from the registry, for a specific + * event type. + * + * Returns: #TRUE if successful, otherwise #FALSE. + * + **/ +boolean +deregisterGlobalEventListener (AccessibleEventListener *listener, + char *eventType) +{ + Accessibility_Registry_deregisterGlobalEventListener ( + registry, + (Accessibility_EventListener) + CORBA_Object_duplicate ( + bonobo_object_corba_objref (bonobo_object (listener)), &ev), + (CORBA_char *) eventType, + &ev); + + if (ev._major != CORBA_NO_EXCEPTION) + { + return FALSE; + } + else + { + return TRUE; + } +} + +/** * getDesktopCount: * * Get the number of virtual desktops. @@ -75,9 +180,9 @@ getDesktopCount () * **/ Accessible* -getDesktop (int n) +getDesktop (int i) { - return Obj_Add (Accessibility_Registry_getDesktop (registry, (CORBA_short) n, &ev)); + return Obj_Add (Accessibility_Registry_getDesktop (registry, (CORBA_short) i, &ev)); } /** @@ -89,7 +194,8 @@ getDesktop (int n) * It is the responsibility of the caller to free this array when * it is no longer needed. * - * Not Yet Implemented. + * Not Yet Implemented : this implementation always returns a single + * #Accessible desktop. * * Returns: an integer indicating how many virtual desktops have been * placed in the list pointed to by parameter @list. @@ -101,36 +207,142 @@ getDesktopList (Accessible **list) return 0; } +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); +} + /** - * registerKeystrokeListener: - * @listener: a pointer to the #KeystrokeListener for which + * deregisterAccessibleKeystrokeListener: + * @listener: a pointer to the #AccessibleKeystrokeListener for which * keystroke events are requested. + * @modmask: the key modifier mask for which this listener is to be + * 'deregistered' (of type #AccessibleeyMaskType). * - * Not Yet Implemented. - * + * Removes a keystroke event listener from the registry's listener queue, + * ceasing notification of events with modifiers matching @modmask. **/ void -registerKeystrokeListener (KeystrokeListener *listener) +deregisterAccessibleKeystrokeListener (AccessibleKeystrokeListener *listener, + AccessibleKeyMaskType modmask) { - ; + 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_unref (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_deregisterKeystrokeListener ( + device_event_controller, + spi_listener_corba_ref, + all_keys, + controller_event_mask, + key_events, + (CORBA_boolean) TRUE, + &ev); } /** * generateKeyEvent: - * @keycode: a #long indicating the keycode of the key event + * @keyval: a long integer indicating the keycode or keysym of the key event * being synthesized. - * @meta: a #long indicating the key modifiers to be sent - * with the event, if any. + * @synth_type: a #AccessibleKeySynthType flag indicating whether @keyval + * is to be interpreted as a keysym rather than a keycode + * (SPI_KEYSYM), or whether to synthesize + * SPI_KEY_PRESS, SPI_KEY_RELEASE, or both (SPI_KEY_PRESSRELEASE). * * Synthesize a keyboard event (as if a hardware keyboard event occurred in the * current UI context). - * Not Yet Implemented. * **/ void -generateKeyEvent (long keyCode, long meta) +generateKeyEvent (long int keyval, AccessibleKeySynthType synth_type) { - ; +/* TODO: check current modifier status and + * send keycode to alter, if necessary + */ + Accessibility_DeviceEventController device_event_controller = + Accessibility_Registry_getDeviceEventController (registry, &ev); + Accessibility_DeviceEventController_generateKeyEvent (device_event_controller, + keyval, + (unsigned long) synth_type, + &ev); } /** @@ -141,6 +353,8 @@ generateKeyEvent (long keyCode, long meta) * (e.g. "button1", "button2", "mousemove"). * * Synthesize a mouse event at a specific screen coordinate. + * Most AT clients should use the #AccessibleAction interface when + * tempted to generate mouse events, rather than this method. * Not Yet Implemented. * **/