diff options
-rw-r--r-- | atspi/Makefile.am | 1 | ||||
-rw-r--r-- | atspi/atspi-accessible.c | 12 | ||||
-rw-r--r-- | atspi/atspi-accessible.h | 1 | ||||
-rw-r--r-- | atspi/atspi-component.c | 74 | ||||
-rw-r--r-- | atspi/atspi-component.h | 25 | ||||
-rw-r--r-- | atspi/atspi-device-listener.h | 2 | ||||
-rw-r--r-- | atspi/atspi-event-listener.c | 179 | ||||
-rw-r--r-- | atspi/atspi-event-listener.h | 50 | ||||
-rw-r--r-- | atspi/atspi-event-types.h | 136 | ||||
-rw-r--r-- | atspi/atspi-registry.h | 2 | ||||
-rw-r--r-- | atspi/atspi-types.h | 108 | ||||
-rw-r--r-- | dbind/dbind-any.c | 22 | ||||
-rw-r--r-- | dbind/dbind-any.h | 4 | ||||
-rw-r--r-- | dbind/dbind.c | 6 |
14 files changed, 370 insertions, 252 deletions
diff --git a/atspi/Makefile.am b/atspi/Makefile.am index 4d0989a7..75ec7199 100644 --- a/atspi/Makefile.am +++ b/atspi/Makefile.am @@ -21,7 +21,6 @@ libatspi_la_SOURCES = \ atspi-component.c \ atspi-component.h \ atspi-constants.h \ - atspi-event-types.h \ atspi-device-listener.c \ atspi-device-listener.h \ atspi-device-listener-private.h \ diff --git a/atspi/atspi-accessible.c b/atspi/atspi-accessible.c index a3c1c8dd..3e2bcb9d 100644 --- a/atspi/atspi-accessible.c +++ b/atspi/atspi-accessible.c @@ -24,7 +24,13 @@ #include "atspi-private.h" #include <string.h> -G_DEFINE_TYPE (AtspiAccessible, atspi_accessible, G_TYPE_OBJECT) +static void +atspi_component_interface_init (AtspiComponent *component) +{ +} + +G_DEFINE_TYPE_WITH_CODE (AtspiAccessible, atspi_accessible, G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE (ATSPI_TYPE_COMPONENT, atspi_component_interface_init)) static void atspi_accessible_init (AtspiAccessible *accessible) @@ -801,8 +807,8 @@ atspi_accessible_get_collection (AtspiAccessible *accessible) * * Get the #AtspiComponent interface for an #AtspiAccessible. * - * Returns: a pointer to an #AtspiComponent interface instance, or - * NULL if @obj does not implement #AtspiComponent. + * Returns: (transfer full): a pointer to an #AtspiComponent interface + * instance, or NULL if @obj does not implement #AtspiComponent. **/ AtspiComponent * atspi_accessible_get_component (AtspiAccessible *accessible) diff --git a/atspi/atspi-accessible.h b/atspi/atspi-accessible.h index 8866f7a4..ee9a7767 100644 --- a/atspi/atspi-accessible.h +++ b/atspi/atspi-accessible.h @@ -39,7 +39,6 @@ #define ATSPI_IS_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ATSPI_TYPE_ACCESSIBLE)) #define ATSPI_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ATSPI_TYPE_ACCESSIBLE, AtspiAccessibleClass)) -typedef struct _AtspiAccessible AtspiAccessible; struct _AtspiAccessible { GObject parent; diff --git a/atspi/atspi-component.c b/atspi/atspi-component.c index 37596554..ca01586e 100644 --- a/atspi/atspi-component.c +++ b/atspi/atspi-component.c @@ -29,6 +29,12 @@ #include "atspi-private.h" +void +atspi_rect_free (AtspiRect *rect) +{ + g_free (rect); +} + static AtspiRect * atspi_rect_copy (AtspiRect *src) { @@ -39,7 +45,7 @@ atspi_rect_copy (AtspiRect *src) dst->width = src->width; } -G_DEFINE_BOXED_TYPE (AtspiRect, atspi_rect, atspi_rect_copy, g_free) +G_DEFINE_BOXED_TYPE (AtspiRect, atspi_rect, atspi_rect_copy, atspi_rect_free) static AtspiPoint * atspi_point_copy (AtspiPoint *src) @@ -72,7 +78,7 @@ atspi_component_contains (AtspiComponent *obj, { dbus_bool_t retval = FALSE; dbus_int32_t d_x = x, d_y = y; - dbus_uint16_t d_ctype = ctype; + dbus_uint32_t d_ctype = ctype; g_return_val_if_fail (obj != NULL, FALSE); @@ -82,7 +88,7 @@ atspi_component_contains (AtspiComponent *obj, } /** - * atspi_component_ref_accessible_at_point: + * atspi_component_get_accessible_at_point: * @obj: a pointer to the #AtspiComponent to query. * @x: a #gint specifying the x coordinate of the point in question. * @y: a #gint specifying the y coordinate of the point in question. @@ -91,12 +97,12 @@ atspi_component_contains (AtspiComponent *obj, * * Get the accessible child at a given coordinate within an #AtspiComponent. * - * Returns: a pointer to an #AtspiAccessible child of the specified component - * which contains the point (@x, @y), or NULL of no child contains - * the point. + * Returns: (transfer full): a pointer to an #AtspiAccessible child of the + * specified component which contains the point (@x, @y), or NULL of + * no child contains the point. **/ AtspiAccessible * -atspi_component_ref_accessible_at_point (AtspiComponent *obj, +atspi_component_get_accessible_at_point (AtspiComponent *obj, gint x, gint y, AtspiCoordType ctype, GError **error) @@ -117,31 +123,26 @@ atspi_component_ref_accessible_at_point (AtspiComponent *obj, /** * atspi_component_get_extents: * @obj: a pointer to the #AtspiComponent to query. - * @x: a pointer to a #int into which the minimum x coordinate will be returned. - * @y: a pointer to a #int into which the minimum y coordinate will be returned. - * @width: a pointer to a #int into which the x extents (width) will be returned. - * @height: a pointer to a #int into which the y extents (height) will be returned. * @ctype: the desired coordinate system into which to return the results, * (e.g. ATSPI_COORD_TYPE_WINDOW, ATSPI_COORD_TYPE_SCREEN). * + * Returns: A #AtspiRect giving the accessible's extents. + * * Get the bounding box of the specified #AtspiComponent. * **/ -AtspiRect +AtspiRect * atspi_component_get_extents (AtspiComponent *obj, - gint *x, - gint *y, - gint *width, - gint *height, AtspiCoordType ctype, GError **error) { - dbus_int16_t d_ctype = ctype; + dbus_uint32_t d_ctype = ctype; AtspiRect bbox; - g_return_if_fail (obj != NULL); + bbox.x = bbox.y = bbox.width = bbox.height = 0; + g_return_val_if_fail (obj != NULL, atspi_rect_copy (&bbox)); - _atspi_dbus_call (obj, atspi_interface_component, "GetExtents", error, "n=>(iiii)", d_ctype, &bbox); - return bbox; + _atspi_dbus_call (obj, atspi_interface_component, "GetExtents", error, "u=>(iiii)", d_ctype, &bbox); + return atspi_rect_copy (&bbox); } /** @@ -154,7 +155,7 @@ atspi_component_get_extents (AtspiComponent *obj, * Get the minimum x and y coordinates of the specified #AtspiComponent. * **/ -AtspiPoint +AtspiPoint * atspi_component_get_position (AtspiComponent *obj, AtspiCoordType ctype, GError **error) { @@ -165,24 +166,24 @@ atspi_component_get_position (AtspiComponent *obj, ret.x = ret.y = 0; if (!obj) - return ret; + return atspi_point_copy (&ret); - _atspi_dbus_call (obj, atspi_interface_component, "GetPosition", error, "n=>ii", d_ctype, &d_x, &d_y); + _atspi_dbus_call (obj, atspi_interface_component, "GetPosition", error, "u=>ii", d_ctype, &d_x, &d_y); ret.x = d_x; ret.y = d_y; - return ret; + return atspi_point_copy (&ret); } /** * atspi_component_get_size: * @obj: a pointer to the #AtspiComponent to query. - * returns: A #AtspiPoint giving the siize. + * returns: A #AtspiPoint giving the size. * * Get the size of the specified #AtspiComponent. * **/ -AtspiPoint +AtspiPoint * atspi_component_get_size (AtspiComponent *obj, GError **error) { dbus_int32_t d_w, d_h; @@ -190,12 +191,12 @@ atspi_component_get_size (AtspiComponent *obj, GError **error) ret.x = ret.y = 0; if (!obj) - return ret; + return atspi_point_copy (&ret); _atspi_dbus_call (obj, atspi_interface_component, "GetSize", error, "=>ii", &d_w, &d_h); ret.x = d_w; ret.y = d_h; - return ret; + return atspi_point_copy (&ret); } /** @@ -278,22 +279,6 @@ atspi_component_get_alpha (AtspiComponent *obj, GError **error) static void atspi_component_base_init (AtspiComponent *klass) { - static gboolean initialized = FALSE; - - if (! initialized) - { - klass->contains = atspi_component_contains; - klass->ref_accessible_at_point = atspi_component_ref_accessible_at_point; - klass->get_extents = atspi_component_get_extents; - klass->get_position = atspi_component_get_position; - klass->get_size = atspi_component_get_size; - klass->get_layer = atspi_component_get_layer; - klass->get_mdi_z_order = atspi_component_get_mdi_z_order; - klass->grab_focus = atspi_component_grab_focus; - klass->get_alpha = atspi_component_get_alpha; - - initialized = TRUE; - } } GType @@ -307,7 +292,6 @@ atspi_component_get_type (void) sizeof (AtspiComponent), (GBaseInitFunc) atspi_component_base_init, (GBaseFinalizeFunc) NULL, - }; type = g_type_register_static (G_TYPE_INTERFACE, "AtspiComponent", &tinfo, 0); diff --git a/atspi/atspi-component.h b/atspi/atspi-component.h index 86fa5c35..1a0d5bdb 100644 --- a/atspi/atspi-component.h +++ b/atspi/atspi-component.h @@ -27,9 +27,10 @@ #include "glib-object.h" -#include "atspi-accessible.h" #include "atspi-constants.h" +#include "atspi-types.h" + typedef struct _AtspiRect AtspiRect; struct _AtspiRect { @@ -46,6 +47,8 @@ struct _AtspiRect */ #define ATSPI_TYPE_RECT (atspi_rect_get_type ()) +GType atspi_rect_get_type (); + typedef struct _AtspiPoint AtspiPoint; struct _AtspiPoint { @@ -60,6 +63,8 @@ struct _AtspiPoint */ #define ATSPI_TYPE_POINT (atspi_point_get_type ()) +GType atspi_point_get_type (); + #define ATSPI_TYPE_COMPONENT (atspi_component_get_type ()) #define ATSPI_IS_COMPONENT(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_COMPONENT) #define ATSPI_COMPONENT(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_COMPONENT, AtspiComponent) @@ -70,27 +75,17 @@ GType atspi_component_get_type (); struct _AtspiComponent { GTypeInterface parent; - gboolean (*contains) (AtspiComponent *component, gint x, gint y, AtspiCoordType ctype, GError **error); - AtspiAccessible *(*ref_accessible_at_point) (AtspiComponent *component, gint x, gint y, AtspiCoordType ctype, GError **error); - AtspiRect (*get_extents) (AtspiComponent *component, gint *x, gint *y, gint *width, gint *height, AtspiCoordType ctype, GError **error); - AtspiPoint (*get_position) (AtspiComponent *component, AtspiCoordType ctype, GError **error); - AtspiPoint (*get_size) (AtspiComponent *component, GError **error); - AtspiComponentLayer (*get_layer) (AtspiComponent *component, GError **error); - - gshort (*get_mdi_z_order) (AtspiComponent *component, GError **error); - gboolean (*grab_focus) (AtspiComponent *component, GError **error); - gdouble (*get_alpha) (AtspiComponent *component, GError **error); }; gboolean atspi_component_contains (AtspiComponent *obj, gint x, gint y, AtspiCoordType ctype, GError **error); -AtspiAccessible *atspi_component_ref_accessible_at_point (AtspiComponent *obj, gint x, gint y, AtspiCoordType ctype, GError **error); +AtspiAccessible *atspi_component_get_accessible_at_point (AtspiComponent *obj, gint x, gint y, AtspiCoordType ctype, GError **error); -AtspiRect atspi_component_get_extents (AtspiComponent *obj, gint *x, gint *y, gint *width, gint *height, AtspiCoordType ctype, GError **error); +AtspiRect *atspi_component_get_extents (AtspiComponent *obj, AtspiCoordType ctype, GError **error); -AtspiPoint atspi_component_get_position (AtspiComponent *obj, AtspiCoordType ctype, GError **error); +AtspiPoint *atspi_component_get_position (AtspiComponent *obj, AtspiCoordType ctype, GError **error); -AtspiPoint atspi_component_get_size (AtspiComponent *obj, GError **error); +AtspiPoint *atspi_component_get_size (AtspiComponent *obj, GError **error); AtspiComponentLayer atspi_component_get_layer (AtspiComponent *obj, GError **error); diff --git a/atspi/atspi-device-listener.h b/atspi/atspi-device-listener.h index 113ca006..bf78935f 100644 --- a/atspi/atspi-device-listener.h +++ b/atspi/atspi-device-listener.h @@ -27,7 +27,7 @@ #include "glib-object.h" -#include "atspi-event-types.h" +#include "atspi-types.h" /** * AtspiDeviceListenerCB: diff --git a/atspi/atspi-event-listener.c b/atspi/atspi-event-listener.c index ce3c3902..b1342330 100644 --- a/atspi/atspi-event-listener.c +++ b/atspi/atspi-event-listener.c @@ -34,15 +34,106 @@ typedef struct char *detail; } EventListenerEntry; -/* - * Misc. helpers. - */ +G_DEFINE_TYPE (AtspiEventListener, atspi_event_listener, G_TYPE_OBJECT) -/* - * Standard event dispatcher +void +atspi_event_listener_init (AtspiEventListener *listener) +{ +} + +void +atspi_event_listener_class_init (AtspiEventListenerClass *klass) +{ +} + +static void +remove_datum (const AtspiEvent *event, void *user_data) +{ + AtspiEventListenerSimpleCB cb = user_data; + cb (event); +} + +typedef struct +{ + gpointer callback; + GDestroyNotify callback_destroyed; + gint ref_count; +} CallbackInfo; +static GHashTable *callbacks; + +void +callback_ref (void *callback, GDestroyNotify *callback_destroyed) +{ + CallbackInfo *info; + + if (!callbacks) + { + callbacks = g_hash_table_new (g_direct_hash, g_direct_equal); + if (!callbacks) + return; + } + + info = g_hash_table_lookup (callbacks, callback); + if (!info) + { + info = g_new (CallbackInfo, 1); + if (!info) + return; + info->callback = callback; + info->callback_destroyed = callback_destroyed; + info->ref_count = 1; + g_hash_table_insert (callbacks, callback, info); + } + else + info->ref_count++; +} + +void +callback_unref (gpointer callback) +{ + CallbackInfo *info; + + if (!callbacks) + return; + info = g_hash_table_lookup (callbacks, callback); + if (!info) + { + g_warning ("Atspi: Dereferencing invalid callback %p\n", callback); + return; + } + info->ref_count--; + if (info->ref_count == 0) + { +#if 0 + /* TODO: Figure out why this seg faults from Python */ + if (info->callback_destroyed) + (*info->callback_destroyed) (info->callback); +#endif + g_free (info); + g_hash_table_remove (callbacks, callback); + } +} + +/** + * atspi_event_listener_new_simple: + * @callback: (scope notified): An #AtspiEventListenerSimpleCB to be called + * when an event is fired. + * @callback_destroyed: A #GDestroyNotify called when the listener is freed + * and data associated with the callback should be freed. Can be NULL. + * + * Returns: (transfer full): A new #AtspiEventListener. */ +AtspiEventListener * +atspi_event_listener_new_simple (AtspiEventListenerSimpleCB callback, + GDestroyNotify callback_destroyed) +{ + AtspiEventListener *listener = g_object_new (ATSPI_TYPE_EVENT_LISTENER, NULL); + listener->callback = remove_datum; + callback_ref (remove_datum, callback_destroyed); + listener->user_data = callback; + listener->cb_destroyed = callback_destroyed; +} -static guint listener_id = 0; static GList *event_listeners = NULL; static gchar * @@ -263,18 +354,17 @@ oom: static void listener_entry_free (EventListenerEntry *e) { + gpointer callback = (e->callback = remove_datum ? e->user_data : e->callback); g_free (e->category); g_free (e->name); if (e->detail) g_free (e->detail); - if (e->callback_destroyed) - (*e->callback_destroyed) (e->callback); + callback_unref (callback); g_free (e); } /** * atspi_event_listener_register: - * @callback: (scope notified): the #AtspiEventListenerCB to be registered against - * an event type. + * @listener: The #AtspiEventListener to register against an event type. * @user_data: (closure): User data to be passed to the callback. * @callback_destroyed: A #GDestroyNotify called when the callback is destroyed. * @event_type: a character string indicating the type of events for which @@ -363,10 +453,33 @@ listener_entry_free (EventListenerEntry *e) * Returns: #TRUE if successful, otherwise #FALSE. **/ gboolean -atspi_event_listener_register (AtspiEventListenerCB callback, - void *user_data, - GDestroyNotify callback_destroyed, - const gchar *event_type) +atspi_event_listener_register (AtspiEventListener *listener, + const gchar *event_type) +{ + /* TODO: Keep track of which events have been registered, so that we + * deregister all of them when the event listener is destroyed */ + + return atspi_event_listener_register_from_callback (listener->callback, + listener->user_data, + listener->cb_destroyed, + event_type); +} + +/** + * atspi_event_listener_register_from_callback: + * @callback: (scope notified): the #AtspiEventListenerCB to be registered against + * an event type. + * @user_data: (closure): User data to be passed to the callback. + * @callback_destroyed: A #GDestroyNotify called when the callback is destroyed. + * @event_type: a character string indicating the type of events for which + * notification is requested. See #atspi_event_listener_register + * for a description of the format. + */ +gboolean +atspi_event_listener_register_from_callback (AtspiEventListenerCB callback, + void *user_data, + GDestroyNotify callback_destroyed, + const gchar *event_type) { EventListenerEntry *e; char *matchrule; @@ -384,6 +497,8 @@ atspi_event_listener_register (AtspiEventListenerCB callback, e->callback = callback; e->user_data = user_data; e->callback_destroyed = callback_destroyed; + callback_ref (callback == remove_datum ? user_data : callback, + callback_destroyed); if (!convert_event_type_to_dbus (event_type, &e->category, &e->name, &e->detail, &matchrule)) { g_free (e); @@ -417,13 +532,6 @@ atspi_event_listener_register (AtspiEventListenerCB callback, return TRUE; } -void -remove_datum (const AtspiEvent *event, void *user_data) -{ - AtspiEventListenerSimpleCB cb = user_data; - cb (event); -} - /** * atspi_event_listener_register_no_data: * @callback: (scope notified): the #AtspiEventListenerSimpleCB to be @@ -444,7 +552,7 @@ atspi_event_listener_register_no_data (AtspiEventListenerSimpleCB callback, GDestroyNotify callback_destroyed, const gchar *event_type) { - return atspi_event_listener_register (remove_datum, callback, callback_destroyed, event_type); + return atspi_event_listener_register_from_callback (remove_datum, callback, callback_destroyed, event_type); } static gboolean @@ -457,6 +565,24 @@ is_superset (const gchar *super, const gchar *sub) /** * atspi_event_listener_deregister: + * @listener: The #AtspiEventListener to deregister. + * @event_type: a string specifying the event type for which this + * listener is to be deregistered. + * + * deregisters an #AtspiEventListener from the registry, for a specific + * event type. + * + * Returns: #TRUE if successful, otherwise #FALSE. + **/ +gboolean +atspi_event_listener_deregister (AtspiEventListener *listener, + const gchar *event_type) +{ + atspi_event_listener_deregister_from_callback (listener->callback, listener->user_data, event_type); +} + +/** + * atspi_event_listener_deregister_from_callback: * @callback: (scope call): the #AtspiEventListenerCB registered against an * event type. * @user_data: (closure): User data that was passed in for this callback. @@ -469,9 +595,9 @@ is_superset (const gchar *super, const gchar *sub) * Returns: #TRUE if successful, otherwise #FALSE. **/ gboolean -atspi_event_listener_deregister (AtspiEventListenerCB callback, - void *user_data, - const gchar *event_type) +atspi_event_listener_deregister_from_callback (AtspiEventListenerCB callback, + void *user_data, + const gchar *event_type) { char *category, *name, *detail, *matchrule; GList *l; @@ -537,7 +663,8 @@ gboolean atspi_event_listener_deregister_no_data (AtspiEventListenerSimpleCB callback, const gchar *event_type) { - return atspi_event_listener_deregister (remove_datum, callback, event_type); + return atspi_event_listener_deregister_from_callback (remove_datum, callback, + event_type); } void diff --git a/atspi/atspi-event-listener.h b/atspi/atspi-event-listener.h index edc32daf..25c1b409 100644 --- a/atspi/atspi-event-listener.h +++ b/atspi/atspi-event-listener.h @@ -27,7 +27,7 @@ #include "glib-object.h" -#include "atspi-event-types.h" +#include "atspi-types.h" /** * AtspiEventListenerCB: @@ -49,21 +49,57 @@ typedef void (*AtspiEventListenerCB) (const AtspiEvent *event, **/ typedef void (*AtspiEventListenerSimpleCB) (const AtspiEvent *event); +#define ATSPI_TYPE_EVENT_LISTENER (atspi_event_listener_get_type ()) +#define ATSPI_EVENT_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_EVENT_LISTENER, AtspiEventListener)) +#define ATSPI_EVENT_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ATSPI_TYPE_EVENT_LISTENER, AtspiEventListenerClass)) +#define ATSPI_IS_EVENT_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_EVENT_LISTENER)) +#define ATSPI_IS_EVENT_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ATSPI_TYPE_EVENT_LISTENER)) +#define ATSPI_EVENT_LISTENER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ATSPI_TYPE_EVENT_LISTENER, AtspiEventListenerClass)) + +typedef struct _AtspiEventListener AtspiEventListener; +struct _AtspiEventListener +{ + GObject parent; + AtspiEventListenerCB callback; + void *user_data; + GDestroyNotify cb_destroyed; +}; + +typedef struct _AtspiEventListenerClass AtspiEventListenerClass; +struct _AtspiEventListenerClass +{ + GObjectClass parent_class; +}; + +GType atspi_event_listener_get_type (void); + +AtspiEventListener * +atspi_event_listener_new_simple (AtspiEventListenerSimpleCB callback, + GDestroyNotify callback_destroyed); + gboolean -atspi_event_listener_register (AtspiEventListenerCB callback, - void *user_data, - GDestroyNotify callback_destroyed, +atspi_event_listener_register (AtspiEventListener *listener, const gchar *event_type); gboolean +atspi_event_listener_register_from_callback (AtspiEventListenerCB callback, + void *user_data, + GDestroyNotify callback_destroyed, + const gchar *event_type); + +gboolean atspi_event_listener_register_no_data (AtspiEventListenerSimpleCB callback, GDestroyNotify callback_destroyed, const gchar *event_type); gboolean -atspi_event_listener_deregister (AtspiEventListenerCB callback, - void *user_data, - const gchar *event_type); +atspi_event_listener_deregister (AtspiEventListener *listener, + const gchar *event_type); + +gboolean +atspi_event_listener_deregister_from_callback (AtspiEventListenerCB callback, + void *user_data, + const gchar *event_type); gboolean atspi_event_listener_deregister_no_data (AtspiEventListenerSimpleCB callback, diff --git a/atspi/atspi-event-types.h b/atspi/atspi-event-types.h deleted file mode 100644 index b08713c4..00000000 --- a/atspi/atspi-event-types.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - * AT-SPI - Assistive Technology Service Provider Interface - * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) - * - * Copyright 2001, 2002 Sun Microsystems Inc., - * Copyright 2001, 2002 Ximian, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * 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. - */ - -#ifndef _ATSPI_EVENT_TYPES_H_ -#define _ATSPI_EVENT_TYPES_H_ - -#include <glib.h> - -#include "atspi-accessible.h" -#include "atspi-component.h" /* for AtspiRect */ - -typedef guint AtspiControllerEventMask; - -typedef guint AtspiKeyMaskType; - -typedef guint AtspiKeyEventMask; -typedef guint AtspiDeviceEventMask; - -// TODO: auto-generate the below structs -typedef struct _AtspiDeviceEvent AtspiDeviceEvent; -struct _AtspiDeviceEvent -{ - AtspiEventType type; - guint id; - gushort hw_code; - gushort modifiers; - guint timestamp; - gchar * event_string; - gboolean is_text; -}; - -typedef struct _AtspiEventListenerMode AtspiEventListenerMode; -struct _AtspiEventListenerMode -{ - gboolean synchronous; - gboolean preemptive; - gboolean global; -}; - -typedef struct _AtspiKeyDefinition AtspiKeyDefinition; -struct _AtspiKeyDefinition -{ - gint keycode; - gint keysym; - gchar *keystring; - gint unused; -}; - -typedef struct _AtspiEvent AtspiEvent; -struct _AtspiEvent -{ - gchar *type; - AtspiAccessible *source; - gint detail1; - gint detail2; - GValue any_data; -}; - -/** - * ATSPI_TYPE_RECT: - * - * The #GType for a boxed type holding a #AtspiEvent. - */ -#define ATSPI_TYPE_EVENT (atspi_event_get_type ()) - -typedef void AtspiKeystrokeListener; - -/** - * AtspiKeySet: - * @keysyms: - * @keycodes: - * @len: - * - * Structure containing identifying information about a set of keycode or - * keysyms. - **/ -typedef struct _AtspiKeySet -{ - guint *keysyms; - gushort *keycodes; - gchar **keystrings; - gshort len; -} AtspiKeySet; - -/** - *AtspiKeyListenerSyncType: - *@SPI_KEYLISTENER_NOSYNC: Events may be delivered asynchronously, - * which means in some cases they may already have been delivered to the - * application before the AT client receives the notification. - *@SPI_KEYLISTENER_SYNCHRONOUS: Events are delivered synchronously, before the - * currently focussed application sees them. - *@ATSPI_KEYLISTENER_CANCONSUME: Events may be consumed by the AT client. Presumes and - * requires #ATSPI_KEYLISTENER_SYNCHRONOUS, incompatible with #ATSPI_KEYLISTENER_NOSYNC. - *@SPI_KEYLISTENER_ALL_WINDOWS: Events are received not from the application toolkit layer, but - * from the device driver or windowing system subsystem; such notifications are 'global' in the - * sense that they are not broken or defeated by applications that participate poorly - * in the accessibility APIs, or not at all; however because of the intrusive nature of - * such snooping, it can have side-effects on certain older platforms. If unconditional - * event notifications, even when inaccessible or "broken" applications have focus, are not - * required, it may be best to avoid this enum value/flag. - * - *Specified the tyupe of a key listener event. - * Certain of the values above can and should be bitwise-'OR'ed - * together, observing the compatibility limitations specified in the description of - * each value. For instance, #ATSPI_KEYLISTENER_ALL_WINDOWS | #ATSPI_KEYLISTENER_CANCONSUME is - * a commonly used combination which gives the AT complete control over the delivery of matching - * events. However, such filters should be used sparingly as they may have a negative impact on - * system performance. - **/ -typedef enum { - ATSPI_KEYLISTENER_NOSYNC = 0, - ATSPI_KEYLISTENER_SYNCHRONOUS = 1, - ATSPI_KEYLISTENER_CANCONSUME = 2, - ATSPI_KEYLISTENER_ALL_WINDOWS = 4 -} AtspiKeyListenerSyncType; -#endif /* _ATSPI_EVENT_TYPES_H_ */ diff --git a/atspi/atspi-registry.h b/atspi/atspi-registry.h index f9894cd9..c070d877 100644 --- a/atspi/atspi-registry.h +++ b/atspi/atspi-registry.h @@ -26,7 +26,7 @@ #define _ATSPI_REGISTRY_H_ #include "atspi-accessible.h" -#include "atspi-event-types.h" +#include "atspi-types.h" #include "atspi-device-listener.h" gint atspi_get_desktop_count (); diff --git a/atspi/atspi-types.h b/atspi/atspi-types.h index fba3adb5..076019ed 100644 --- a/atspi/atspi-types.h +++ b/atspi/atspi-types.h @@ -27,8 +27,9 @@ #include "glib-object.h" -#include "atspi-event-types.h" +#include "atspi-constants.h" +typedef struct _AtspiAccessible AtspiAccessible; typedef struct _AtspiAccessible AtspiAction; typedef struct _AtspiAccessible AtspiCollection; typedef struct _AtspiComponent AtspiComponent; @@ -39,4 +40,109 @@ typedef struct _AtspiAccessible AtspiSelection; typedef struct _AtspiAccessible AtspiTable; typedef struct _AtspiAccessible AtspiText; typedef struct _AtspiAccessible AtspiValue; + +typedef guint AtspiControllerEventMask; + +typedef guint AtspiKeyMaskType; + +typedef guint AtspiKeyEventMask; +typedef guint AtspiDeviceEventMask; + +// TODO: auto-generate the below structs +typedef struct _AtspiDeviceEvent AtspiDeviceEvent; +struct _AtspiDeviceEvent +{ + AtspiEventType type; + guint id; + gushort hw_code; + gushort modifiers; + guint timestamp; + gchar * event_string; + gboolean is_text; +}; + +typedef struct _AtspiEventListenerMode AtspiEventListenerMode; +struct _AtspiEventListenerMode +{ + gboolean synchronous; + gboolean preemptive; + gboolean global; +}; + +typedef struct _AtspiKeyDefinition AtspiKeyDefinition; +struct _AtspiKeyDefinition +{ + gint keycode; + gint keysym; + gchar *keystring; + gint unused; +}; + +typedef struct _AtspiEvent AtspiEvent; +struct _AtspiEvent +{ + gchar *type; + AtspiAccessible *source; + gint detail1; + gint detail2; + GValue any_data; +}; + +/** + * ATSPI_TYPE_RECT: + * + * The #GType for a boxed type holding a #AtspiEvent. + */ +#define ATSPI_TYPE_EVENT (atspi_event_get_type ()) + +typedef void AtspiKeystrokeListener; + +/** + * AtspiKeySet: + * @keysyms: + * @keycodes: + * @len: + * + * Structure containing identifying information about a set of keycode or + * keysyms. + **/ +typedef struct _AtspiKeySet +{ + guint *keysyms; + gushort *keycodes; + gchar **keystrings; + gshort len; +} AtspiKeySet; + +/** + *AtspiKeyListenerSyncType: + *@SPI_KEYLISTENER_NOSYNC: Events may be delivered asynchronously, + * which means in some cases they may already have been delivered to the + * application before the AT client receives the notification. + *@SPI_KEYLISTENER_SYNCHRONOUS: Events are delivered synchronously, before the + * currently focussed application sees them. + *@ATSPI_KEYLISTENER_CANCONSUME: Events may be consumed by the AT client. Presumes and + * requires #ATSPI_KEYLISTENER_SYNCHRONOUS, incompatible with #ATSPI_KEYLISTENER_NOSYNC. + *@SPI_KEYLISTENER_ALL_WINDOWS: Events are received not from the application toolkit layer, but + * from the device driver or windowing system subsystem; such notifications are 'global' in the + * sense that they are not broken or defeated by applications that participate poorly + * in the accessibility APIs, or not at all; however because of the intrusive nature of + * such snooping, it can have side-effects on certain older platforms. If unconditional + * event notifications, even when inaccessible or "broken" applications have focus, are not + * required, it may be best to avoid this enum value/flag. + * + *Specified the tyupe of a key listener event. + * Certain of the values above can and should be bitwise-'OR'ed + * together, observing the compatibility limitations specified in the description of + * each value. For instance, #ATSPI_KEYLISTENER_ALL_WINDOWS | #ATSPI_KEYLISTENER_CANCONSUME is + * a commonly used combination which gives the AT complete control over the delivery of matching + * events. However, such filters should be used sparingly as they may have a negative impact on + * system performance. + **/ +typedef enum { + ATSPI_KEYLISTENER_NOSYNC = 0, + ATSPI_KEYLISTENER_SYNCHRONOUS = 1, + ATSPI_KEYLISTENER_CANCONSUME = 2, + ATSPI_KEYLISTENER_ALL_WINDOWS = 4 +} AtspiKeyListenerSyncType; #endif /* _ATSPI_TYPES_H_ */ diff --git a/dbind/dbind-any.c b/dbind/dbind-any.c index 95dd9abd..8b224480 100644 --- a/dbind/dbind-any.c +++ b/dbind/dbind-any.c @@ -434,7 +434,7 @@ dbind_any_marshal (DBusMessageIter *iter, void dbind_any_marshal_va (DBusMessageIter *iter, const char **arg_types, - va_list args) + va_list *args) { const char *p = *arg_types; @@ -460,16 +460,16 @@ dbind_any_marshal_va (DBusMessageIter *iter, case DBUS_TYPE_UINT16: case DBUS_TYPE_INT32: case DBUS_TYPE_UINT32: - intarg = va_arg (args, int); + intarg = va_arg (*args, int); arg = &intarg; break; case DBUS_TYPE_INT64: case DBUS_TYPE_UINT64: - int64arg = va_arg (args, dbus_int64_t); + int64arg = va_arg (*args, dbus_int64_t); arg = &int64arg; break; case DBUS_TYPE_DOUBLE: - doublearg = va_arg (args, double); + doublearg = va_arg (*args, double); arg = &doublearg; break; /* ptr types */ @@ -478,21 +478,21 @@ dbind_any_marshal_va (DBusMessageIter *iter, case DBUS_TYPE_SIGNATURE: case DBUS_TYPE_ARRAY: case DBUS_TYPE_DICT_ENTRY: - ptrarg = va_arg (args, void *); + ptrarg = va_arg (*args, void *); arg = &ptrarg; break; case DBUS_STRUCT_BEGIN_CHAR: - ptrarg = va_arg (args, void *); + ptrarg = va_arg (*args, void *); arg = ptrarg; break; case DBUS_DICT_ENTRY_BEGIN_CHAR: - ptrarg = va_arg (args, void *); + ptrarg = va_arg (*args, void *); arg = ptrarg; break; case DBUS_TYPE_VARIANT: fprintf (stderr, "No variant support yet - very toolkit specific\n"); - ptrarg = va_arg (args, void *); + ptrarg = va_arg (*args, void *); arg = &ptrarg; break; default: @@ -502,6 +502,8 @@ dbind_any_marshal_va (DBusMessageIter *iter, if (arg != NULL) dbind_any_marshal (iter, &p, &arg); } + if (*arg_types) + *arg_types = p; } } @@ -633,11 +635,11 @@ dbind_any_demarshal (DBusMessageIter *iter, void dbind_any_demarshal_va (DBusMessageIter *iter, const char **arg_types, - va_list args) + va_list *args) { const char *p = *arg_types; for (;*p != '\0';) { - void *arg = va_arg (args, void *); + void *arg = va_arg (*args, void *); dbind_any_demarshal (iter, &p, &arg); } } diff --git a/dbind/dbind-any.h b/dbind/dbind-any.h index 4aa0b953..ae69caad 100644 --- a/dbind/dbind-any.h +++ b/dbind/dbind-any.h @@ -12,7 +12,7 @@ void dbind_any_marshal (DBusMessageIter *iter, void dbind_any_marshal_va (DBusMessageIter *iter, const const char **arg_types, - va_list args); + va_list *args); void dbind_any_demarshal (DBusMessageIter *iter, const char **type, @@ -20,7 +20,7 @@ void dbind_any_demarshal (DBusMessageIter *iter, void dbind_any_demarshal_va (DBusMessageIter *iter, const char **arg_types, - va_list args); + va_list *args); void dbind_any_free (const char *type, void *ptr_to_ptr); diff --git a/dbind/dbind.c b/dbind/dbind.c index 0f301b5f..9f284e92 100644 --- a/dbind/dbind.c +++ b/dbind/dbind.c @@ -94,7 +94,7 @@ dbind_method_call_reentrant_va (DBusConnection *cnx, p = arg_types; dbus_message_iter_init_append (msg, &iter); - dbind_any_marshal_va (&iter, &p, args); + dbind_any_marshal_va (&iter, &p, &args); reply = dbind_send_and_allow_reentry (cnx, msg, err); if (!reply) @@ -112,7 +112,7 @@ dbind_method_call_reentrant_va (DBusConnection *cnx, DBusMessageIter iter; p += 2; dbus_message_iter_init (reply, &iter); - dbind_any_demarshal_va (&iter, &p, args); + dbind_any_demarshal_va (&iter, &p, &args); } success = TRUE; @@ -203,7 +203,7 @@ dbind_emit_signal_va (DBusConnection *cnx, p = arg_types; dbus_message_iter_init_append (msg, &iter); - dbind_any_marshal_va (&iter, &p, args); + dbind_any_marshal_va (&iter, &p, &args); if (!dbus_connection_send (cnx, msg, NULL)) goto out; |