dbus_bool_t consumed = FALSE;
dbus_error_init(&error);
- if (spi_dbus_marshall_deviceEvent(message, key_event))
+ if (spi_dbus_marshal_deviceEvent(message, key_event))
{
DBusMessage *reply = dbus_connection_send_with_reply_and_block(this_app->droute.bus, message, 1000, &error);
if (reply)
#include <bonobo/bonobo-object.h>
#include <atk/atkobject.h>
#include <libspi/Accessibility.h>
-#include <libspi/keymasks.h>
+#include <spi-common/keymasks.h>
G_BEGIN_DECLS
#include <libspi/listener.h>
#include <libspi/eventlistener.h>
#include <libspi/devicelistener.h>
-#include <libspi/keymasks.h>
+#include <spi-common/keymasks.h>
#include <libspi/remoteobject.h>
#include <libspi/streamablecontent.h>
return reply;
}
+static DBusMessage *
+impl_desktop_get_children (DBusConnection *bus, DBusMessage *message, void *user_data)
+{
+ SpiDesktop *desktop = SPI_REGISTRY(user_data)->desktop;
+ DBusError error;
+ gint count;
+ gint i;
+ Application *app;
+ const char *path;
+ DBusMessage *reply;
+ DBusMessageIter iter, iter_array;
+
+ reply = dbus_message_new_method_return (message);
+ if (!reply) return NULL;
+ dbus_message_iter_init_append (reply, &iter);
+ if (!dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY, "o", &iter_array))
+ {
+ goto oom;
+ }
+ count = g_list_length (desktop->applications);
+ for (i = 0; i < count; i++)
+ {
+ app = g_list_nth_data (desktop->applications, i);
+ path = (app? app->path: SPI_DBUS_PATH_NULL);
+ dbus_message_iter_append_basic (&iter_array, DBUS_TYPE_OBJECT_PATH, &path);
+ }
+ if (!dbus_message_iter_close_container (&iter, &iter_array))
+ {
+ goto oom;
+ }
+ return reply;
+oom:
+ // TODO: Handle out of memory
+ return reply;
+}
+
static void
spi_desktop_exiting (void)
{
static DRouteMethod methods[] =
{
{ impl_desktop_get_child_at_index, "getChildAtIndex" },
+ { impl_desktop_get_children, "getChildren" },
{ NULL, NULL }
};
void
spi_registry_initialize_desktop_interface (DRouteData * data)
{
- droute_add_interface (data, "org.freedesktop.atspi.Desktop", methods,
+ droute_add_interface (data, "org.freedesktop.atspi.Accessible", methods,
properties, NULL, NULL);
};
#include <gdk/gdkwindow.h>
#include <atk-adaptor/spi-private.h>
-#include <atk-adaptor/keymasks.h>
+#include <spi-common/keymasks.h>
#include <droute/droute.h>
#include <spi-common/spi-dbus.h>
#include <spi-common/spi-types.h>
dbus_bool_t consumed = FALSE;
dbus_error_init(&error);
- if (spi_dbus_marshall_deviceEvent(message, key_event))
+ if (spi_dbus_marshal_deviceEvent(message, key_event))
{
// TODO: Evaluate performance: perhaps rework this whole architecture
// to avoid blocking calls
dbus_bool_t ret;
DBusMessage *reply;
- if (!spi_dbus_demarshall_deviceEvent(message, &event))
+ if (!spi_dbus_demarshal_deviceEvent(message, &event))
{
return spi_dbus_general_error (message);
}
Accessibility_DeviceEvent event;
DBusMessage *reply;
- if (!spi_dbus_demarshall_deviceEvent(message, &event))
+ if (!spi_dbus_demarshal_deviceEvent(message, &event))
{
return spi_dbus_general_error (message);
}
return TRUE;
}
-dbus_bool_t spi_dbus_marshall_deviceEvent(DBusMessage *message, const Accessibility_DeviceEvent *e)
+dbus_bool_t spi_dbus_marshal_deviceEvent(DBusMessage *message, const Accessibility_DeviceEvent *e)
{
DBusMessageIter iter;
return spi_dbus_message_iter_append_struct(&iter, DBUS_TYPE_UINT32, &e->type, DBUS_TYPE_INT32, &e->id, DBUS_TYPE_INT16, &e->hw_code, DBUS_TYPE_INT16, &e->modifiers, DBUS_TYPE_INT32, &e->timestamp, DBUS_TYPE_STRING, &e->event_string, DBUS_TYPE_BOOLEAN, &e->is_text, DBUS_TYPE_INVALID);
}
-dbus_bool_t spi_dbus_demarshall_deviceEvent(DBusMessage *message, Accessibility_DeviceEvent *e)
+dbus_bool_t spi_dbus_demarshal_deviceEvent(DBusMessage *message, Accessibility_DeviceEvent *e)
{
DBusMessageIter iter;
dbus_message_iter_init(message, &iter);
return spi_dbus_message_iter_get_struct(&iter, DBUS_TYPE_UINT32, &e->type, DBUS_TYPE_INT32, &e->id, DBUS_TYPE_INT16, &e->hw_code, DBUS_TYPE_INT16, &e->modifiers, DBUS_TYPE_INT32, &e->timestamp, DBUS_TYPE_STRING, &e->event_string, DBUS_TYPE_BOOLEAN, &e->is_text, DBUS_TYPE_INVALID);
}
+
+dbus_bool_t spi_dbus_get_simple_property (DBusConnection *bus, const char *dest, const char *path, const char *interface, const char *prop, int *type, void *ptr, DBusError *error)
+{
+ DBusMessage *message, *reply;
+ DBusMessageIter iter, iter_variant;
+ int typ;
+
+ dbus_error_init (error);
+ message = dbus_message_new_method_call (dest, path, "org.freedesktop.DBus.Properties", "get");
+ if (!message) return FALSE;
+ if (!dbus_message_append_args (message, DBUS_TYPE_STRING, &interface, DBUS_TYPE_STRING, &prop, DBUS_TYPE_INVALID))
+ {
+ return FALSE;
+ }
+ reply = dbus_connection_send_with_reply_and_block (bus, message, 1000, error);
+ dbus_message_unref (message);
+ if (!reply) return FALSE;
+ dbus_message_iter_init (reply, &iter);
+ dbus_message_iter_recurse (&iter, &iter_variant);
+ typ = dbus_message_iter_get_arg_type (&iter_variant);
+ if (type) *type = typ;
+ if (typ == DBUS_TYPE_INVALID || typ == DBUS_TYPE_STRUCT || typ == DBUS_TYPE_ARRAY)
+ {
+ return FALSE;
+ }
+ dbus_message_iter_get_basic (&iter_variant, ptr);
+ dbus_message_unref (reply);
+ return TRUE;
+}
#define SPI_DBUS_INTERFACE_DEC "org.freedesktop.atspi.deviceEventController"
#define SPI_DBUS_PATH_DESKTOP "/org/freedesktop/atspi/registry/desktop"
#define SPI_DBUS_PATH_NULL "/"
+#define SPI_DBUS_INTERFACE_ACCESSIBLE "org.freedesktop.atspi.Accessible"
DBusMessage *spi_dbus_general_error(DBusMessage *message);
DBusMessage *spi_dbus_return_rect(DBusMessage *message, gint ix, gint iy, gint iwidth, gint iheight);
dbus_bool_t spi_dbus_message_iter_append_struct(DBusMessageIter *iter, ...);
dbus_bool_t spi_dbus_marshall_deviceEvent(DBusMessage *message, const Accessibility_DeviceEvent *e);
dbus_bool_t spi_dbus_demarshall_deviceEvent(DBusMessage *message, Accessibility_DeviceEvent *e);
+dbus_bool_t spi_dbus_get_simple_property (DBusConnection *bus, const char *dest, const char *path, const char *interface, const char *prop, int *type, void *ptr, DBusError *error);
#endif /* SPI_DBUS_H_ */