-2001-11-20 Michael Meeks <michael@ximian.com>
+2001-18-11 Bill Haneman <bill.haneman@sun.com>
+
+ * 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 <michael@ximian.com>
* libspi/registry.c
(impl_accessibility_registry_deregister_global_event_listener):
* libspi/application.h: kill unused ( and whacked out )
gboolean *spi_application_set_id (AtkObject *app, long id);
-2001-11-20 Michael Meeks <michael@ximian.com>
+2001-20-11 Michael Meeks <michael@ximian.com>
* libspi/*.[ch]: further convert to bonobo's type func
macros, remove redundnant casts etc.
* */.cvsignore: update
-2001-11-20 Michael Meeks <michael@ximian.com>
+2001-20-11 Michael Meeks <michael@ximian.com>
* libspi/deviceeventcontroller.c
(_controller_register_with_devices): use g_getenv,
* libspi/*.[ch]: more headers, includes and over commenting.
-2001-11-20 Michael Meeks <michael@ximian.com>
+2001-20-11 Michael Meeks <michael@ximian.com>
* libspi/*.[ch]: fixup headers, includes and over commenting.
* libspi/libspi.h: add.
-2001-11-19 Michael Meeks <michael@ximian.com>
+2001-19-11 Michael Meeks <michael@ximian.com>
* libspi/editabletext.c (impl_setAttributes): fix warnings.
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
* 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");
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
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
* 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");
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
{
long keyID;
short keycode;
+ long timestamp;
AccessibleKeyEventType type;
unsigned short modifiers;
} AccessibleKeyStroke;
* 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.
*.
+/*
+ * 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.
+ */
/*
*
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
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);
/**
* 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 ();
};
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;
*
* 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);
*
* 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);
*
* 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);
};
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
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 ();
};
/**
* registerApplication:
* @application: a reference to the requesting @Application
- * return values: void
*
* Register a new application with the accessibility broker.
*
* deregisterApplication:
* @application: a reference to the @Application
* to be deregistered.
- * return values: void
- *
+ *
* De-register an application previously registered with the broker.
*
**/
* @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.
* 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.
* 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.
/**
* 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 ();
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:
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);
/**
* 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 ();
};
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;
*
* 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);
*
* 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);
*
* 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);
};
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
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 ();
};
/**
* registerApplication:
* @application: a reference to the requesting @Application
- * return values: void
*
* Register a new application with the accessibility broker.
*
* deregisterApplication:
* @application: a reference to the @Application
* to be deregistered.
- * return values: void
- *
+ *
* De-register an application previously registered with the broker.
*
**/
* @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.
* 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.
* 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.
/**
* 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 ();
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:
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;
}
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; i<n_listeners && !is_consumed; ++i)
{
Accessibility_KeystrokeListener ls;
- ls = (Accessibility_KeystrokeListener)
+ DEControllerKeyListener *key_listener = (DEControllerKeyListener *)
g_list_nth_data (key_listeners, i);
- if (!CORBA_Object_is_nil(ls, ev))
+ ls = (Accessibility_KeystrokeListener) key_listener->listener.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)
{
#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
{
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 */
}
}
-/*
- * CORBA Accessibility::DeviceEventController::generateMouseEvent
- * method implementation
- */
+/* Accessibility::DeviceEventController::generateMouseEvent */
static void
impl_generate_mouse_event (PortableServer_Servant servant,
const CORBA_long x,
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
/* 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;
}
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;
typedef struct {
BonoboObject parent;
- struct SpiRegistry *registry;
+ void *registry;
GList *key_listeners;
GList *mouse_listeners;
GList *keymask_list;
} 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);
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;
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);
+ }
}
/*
}
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);
{
#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"),
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;
}
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; i<n_listeners && !is_consumed; ++i)
{
Accessibility_KeystrokeListener ls;
- ls = (Accessibility_KeystrokeListener)
+ DEControllerKeyListener *key_listener = (DEControllerKeyListener *)
g_list_nth_data (key_listeners, i);
- if (!CORBA_Object_is_nil(ls, ev))
+ ls = (Accessibility_KeystrokeListener) key_listener->listener.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)
{
#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
{
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 */
}
}
-/*
- * CORBA Accessibility::DeviceEventController::generateMouseEvent
- * method implementation
- */
+/* Accessibility::DeviceEventController::generateMouseEvent */
static void
impl_generate_mouse_event (PortableServer_Servant servant,
const CORBA_long x,
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
/* 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;
}
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;
typedef struct {
BonoboObject parent;
- struct SpiRegistry *registry;
+ void *registry;
GList *key_listeners;
GList *mouse_listeners;
GList *keymask_list;
} 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);
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;
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);
+ }
}
/*
}
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);
{
#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"),
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);
}