From: billh Date: Wed, 21 Nov 2001 00:12:35 +0000 (+0000) Subject: Started fixing IDL docs. X-Git-Tag: AT_SPI2_ATK_2_12_0~1528 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fat-spi2-atk.git;a=commitdiff_plain;h=4328426aeae1eeed7c2e696536351b224eeddbce Started fixing IDL docs. Fixes to event dispatching. Got key notification working for non-preemptive key events, still needs some work on filters (currently KeySet filters are ignored, you get all key events that match a given modifier mask). git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@103 e2bd861d-eb25-0410-b326-f6ed22b6b98c --- diff --git a/ChangeLog b/ChangeLog index 4446641..ad1804f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,40 @@ -2001-11-20 Michael Meeks +2001-18-11 Bill Haneman + + * idl/Accessible.idl: + * idl/Application.idl: + * idl/Registry.idl: + * idl/Action.idl: + Started gtk-doc cleanup on IDL. + + * libspi/deviceeventcontroller.c: + Added and connected non-preemptive key notification from the + toolkits (in addition to the pre-emptive support from XServer + which we had before, but which causes 'focus flashing'). Filters + are presently limited to key modifiers and global/non-global, + KeySets are presently ignored, as are KeyEvent masks. + + Fixed naughtiness in dec_key_listener_new(), we copy the CORBA + structs into the persistant structure rather than just storing + pointers to things that might not persist across servant + invocations. + + The XGrabKey call now does async keygrabs, because synchronous + ones were deadlocking with GDK_event code in a very nasty way. + + Added boolean to internal method notify_keylisteners, to indicate + whether the event came from the 'toolkit source' or the 'global + (XServer) source' - this is used in the notification process to + determine which listeners to send the event to. + + * libspi/registry.c: + Fixed regression in application de-registration. + Also fixed some really brain-dead weirdness having to do with + event dispatching - event structs are now duplicated before being + re-marshalled in the dispatch to listeners. This also fixes a + Solaris build problem. + + +2001-20-11 Michael Meeks * libspi/registry.c (impl_accessibility_registry_deregister_global_event_listener): @@ -15,7 +51,7 @@ * libspi/application.h: kill unused ( and whacked out ) gboolean *spi_application_set_id (AtkObject *app, long id); -2001-11-20 Michael Meeks +2001-20-11 Michael Meeks * libspi/*.[ch]: further convert to bonobo's type func macros, remove redundnant casts etc. @@ -32,7 +68,7 @@ * */.cvsignore: update -2001-11-20 Michael Meeks +2001-20-11 Michael Meeks * libspi/deviceeventcontroller.c (_controller_register_with_devices): use g_getenv, @@ -47,7 +83,7 @@ * libspi/*.[ch]: more headers, includes and over commenting. -2001-11-20 Michael Meeks +2001-20-11 Michael Meeks * libspi/*.[ch]: fixup headers, includes and over commenting. @@ -59,7 +95,7 @@ * libspi/libspi.h: add. -2001-11-19 Michael Meeks +2001-19-11 Michael Meeks * libspi/editabletext.c (impl_setAttributes): fix warnings. diff --git a/at-bridge/bridge.c b/at-bridge/bridge.c index 6c66892..29fb569 100644 --- a/at-bridge/bridge.c +++ b/at-bridge/bridge.c @@ -64,8 +64,7 @@ static gboolean bridge_signal_listener (GSignalInvocationHint *signal_hint, const GValue *param_values, gpointer data); -static gint bridge_key_listener (AtkImplementor *atk_impl, - AtkKeyEventStruct *event, +static gint bridge_key_listener (AtkKeyEventStruct *event, gpointer data); int @@ -137,14 +136,10 @@ register_atk_event_listeners () * the AtkText signal handlers below won't get registered */ - AtkNoOpObject *o = atk_no_op_object_new (g_object_new (ATK_TYPE_OBJECT, NULL)); + AtkObject *o = atk_no_op_object_new (g_object_new (ATK_TYPE_OBJECT, NULL)); /* Register for focus event notifications, and register app with central registry */ - g_type_class_ref (ATK_TYPE_TEXT); - g_type_class_ref (ATK_TYPE_SELECTION); - g_type_class_ref (ATK_TYPE_TABLE); - atk_add_focus_tracker (bridge_focus_tracker); atk_add_global_event_listener (bridge_property_event_listener, "Gtk:AtkObject:property-change"); atk_add_global_event_listener (bridge_signal_listener, "Gtk:AtkObject:children-changed"); @@ -284,17 +279,49 @@ bridge_state_event_listener (GSignalInvocationHint *signal_hint, return TRUE; } -static gint -bridge_key_listener (AtkImplementor *atk_impl, AtkKeyEventStruct *event, gpointer data) +#define SPI_DEBUG + +static Accessibility_KeyStroke * +accessibility_keystroke_from_atk_key_event (AtkKeyEventStruct *event) { - Accessibility_KeyStroke *key_event; - static Accessibility_DeviceEventController controller = CORBA_OBJECT_NIL; - if (controller == CORBA_OBJECT_NIL) + Accessibility_KeyStroke *keystroke; + keystroke = Accessibility_KeyStroke__alloc (); + +#ifdef SPI_DEBUG + if (event) g_print ("event %c (%d)\n", (int) event->keyval, (int) event->keycode); + else +#endif + if (!event) g_print ("WARNING: NULL key event!"); + + keystroke->keyID = (CORBA_long) event->keyval; + keystroke->keycode = (CORBA_short) event->keycode; + keystroke->timestamp = (CORBA_unsigned_long) event->timestamp; + keystroke->modifiers = (CORBA_unsigned_short) (event->state & 0xFFFF); + + switch (event->type) { - controller = Accessibility_Registry_getDeviceEventController (registry, &ev); + case (ATK_KEY_EVENT_PRESS): + keystroke->type = Accessibility_KEY_PRESSED; + break; + case (ATK_KEY_EVENT_RELEASE): + keystroke->type = Accessibility_KEY_RELEASED; + break; + default: } - g_print ("bridge key listener fired!\n"); -/* Accessibility_DeviceEventController_notifyListenersSync (controller, key_event, &ev); */ + + return keystroke; +} + +static gint +bridge_key_listener (AtkKeyEventStruct *event, gpointer data) +{ + Accessibility_KeyStroke *key_event = accessibility_keystroke_from_atk_key_event (event); + CORBA_boolean result; + Accessibility_DeviceEventController controller = + Accessibility_Registry_getDeviceEventController (registry, &ev); + result = Accessibility_DeviceEventController_notifyListenersSync (controller, + (Accessibility_DeviceEvent *) key_event, + &ev); } static gboolean diff --git a/atk-bridge/bridge.c b/atk-bridge/bridge.c index 6c66892..29fb569 100644 --- a/atk-bridge/bridge.c +++ b/atk-bridge/bridge.c @@ -64,8 +64,7 @@ static gboolean bridge_signal_listener (GSignalInvocationHint *signal_hint, const GValue *param_values, gpointer data); -static gint bridge_key_listener (AtkImplementor *atk_impl, - AtkKeyEventStruct *event, +static gint bridge_key_listener (AtkKeyEventStruct *event, gpointer data); int @@ -137,14 +136,10 @@ register_atk_event_listeners () * the AtkText signal handlers below won't get registered */ - AtkNoOpObject *o = atk_no_op_object_new (g_object_new (ATK_TYPE_OBJECT, NULL)); + AtkObject *o = atk_no_op_object_new (g_object_new (ATK_TYPE_OBJECT, NULL)); /* Register for focus event notifications, and register app with central registry */ - g_type_class_ref (ATK_TYPE_TEXT); - g_type_class_ref (ATK_TYPE_SELECTION); - g_type_class_ref (ATK_TYPE_TABLE); - atk_add_focus_tracker (bridge_focus_tracker); atk_add_global_event_listener (bridge_property_event_listener, "Gtk:AtkObject:property-change"); atk_add_global_event_listener (bridge_signal_listener, "Gtk:AtkObject:children-changed"); @@ -284,17 +279,49 @@ bridge_state_event_listener (GSignalInvocationHint *signal_hint, return TRUE; } -static gint -bridge_key_listener (AtkImplementor *atk_impl, AtkKeyEventStruct *event, gpointer data) +#define SPI_DEBUG + +static Accessibility_KeyStroke * +accessibility_keystroke_from_atk_key_event (AtkKeyEventStruct *event) { - Accessibility_KeyStroke *key_event; - static Accessibility_DeviceEventController controller = CORBA_OBJECT_NIL; - if (controller == CORBA_OBJECT_NIL) + Accessibility_KeyStroke *keystroke; + keystroke = Accessibility_KeyStroke__alloc (); + +#ifdef SPI_DEBUG + if (event) g_print ("event %c (%d)\n", (int) event->keyval, (int) event->keycode); + else +#endif + if (!event) g_print ("WARNING: NULL key event!"); + + keystroke->keyID = (CORBA_long) event->keyval; + keystroke->keycode = (CORBA_short) event->keycode; + keystroke->timestamp = (CORBA_unsigned_long) event->timestamp; + keystroke->modifiers = (CORBA_unsigned_short) (event->state & 0xFFFF); + + switch (event->type) { - controller = Accessibility_Registry_getDeviceEventController (registry, &ev); + case (ATK_KEY_EVENT_PRESS): + keystroke->type = Accessibility_KEY_PRESSED; + break; + case (ATK_KEY_EVENT_RELEASE): + keystroke->type = Accessibility_KEY_RELEASED; + break; + default: } - g_print ("bridge key listener fired!\n"); -/* Accessibility_DeviceEventController_notifyListenersSync (controller, key_event, &ev); */ + + return keystroke; +} + +static gint +bridge_key_listener (AtkKeyEventStruct *event, gpointer data) +{ + Accessibility_KeyStroke *key_event = accessibility_keystroke_from_atk_key_event (event); + CORBA_boolean result; + Accessibility_DeviceEventController controller = + Accessibility_Registry_getDeviceEventController (registry, &ev); + result = Accessibility_DeviceEventController_notifyListenersSync (controller, + (Accessibility_DeviceEvent *) key_event, + &ev); } static gboolean diff --git a/cspi/spi.h b/cspi/spi.h index b29719e..97e6409 100644 --- a/cspi/spi.h +++ b/cspi/spi.h @@ -86,6 +86,7 @@ typedef struct _AccessibleKeyStroke { long keyID; short keycode; + long timestamp; AccessibleKeyEventType type; unsigned short modifiers; } AccessibleKeyStroke; diff --git a/cspi/spi_accessible.c b/cspi/spi_accessible.c index 31fb819..72a0dfa 100644 --- a/cspi/spi_accessible.c +++ b/cspi/spi_accessible.c @@ -928,6 +928,9 @@ AccessibleStateSet_equals (AccessibleStateSet *obj, * AccessibleStateSet_compare: * @obj: a pointer to the first #AccessibleStateSet object on which to operate. * @obj2: a pointer to the second #AccessibleStateSet object on which to operate. + * @differenceSet: a pointer to an array of #AccessibleStates, which is set when the + * fuction returns to point to an array of states representing the states which + * the two state sets do not have in common. * * Determine the differences between two instances of #AccessibleStateSet. *. diff --git a/cspi/spi_registry.c b/cspi/spi_registry.c index 40f81b7..382f253 100644 --- a/cspi/spi_registry.c +++ b/cspi/spi_registry.c @@ -1,3 +1,24 @@ +/* + * AT-SPI - Assistive Technology Service Provider Interface + * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) + * + * Copyright 2001 Sun Microsystems Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ /* * diff --git a/docs/Makefile.am b/docs/Makefile.am index 04b55a8..4b474bc 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -12,7 +12,7 @@ DOC_MODULE=at-spi DOC_MAIN_SGML_FILE=at-spi-docs.sgml # The directory containing the source code (if it contains documentation). -DOC_SOURCE_DIR=../cspi +DOC_SOURCE_DIR=../cspi ../idl INSTALLDIR=$(prefix)/share/gtk-doc diff --git a/idl/Accessibility_Accessible.idl b/idl/Accessibility_Accessible.idl index 09735cb..dae5ed1 100644 --- a/idl/Accessibility_Accessible.idl +++ b/idl/Accessibility_Accessible.idl @@ -36,33 +36,32 @@ module Accessibility { interface Accessible : Bonobo::Unknown { /** - * #attribute name: a (short) @string representing the object's name. + * @name: a (short) #string representing the object's name. **/ attribute string name; /** - * #attribute description: a @string describing the object in more detail than @name. + * @description: a #string describing the object in more detail than @name. **/ attribute string description; /** - * #attribute parent: an @Accessible object which is this object's containing object. + * @parent: an #Accessible object which is this object's containing object. **/ readonly attribute Accessible parent; /** - * getChildCount: - * return values: the number of children contained by this object (zero if none). - * - * Get the number of children contained by this object. - * + * @childCount: the number of children contained by this object. **/ readonly attribute long childCount; /** * isEqual: - * @object: an #Accessible object reference to compare to - * return values: a #boolean indicating whether the two object references + * @obj: an #Accessible object reference to compare to + * + * Determine whether an #Accessible refers to the same object as another + * + * Returns: a #boolean indicating whether the two object references * point to the same object. **/ boolean isEqual (in Accessible obj); @@ -70,45 +69,44 @@ module Accessibility { /** * getChildAtIndex: * @index: an in parameter indicating which child is requested (zero-indexed). - * return values: the 'nth' @Accessible child of this object. * * Get the accessible child of this object at index @index. * + * Returns: the 'nth' @Accessible child of this object. **/ Accessible getChildAtIndex (in long index); /** * getIndexInParent: - * return values: a long integer indicating this object's index in the parent's list. * * Get the index of this object in its parent's child list. * + * Returns: a long integer indicating this object's index in the parent's list. **/ long getIndexInParent (); /** * getRelationSet: - * return values: a @RelationSet defining this object's relationships. * * Get a set defining this object's relationship to other accessible objects. * + * Returns: a @RelationSet defining this object's relationships. **/ RelationSet getRelationSet (); /** * getRole: - * return values: the @Role of this object. - * * Get the @Role indicating the type of UI role played by this object. * + * Returns: a @Role indicating the type of UI role played by this object. **/ Role getRole (); /** * getState: - * return values: a @StateSet encapsulating the currently true states of the object. * * Get the current state of the object as a @StateSet. + * Returns: a @StateSet encapsulating the currently true states of the object. **/ StateSet getState (); }; diff --git a/idl/Accessibility_Action.idl b/idl/Accessibility_Action.idl index 95fd5ca..7a458c7 100644 --- a/idl/Accessibility_Action.idl +++ b/idl/Accessibility_Action.idl @@ -25,7 +25,7 @@ module Accessibility { interface Action : Bonobo::Unknown { /** - * nActionss: a @long containing the number of actions this object supports. + * nActions: a @long containing the number of actions this object supports. * **/ readonly attribute long nActions; @@ -37,7 +37,7 @@ module Accessibility { * * Gets the description of the specified action. * - * return values: a @wstring containing the description of the specified action. + * Returns: a @wstring containing the description of the specified action. * **/ string getDescription (in long index); @@ -49,7 +49,7 @@ module Accessibility { * * Gets the name of the specified action. * - * return values: a @string containing the name of the specified action. + * Returns: a @string containing the name of the specified action. * **/ string getName (in long index); @@ -60,20 +60,20 @@ module Accessibility { * * Causes the object to perform the specified action. * - * return values: a @boolean indicating success or failure. + * Returns: a @boolean indicating success or failure. * **/ boolean doAction (in long index); /** * getKeyBinding: - * return values: a @string containing the key binding for the specified action, - * "" if none exists. * @index: an %in parameter specifying the 0-based index of the action * for which a key binding is requested. * * Gets the key binding associated with a specific action. * + * Returns: a @string containing the key binding for the specified action, + * "" if none exists. **/ string getKeyBinding (in long index); }; diff --git a/idl/Accessibility_Application.idl b/idl/Accessibility_Application.idl index 01deff3..b921af6 100644 --- a/idl/Accessibility_Application.idl +++ b/idl/Accessibility_Application.idl @@ -30,7 +30,8 @@ module Accessibility { interface Application : Accessible { /** - * Get a string indicating the type of user interface toolkit + * @toolkitName: + * A string indicating the type of user interface toolkit * which is used by the application. * Ordinarily clients of @AccessibleApplication should be * toolkit-agnostic, dependencies on this method probably @@ -39,46 +40,63 @@ module Accessibility { readonly attribute string toolkitName; /** - * Get a string indicating the version number of the application's + * @version: + * A string indicating the version number of the application's * accessibility bridge implementation. **/ readonly attribute string version; /** - * Get the application instance's unique ID as assigned by the registry. - * + * @id: + * The application instance's unique ID as assigned by the registry. **/ attribute long id; /** + * registerToolkitEventListener: + * @listener: an #EventListener object which will receive the requested + * events from the application's toolkits via toolit 'bridges' + * @eventName: a UTF-8 string indicating the type of (toolkit-specific) event + * being requested. Not all applications can generate toolkit events of + * a given type. + * * Register with this application's toolkit for "toolkit-specific" event notifications. + * For most event support, clients should use non-toolkit-specific events + * whenever possible, via #Registry::registerGlobalEventListener - this method + * is provided as a 'back door' when generic names do not exist for the events in question. + * SUBJECT TO DEPRECATION in favor of Registry::registerGlobalEventListener forms. * **/ void registerToolkitEventListener (in EventListener listener, in string eventName); /** - * Register with this application's toolkit for "Accessibility::Accessible" - * event notifications. + * registerObjectEventListener: + * @listener: an #EventListener object which will receive the requested + * events + * @eventName: a UTF-8 string indicating the type of (toolkit-specific) event + * being requested. + * Register with this application toolkit for "Accessibility::Accessible" + * event notifications. SUBJECT TO DEPRECATION * **/ void registerObjectEventListener (in EventListener listener, in string eventName); /** * pause: - * Returns: %true if the request succeeded, %false otherwise. * * Request that the application temporarily stop sending events. * In most cases this should pause the application's main event loop. * + * Returns: %true if the request succeeded, %false otherwise. **/ boolean pause (); /** * resume: - * Returns: %true if the request succeeded, %false otherwise. * * Request that the application resume sending events. * + * Returns: %true if the request succeeded, %false otherwise. **/ boolean resume (); }; diff --git a/idl/Accessibility_Registry.idl b/idl/Accessibility_Registry.idl index 2e56cf3..52d3c2a 100644 --- a/idl/Accessibility_Registry.idl +++ b/idl/Accessibility_Registry.idl @@ -39,7 +39,6 @@ module Accessibility { /** * registerApplication: * @application: a reference to the requesting @Application - * return values: void * * Register a new application with the accessibility broker. * @@ -50,8 +49,7 @@ module Accessibility { * deregisterApplication: * @application: a reference to the @Application * to be deregistered. - * return values: void - * + * * De-register an application previously registered with the broker. * **/ @@ -62,7 +60,6 @@ module Accessibility { * @listener: a reference to the requesting @EventListener. * @eventName: a string which indicates the type of events about * which the client desires notification. - * return values: void * * Register a client's interest in (all) application events of * a certain type. @@ -75,7 +72,6 @@ module Accessibility { * deregisterGlobalEventListener: * @listener: the requesting @EventListener * @eventName: a string indicating the type of events - * return values: void * * Request that a previously registered client stop receiving * global notifications for events of a certain type. @@ -87,7 +83,6 @@ module Accessibility { * deregisterGlobalEventListener: * @listener: the requesting @EventListener * @eventName: a string indicating the type of events - * return values: void * * Request that a previously registered client stop receiving * global notifications for events of a certain type. @@ -115,38 +110,37 @@ module Accessibility { /** * getDesktopCount: - * return values: a short integer indicating the current number of - * @Desktops. * * Get the current number of desktops. - * + * Returns: a short integer indicating the current number of + * @Desktops. **/ short getDesktopCount (); /** * getDesktop: * @n: the index of the requested @Desktop. - * return values: a reference to the requested @Desktop. * * Get the nth accessible desktop. * + * Returns: a reference to the requested @Desktop. **/ Desktop getDesktop (in short n); /** * getDesktopList: - * return values: a sequence containing references to - * the @Desktops. * * Get a list of accessible desktops. * + * Returns: a sequence containing references to + * the @Desktops. **/ DesktopSeq getDesktopList (); /** * getDeviceEventController: - * return values: an object implementing DeviceEventController * + * Returns: an object implementing DeviceEventController **/ DeviceEventController getDeviceEventController (); @@ -257,11 +251,9 @@ module Accessibility { in KeyEventTypeSeq type, in boolean is_synchronous); - boolean notifyListenersSync (in DeviceEventListener listener, - in DeviceEvent event); + boolean notifyListenersSync (in DeviceEvent event); - oneway void notifyListenersAsync (in DeviceEventListener listener, - in DeviceEvent event); + oneway void notifyListenersAsync (in DeviceEvent event); /** * generateKeyEvent: diff --git a/idl/Accessible.idl b/idl/Accessible.idl index 09735cb..dae5ed1 100644 --- a/idl/Accessible.idl +++ b/idl/Accessible.idl @@ -36,33 +36,32 @@ module Accessibility { interface Accessible : Bonobo::Unknown { /** - * #attribute name: a (short) @string representing the object's name. + * @name: a (short) #string representing the object's name. **/ attribute string name; /** - * #attribute description: a @string describing the object in more detail than @name. + * @description: a #string describing the object in more detail than @name. **/ attribute string description; /** - * #attribute parent: an @Accessible object which is this object's containing object. + * @parent: an #Accessible object which is this object's containing object. **/ readonly attribute Accessible parent; /** - * getChildCount: - * return values: the number of children contained by this object (zero if none). - * - * Get the number of children contained by this object. - * + * @childCount: the number of children contained by this object. **/ readonly attribute long childCount; /** * isEqual: - * @object: an #Accessible object reference to compare to - * return values: a #boolean indicating whether the two object references + * @obj: an #Accessible object reference to compare to + * + * Determine whether an #Accessible refers to the same object as another + * + * Returns: a #boolean indicating whether the two object references * point to the same object. **/ boolean isEqual (in Accessible obj); @@ -70,45 +69,44 @@ module Accessibility { /** * getChildAtIndex: * @index: an in parameter indicating which child is requested (zero-indexed). - * return values: the 'nth' @Accessible child of this object. * * Get the accessible child of this object at index @index. * + * Returns: the 'nth' @Accessible child of this object. **/ Accessible getChildAtIndex (in long index); /** * getIndexInParent: - * return values: a long integer indicating this object's index in the parent's list. * * Get the index of this object in its parent's child list. * + * Returns: a long integer indicating this object's index in the parent's list. **/ long getIndexInParent (); /** * getRelationSet: - * return values: a @RelationSet defining this object's relationships. * * Get a set defining this object's relationship to other accessible objects. * + * Returns: a @RelationSet defining this object's relationships. **/ RelationSet getRelationSet (); /** * getRole: - * return values: the @Role of this object. - * * Get the @Role indicating the type of UI role played by this object. * + * Returns: a @Role indicating the type of UI role played by this object. **/ Role getRole (); /** * getState: - * return values: a @StateSet encapsulating the currently true states of the object. * * Get the current state of the object as a @StateSet. + * Returns: a @StateSet encapsulating the currently true states of the object. **/ StateSet getState (); }; diff --git a/idl/Action.idl b/idl/Action.idl index 95fd5ca..7a458c7 100644 --- a/idl/Action.idl +++ b/idl/Action.idl @@ -25,7 +25,7 @@ module Accessibility { interface Action : Bonobo::Unknown { /** - * nActionss: a @long containing the number of actions this object supports. + * nActions: a @long containing the number of actions this object supports. * **/ readonly attribute long nActions; @@ -37,7 +37,7 @@ module Accessibility { * * Gets the description of the specified action. * - * return values: a @wstring containing the description of the specified action. + * Returns: a @wstring containing the description of the specified action. * **/ string getDescription (in long index); @@ -49,7 +49,7 @@ module Accessibility { * * Gets the name of the specified action. * - * return values: a @string containing the name of the specified action. + * Returns: a @string containing the name of the specified action. * **/ string getName (in long index); @@ -60,20 +60,20 @@ module Accessibility { * * Causes the object to perform the specified action. * - * return values: a @boolean indicating success or failure. + * Returns: a @boolean indicating success or failure. * **/ boolean doAction (in long index); /** * getKeyBinding: - * return values: a @string containing the key binding for the specified action, - * "" if none exists. * @index: an %in parameter specifying the 0-based index of the action * for which a key binding is requested. * * Gets the key binding associated with a specific action. * + * Returns: a @string containing the key binding for the specified action, + * "" if none exists. **/ string getKeyBinding (in long index); }; diff --git a/idl/Application.idl b/idl/Application.idl index 01deff3..b921af6 100644 --- a/idl/Application.idl +++ b/idl/Application.idl @@ -30,7 +30,8 @@ module Accessibility { interface Application : Accessible { /** - * Get a string indicating the type of user interface toolkit + * @toolkitName: + * A string indicating the type of user interface toolkit * which is used by the application. * Ordinarily clients of @AccessibleApplication should be * toolkit-agnostic, dependencies on this method probably @@ -39,46 +40,63 @@ module Accessibility { readonly attribute string toolkitName; /** - * Get a string indicating the version number of the application's + * @version: + * A string indicating the version number of the application's * accessibility bridge implementation. **/ readonly attribute string version; /** - * Get the application instance's unique ID as assigned by the registry. - * + * @id: + * The application instance's unique ID as assigned by the registry. **/ attribute long id; /** + * registerToolkitEventListener: + * @listener: an #EventListener object which will receive the requested + * events from the application's toolkits via toolit 'bridges' + * @eventName: a UTF-8 string indicating the type of (toolkit-specific) event + * being requested. Not all applications can generate toolkit events of + * a given type. + * * Register with this application's toolkit for "toolkit-specific" event notifications. + * For most event support, clients should use non-toolkit-specific events + * whenever possible, via #Registry::registerGlobalEventListener - this method + * is provided as a 'back door' when generic names do not exist for the events in question. + * SUBJECT TO DEPRECATION in favor of Registry::registerGlobalEventListener forms. * **/ void registerToolkitEventListener (in EventListener listener, in string eventName); /** - * Register with this application's toolkit for "Accessibility::Accessible" - * event notifications. + * registerObjectEventListener: + * @listener: an #EventListener object which will receive the requested + * events + * @eventName: a UTF-8 string indicating the type of (toolkit-specific) event + * being requested. + * Register with this application toolkit for "Accessibility::Accessible" + * event notifications. SUBJECT TO DEPRECATION * **/ void registerObjectEventListener (in EventListener listener, in string eventName); /** * pause: - * Returns: %true if the request succeeded, %false otherwise. * * Request that the application temporarily stop sending events. * In most cases this should pause the application's main event loop. * + * Returns: %true if the request succeeded, %false otherwise. **/ boolean pause (); /** * resume: - * Returns: %true if the request succeeded, %false otherwise. * * Request that the application resume sending events. * + * Returns: %true if the request succeeded, %false otherwise. **/ boolean resume (); }; diff --git a/idl/Registry.idl b/idl/Registry.idl index 2e56cf3..52d3c2a 100644 --- a/idl/Registry.idl +++ b/idl/Registry.idl @@ -39,7 +39,6 @@ module Accessibility { /** * registerApplication: * @application: a reference to the requesting @Application - * return values: void * * Register a new application with the accessibility broker. * @@ -50,8 +49,7 @@ module Accessibility { * deregisterApplication: * @application: a reference to the @Application * to be deregistered. - * return values: void - * + * * De-register an application previously registered with the broker. * **/ @@ -62,7 +60,6 @@ module Accessibility { * @listener: a reference to the requesting @EventListener. * @eventName: a string which indicates the type of events about * which the client desires notification. - * return values: void * * Register a client's interest in (all) application events of * a certain type. @@ -75,7 +72,6 @@ module Accessibility { * deregisterGlobalEventListener: * @listener: the requesting @EventListener * @eventName: a string indicating the type of events - * return values: void * * Request that a previously registered client stop receiving * global notifications for events of a certain type. @@ -87,7 +83,6 @@ module Accessibility { * deregisterGlobalEventListener: * @listener: the requesting @EventListener * @eventName: a string indicating the type of events - * return values: void * * Request that a previously registered client stop receiving * global notifications for events of a certain type. @@ -115,38 +110,37 @@ module Accessibility { /** * getDesktopCount: - * return values: a short integer indicating the current number of - * @Desktops. * * Get the current number of desktops. - * + * Returns: a short integer indicating the current number of + * @Desktops. **/ short getDesktopCount (); /** * getDesktop: * @n: the index of the requested @Desktop. - * return values: a reference to the requested @Desktop. * * Get the nth accessible desktop. * + * Returns: a reference to the requested @Desktop. **/ Desktop getDesktop (in short n); /** * getDesktopList: - * return values: a sequence containing references to - * the @Desktops. * * Get a list of accessible desktops. * + * Returns: a sequence containing references to + * the @Desktops. **/ DesktopSeq getDesktopList (); /** * getDeviceEventController: - * return values: an object implementing DeviceEventController * + * Returns: an object implementing DeviceEventController **/ DeviceEventController getDeviceEventController (); @@ -257,11 +251,9 @@ module Accessibility { in KeyEventTypeSeq type, in boolean is_synchronous); - boolean notifyListenersSync (in DeviceEventListener listener, - in DeviceEvent event); + boolean notifyListenersSync (in DeviceEvent event); - oneway void notifyListenersAsync (in DeviceEventListener listener, - in DeviceEvent event); + oneway void notifyListenersAsync (in DeviceEvent event); /** * generateKeyEvent: diff --git a/libspi/deviceeventcontroller.c b/libspi/deviceeventcontroller.c index f4e19b3..9897f38 100644 --- a/libspi/deviceeventcontroller.c +++ b/libspi/deviceeventcontroller.c @@ -127,10 +127,15 @@ dec_key_listener_new (CORBA_Object l, DEControllerKeyListener *key_listener = g_new0 (DEControllerKeyListener, 1); key_listener->listener.object = CORBA_Object_duplicate (l, ev); key_listener->listener.type = SPI_DEVICE_TYPE_KBD; - key_listener->keys = keys; - key_listener->mask = mask; + key_listener->keys = ORBit_copy_value (keys, TC_Accessibility_KeySet); + key_listener->mask = ORBit_copy_value (mask, TC_Accessibility_ControllerEventMask); key_listener->is_system_global = is_system_global; + g_print ("new listener, with mask %x, is_global %d, keys %p\n", + (unsigned int) key_listener->mask->value, + (int) key_listener->is_system_global, + (void *) key_listener->keys); + return key_listener; } @@ -243,24 +248,50 @@ _controller_register_with_devices (SpiDeviceEventController *controller) static gboolean -notify_keylisteners (GList *key_listeners, Accessibility_KeyStroke *key_event, CORBA_Environment *ev) +key_event_matches_listener (Accessibility_KeyStroke *key_event, + DEControllerKeyListener *listener, + CORBA_boolean is_system_global) +{ + g_print ("mask=%x, listener mask= %x\n", (unsigned int) key_event->modifiers, + (unsigned int) (listener->mask->value & 0xFFFF)); + if ((key_event->modifiers == (CORBA_unsigned_short) (listener->mask->value && 0xFFFF)) && + ((listener->keys == NULL) || (1)) && /* in keyset seq */ + (1) && /* in event type seq */ + (is_system_global == listener->is_system_global)) + { + return TRUE; + } + else + return FALSE; +} + +static gboolean +notify_keylisteners (GList *key_listeners, + Accessibility_KeyStroke *key_event, + CORBA_boolean is_system_global, + CORBA_Environment *ev) { int i, n_listeners = g_list_length (key_listeners); gboolean is_consumed = FALSE; + for (i=0; ilistener.object; + if (key_event_matches_listener (key_event, key_listener, is_system_global)) { - is_consumed = Accessibility_KeystrokeListener_keyEvent (ls, key_event, ev); - } + if (!CORBA_Object_is_nil(ls, ev)) + { + is_consumed = Accessibility_KeystrokeListener_keyEvent (ls, key_event, ev); + } + } + else g_print ("no match for listener %d\n", i); } return is_consumed; } - static gboolean _check_key_event (SpiDeviceEventController *controller) { @@ -311,11 +342,11 @@ _check_key_event (SpiDeviceEventController *controller) #endif } /* relay to listeners, and decide whether to consume it or not */ - is_consumed = notify_keylisteners (controller->key_listeners, &key_event, &ev); + is_consumed = notify_keylisteners (controller->key_listeners, &key_event, CORBA_TRUE, &ev); if (is_consumed) { - XAllowEvents (display, SyncKeyboard, CurrentTime); + XAllowEvents (display, AsyncKeyboard, CurrentTime); } else { @@ -361,7 +392,7 @@ _controller_grab_keyboard (SpiDeviceEventController *controller) root_window, True, GrabModeAsync, - GrabModeSync); + GrabModeAsync); /* TODO: check call for errors and return FALSE if error occurs */ } else { return FALSE; /* can't do control key yet */ @@ -503,10 +534,7 @@ impl_generate_key_event (PortableServer_Servant servant, } } -/* - * CORBA Accessibility::DeviceEventController::generateMouseEvent - * method implementation - */ +/* Accessibility::DeviceEventController::generateMouseEvent */ static void impl_generate_mouse_event (PortableServer_Servant servant, const CORBA_long x, @@ -515,8 +543,40 @@ impl_generate_mouse_event (PortableServer_Servant servant, CORBA_Environment *ev) { #ifdef SPI_DEBUG - fprintf (stderr, "generating mouse %s event at %ld, %ld\n", eventName, x, y); + fprintf (stderr, "generating mouse %s event at %ld, %ld\n", eventName, x, y); +#endif +} + +/* Accessibility::DeviceEventController::notifyListenersSync */ +static CORBA_boolean +impl_notify_listeners_sync(PortableServer_Servant servant, + const Accessibility_DeviceEvent *event, + CORBA_Environment *ev) +{ + SpiDeviceEventController *controller = SPI_DEVICE_EVENT_CONTROLLER ( + bonobo_object_from_servant (servant)); + Accessibility_KeyStroke *key_event = (Accessibility_KeyStroke *) event; +#ifdef SPI_DEBUG + g_print ("notifying listeners synchronously: controller %x, event id %d\n", + (void *) controller, (int) event->eventID); +#endif + return (notify_keylisteners (controller->key_listeners, key_event, CORBA_FALSE, ev) ? + CORBA_TRUE : CORBA_FALSE); +} + +/* Accessibility::DeviceEventController::notifyListenersAsync */ +static void +impl_notify_listeners_async (PortableServer_Servant servant, + const Accessibility_DeviceEvent *event, + CORBA_Environment *ev) +{ + SpiDeviceEventController *controller = SPI_DEVICE_EVENT_CONTROLLER( + bonobo_object_from_servant (servant)); + Accessibility_KeyStroke *key_event = (Accessibility_KeyStroke *) event; +#ifdef SPI_DEBUG + fprintf (stderr, "notifying listeners asynchronously\n"); #endif + notify_keylisteners (controller->key_listeners, key_event, CORBA_FALSE, ev); } static void @@ -533,6 +593,8 @@ spi_device_event_controller_class_init (SpiDeviceEventControllerClass *klass) /* epv->registerMouseListener = impl_register_mouse_listener; */ epv->generateKeyEvent = impl_generate_key_event; epv->generateMouseEvent = impl_generate_mouse_event; + epv->notifyListenersSync = impl_notify_listeners_sync; + epv->notifyListenersAsync = impl_notify_listeners_async; klass->check_key_event = _check_key_event; } @@ -557,7 +619,7 @@ spi_device_event_controller_check_key_event (SpiDeviceEventController *controlle SpiDeviceEventController * spi_device_event_controller_new (void *registryp) { - SpiRegistry *registry = SPI_REGISTRY (registryp); + BonoboObject *registry = (BonoboObject *) registryp; SpiDeviceEventController *retval = g_object_new ( SPI_DEVICE_EVENT_CONTROLLER_TYPE, NULL); retval->registry = registry; diff --git a/libspi/deviceeventcontroller.h b/libspi/deviceeventcontroller.h index e5e9e28..e3e8c97 100644 --- a/libspi/deviceeventcontroller.h +++ b/libspi/deviceeventcontroller.h @@ -39,7 +39,7 @@ G_BEGIN_DECLS typedef struct { BonoboObject parent; - struct SpiRegistry *registry; + void *registry; GList *key_listeners; GList *mouse_listeners; GList *keymask_list; diff --git a/libspi/registry.c b/libspi/registry.c index 7e278b5..51a3cb4 100644 --- a/libspi/registry.c +++ b/libspi/registry.c @@ -71,7 +71,7 @@ typedef struct { } SpiListenerStruct; /* static function prototypes */ -static void _registry_notify_listeners ( GList *listeners, +static void _registry_notify_listeners (GList *listeners, const Accessibility_Event *e, CORBA_Environment *ev); @@ -258,7 +258,7 @@ impl_accessibility_registry_deregister_application (PortableServer_Servant serva CORBA_Environment * ev) { SpiRegistry *registry = SPI_REGISTRY (bonobo_object_from_servant (servant)); - GList *list = g_list_find_custom (registry->desktop->applications, &application, compare_corba_objects); + GList *list = g_list_find_custom (registry->desktop->applications, application, compare_corba_objects); #ifdef SPI_DEBUG gint i; @@ -272,15 +272,18 @@ impl_accessibility_registry_deregister_application (PortableServer_Servant serva registry->desktop->applications = g_list_delete_link (registry->desktop->applications, list); #ifdef SPI_DEBUG fprintf (stderr, "there are now %d apps registered.\n", g_list_length (registry->desktop->applications)); - for (i = 0; i < g_list_length (registry->desktop->applications); ++i) { + for (i = 0; i < g_list_length (registry->desktop->applications); ++i) + { fprintf (stderr, "getting application %d\n", i); fprintf (stderr, "object address %p\n", - g_list_nth_data (registry->desktop->applications, i)); - } + g_list_nth_data (registry->desktop->applications, i)); + } #endif } else - fprintf (stderr, "could not deregister application\n"); + { + fprintf (stderr, "could not deregister application %p\n", application); + } } /* @@ -523,16 +526,17 @@ _get_unique_id () } static void -_registry_notify_listeners ( GList *listeners, - const Accessibility_Event *e, +_registry_notify_listeners (GList *listeners, + const Accessibility_Event *e_in, CORBA_Environment *ev) { int n; int len; SpiListenerStruct *ls; EventTypeStruct etype; + Accessibility_Event *e_out; guint minor_hash; - parse_event_type (&etype, e->type); + parse_event_type (&etype, e_in->type); minor_hash = g_str_hash (g_strconcat (etype.major, etype.minor, NULL)); len = g_list_length (listeners); @@ -547,13 +551,16 @@ _registry_notify_listeners ( GList *listeners, { #ifdef SPI_DEBUG fprintf(stderr, "notifying listener #%d\n", n); - fprintf(stderr, "event source name %s\n", Accessibility_Accessible__get_name(e->source, ev)); + fprintf(stderr, "event source name %s\n", Accessibility_Accessible__get_name(e_in->source, ev)); #endif - e->source = CORBA_Object_duplicate (e->source, ev); - Accessibility_Accessible_ref ( e->source, ev); + e_out = ORBit_copy_value (e_in, TC_Accessibility_Event); + e_out->source = CORBA_Object_duplicate (e_in->source, ev); + Accessibility_Accessible_ref ( e_out->source, ev); Accessibility_EventListener_notifyEvent ((Accessibility_EventListener) ls->listener, - e, + e_out, ev); + /* is it safe to free e_out now ? notifyEvent is a oneway... */ + CORBA_free (e_out); if (ev->_major != CORBA_NO_EXCEPTION) { fprintf(stderr, ("Accessibility app error: exception during event notification: %s\n"), diff --git a/registryd/deviceeventcontroller.c b/registryd/deviceeventcontroller.c index f4e19b3..9897f38 100644 --- a/registryd/deviceeventcontroller.c +++ b/registryd/deviceeventcontroller.c @@ -127,10 +127,15 @@ dec_key_listener_new (CORBA_Object l, DEControllerKeyListener *key_listener = g_new0 (DEControllerKeyListener, 1); key_listener->listener.object = CORBA_Object_duplicate (l, ev); key_listener->listener.type = SPI_DEVICE_TYPE_KBD; - key_listener->keys = keys; - key_listener->mask = mask; + key_listener->keys = ORBit_copy_value (keys, TC_Accessibility_KeySet); + key_listener->mask = ORBit_copy_value (mask, TC_Accessibility_ControllerEventMask); key_listener->is_system_global = is_system_global; + g_print ("new listener, with mask %x, is_global %d, keys %p\n", + (unsigned int) key_listener->mask->value, + (int) key_listener->is_system_global, + (void *) key_listener->keys); + return key_listener; } @@ -243,24 +248,50 @@ _controller_register_with_devices (SpiDeviceEventController *controller) static gboolean -notify_keylisteners (GList *key_listeners, Accessibility_KeyStroke *key_event, CORBA_Environment *ev) +key_event_matches_listener (Accessibility_KeyStroke *key_event, + DEControllerKeyListener *listener, + CORBA_boolean is_system_global) +{ + g_print ("mask=%x, listener mask= %x\n", (unsigned int) key_event->modifiers, + (unsigned int) (listener->mask->value & 0xFFFF)); + if ((key_event->modifiers == (CORBA_unsigned_short) (listener->mask->value && 0xFFFF)) && + ((listener->keys == NULL) || (1)) && /* in keyset seq */ + (1) && /* in event type seq */ + (is_system_global == listener->is_system_global)) + { + return TRUE; + } + else + return FALSE; +} + +static gboolean +notify_keylisteners (GList *key_listeners, + Accessibility_KeyStroke *key_event, + CORBA_boolean is_system_global, + CORBA_Environment *ev) { int i, n_listeners = g_list_length (key_listeners); gboolean is_consumed = FALSE; + for (i=0; ilistener.object; + if (key_event_matches_listener (key_event, key_listener, is_system_global)) { - is_consumed = Accessibility_KeystrokeListener_keyEvent (ls, key_event, ev); - } + if (!CORBA_Object_is_nil(ls, ev)) + { + is_consumed = Accessibility_KeystrokeListener_keyEvent (ls, key_event, ev); + } + } + else g_print ("no match for listener %d\n", i); } return is_consumed; } - static gboolean _check_key_event (SpiDeviceEventController *controller) { @@ -311,11 +342,11 @@ _check_key_event (SpiDeviceEventController *controller) #endif } /* relay to listeners, and decide whether to consume it or not */ - is_consumed = notify_keylisteners (controller->key_listeners, &key_event, &ev); + is_consumed = notify_keylisteners (controller->key_listeners, &key_event, CORBA_TRUE, &ev); if (is_consumed) { - XAllowEvents (display, SyncKeyboard, CurrentTime); + XAllowEvents (display, AsyncKeyboard, CurrentTime); } else { @@ -361,7 +392,7 @@ _controller_grab_keyboard (SpiDeviceEventController *controller) root_window, True, GrabModeAsync, - GrabModeSync); + GrabModeAsync); /* TODO: check call for errors and return FALSE if error occurs */ } else { return FALSE; /* can't do control key yet */ @@ -503,10 +534,7 @@ impl_generate_key_event (PortableServer_Servant servant, } } -/* - * CORBA Accessibility::DeviceEventController::generateMouseEvent - * method implementation - */ +/* Accessibility::DeviceEventController::generateMouseEvent */ static void impl_generate_mouse_event (PortableServer_Servant servant, const CORBA_long x, @@ -515,8 +543,40 @@ impl_generate_mouse_event (PortableServer_Servant servant, CORBA_Environment *ev) { #ifdef SPI_DEBUG - fprintf (stderr, "generating mouse %s event at %ld, %ld\n", eventName, x, y); + fprintf (stderr, "generating mouse %s event at %ld, %ld\n", eventName, x, y); +#endif +} + +/* Accessibility::DeviceEventController::notifyListenersSync */ +static CORBA_boolean +impl_notify_listeners_sync(PortableServer_Servant servant, + const Accessibility_DeviceEvent *event, + CORBA_Environment *ev) +{ + SpiDeviceEventController *controller = SPI_DEVICE_EVENT_CONTROLLER ( + bonobo_object_from_servant (servant)); + Accessibility_KeyStroke *key_event = (Accessibility_KeyStroke *) event; +#ifdef SPI_DEBUG + g_print ("notifying listeners synchronously: controller %x, event id %d\n", + (void *) controller, (int) event->eventID); +#endif + return (notify_keylisteners (controller->key_listeners, key_event, CORBA_FALSE, ev) ? + CORBA_TRUE : CORBA_FALSE); +} + +/* Accessibility::DeviceEventController::notifyListenersAsync */ +static void +impl_notify_listeners_async (PortableServer_Servant servant, + const Accessibility_DeviceEvent *event, + CORBA_Environment *ev) +{ + SpiDeviceEventController *controller = SPI_DEVICE_EVENT_CONTROLLER( + bonobo_object_from_servant (servant)); + Accessibility_KeyStroke *key_event = (Accessibility_KeyStroke *) event; +#ifdef SPI_DEBUG + fprintf (stderr, "notifying listeners asynchronously\n"); #endif + notify_keylisteners (controller->key_listeners, key_event, CORBA_FALSE, ev); } static void @@ -533,6 +593,8 @@ spi_device_event_controller_class_init (SpiDeviceEventControllerClass *klass) /* epv->registerMouseListener = impl_register_mouse_listener; */ epv->generateKeyEvent = impl_generate_key_event; epv->generateMouseEvent = impl_generate_mouse_event; + epv->notifyListenersSync = impl_notify_listeners_sync; + epv->notifyListenersAsync = impl_notify_listeners_async; klass->check_key_event = _check_key_event; } @@ -557,7 +619,7 @@ spi_device_event_controller_check_key_event (SpiDeviceEventController *controlle SpiDeviceEventController * spi_device_event_controller_new (void *registryp) { - SpiRegistry *registry = SPI_REGISTRY (registryp); + BonoboObject *registry = (BonoboObject *) registryp; SpiDeviceEventController *retval = g_object_new ( SPI_DEVICE_EVENT_CONTROLLER_TYPE, NULL); retval->registry = registry; diff --git a/registryd/deviceeventcontroller.h b/registryd/deviceeventcontroller.h index e5e9e28..e3e8c97 100644 --- a/registryd/deviceeventcontroller.h +++ b/registryd/deviceeventcontroller.h @@ -39,7 +39,7 @@ G_BEGIN_DECLS typedef struct { BonoboObject parent; - struct SpiRegistry *registry; + void *registry; GList *key_listeners; GList *mouse_listeners; GList *keymask_list; diff --git a/registryd/registry.c b/registryd/registry.c index 7e278b5..51a3cb4 100644 --- a/registryd/registry.c +++ b/registryd/registry.c @@ -71,7 +71,7 @@ typedef struct { } SpiListenerStruct; /* static function prototypes */ -static void _registry_notify_listeners ( GList *listeners, +static void _registry_notify_listeners (GList *listeners, const Accessibility_Event *e, CORBA_Environment *ev); @@ -258,7 +258,7 @@ impl_accessibility_registry_deregister_application (PortableServer_Servant serva CORBA_Environment * ev) { SpiRegistry *registry = SPI_REGISTRY (bonobo_object_from_servant (servant)); - GList *list = g_list_find_custom (registry->desktop->applications, &application, compare_corba_objects); + GList *list = g_list_find_custom (registry->desktop->applications, application, compare_corba_objects); #ifdef SPI_DEBUG gint i; @@ -272,15 +272,18 @@ impl_accessibility_registry_deregister_application (PortableServer_Servant serva registry->desktop->applications = g_list_delete_link (registry->desktop->applications, list); #ifdef SPI_DEBUG fprintf (stderr, "there are now %d apps registered.\n", g_list_length (registry->desktop->applications)); - for (i = 0; i < g_list_length (registry->desktop->applications); ++i) { + for (i = 0; i < g_list_length (registry->desktop->applications); ++i) + { fprintf (stderr, "getting application %d\n", i); fprintf (stderr, "object address %p\n", - g_list_nth_data (registry->desktop->applications, i)); - } + g_list_nth_data (registry->desktop->applications, i)); + } #endif } else - fprintf (stderr, "could not deregister application\n"); + { + fprintf (stderr, "could not deregister application %p\n", application); + } } /* @@ -523,16 +526,17 @@ _get_unique_id () } static void -_registry_notify_listeners ( GList *listeners, - const Accessibility_Event *e, +_registry_notify_listeners (GList *listeners, + const Accessibility_Event *e_in, CORBA_Environment *ev) { int n; int len; SpiListenerStruct *ls; EventTypeStruct etype; + Accessibility_Event *e_out; guint minor_hash; - parse_event_type (&etype, e->type); + parse_event_type (&etype, e_in->type); minor_hash = g_str_hash (g_strconcat (etype.major, etype.minor, NULL)); len = g_list_length (listeners); @@ -547,13 +551,16 @@ _registry_notify_listeners ( GList *listeners, { #ifdef SPI_DEBUG fprintf(stderr, "notifying listener #%d\n", n); - fprintf(stderr, "event source name %s\n", Accessibility_Accessible__get_name(e->source, ev)); + fprintf(stderr, "event source name %s\n", Accessibility_Accessible__get_name(e_in->source, ev)); #endif - e->source = CORBA_Object_duplicate (e->source, ev); - Accessibility_Accessible_ref ( e->source, ev); + e_out = ORBit_copy_value (e_in, TC_Accessibility_Event); + e_out->source = CORBA_Object_duplicate (e_in->source, ev); + Accessibility_Accessible_ref ( e_out->source, ev); Accessibility_EventListener_notifyEvent ((Accessibility_EventListener) ls->listener, - e, + e_out, ev); + /* is it safe to free e_out now ? notifyEvent is a oneway... */ + CORBA_free (e_out); if (ev->_major != CORBA_NO_EXCEPTION) { fprintf(stderr, ("Accessibility app error: exception during event notification: %s\n"), diff --git a/test/simple-at.c b/test/simple-at.c index 94fa106..1a532a4 100644 --- a/test/simple-at.c +++ b/test/simple-at.c @@ -237,11 +237,16 @@ static boolean report_key_event (void *p) { AccessibleKeyStroke *key = (AccessibleKeyStroke *) p; - fprintf(stderr, "KeyEvent %s%c (keycode %d)\n", + fprintf (stderr, "KeyEvent %s%c (keycode %d)\n", (key->modifiers & SPI_KEYMASK_ALT)?"Alt-":"", ((key->modifiers & SPI_KEYMASK_SHIFT)^(key->modifiers & SPI_KEYMASK_SHIFTLOCK))? (char) toupper((int) key->keyID) : (char) tolower((int) key->keyID), (int) key->keycode); + fprintf (stderr, "Key:\tsym %ld\n\tmods %x\n\tcode %d\n\ttime %ld\n", + (long) key->keyID, + (unsigned int) key->modifiers, + (int) key->keycode, + (long int) key->timestamp); return is_command_key (key); }