Merge branch 'master' of git+ssh://doffm@git.freedesktop.org/git/at-spi2/at-spi2...
authorMark Doffman <mdoff@silver-wind.(none)>
Thu, 22 Jan 2009 14:38:17 +0000 (14:38 +0000)
committerMark Doffman <mdoff@silver-wind.(none)>
Thu, 22 Jan 2009 14:38:17 +0000 (14:38 +0000)
Conflicts:

atk-adaptor/atk-dbus.c
atk-adaptor/tree.c
registryd/deviceeventcontroller.c

cspi/spi-main.c
registryd/deviceeventcontroller.c
spi-common/spi-dbus.h
spi-common/spi-stateset.c
xml/org.freedesktop.atspi.Event.xml

index e824c6a..aeda398 100644 (file)
@@ -93,6 +93,7 @@ static const char *interfaces[] =
   SPI_DBUS_INTERFACE_ACCESSIBLE,
   SPI_DBUS_INTERFACE_ACTION,
   SPI_DBUS_INTERFACE_APPLICATION,
+  SPI_DBUS_INTERFACE_COLLECTION,
   SPI_DBUS_INTERFACE_COMPONENT,
   SPI_DBUS_INTERFACE_DOCUMENT,
   SPI_DBUS_INTERFACE_EDITABLE_TEXT,
@@ -218,7 +219,8 @@ cspi_object_unref_internal (Accessible *accessible, gboolean defunct)
     {
       g_free (accessible->v.path);
     }
-    spi_state_set_cache_unref (accessible->states);
+    if (accessible->states)
+      spi_state_set_cache_unref (accessible->states);
     g_free (accessible->description);
     g_free (accessible->name);
     g_free(accessible);
@@ -377,7 +379,7 @@ handle_additions (CSpiApplication*app, GArray *additions)
     a->states = spi_state_set_cache_new (ca->state_bitflags);
     g_array_free (ca->interfaces, TRUE);
     g_array_free (ca->children, TRUE);
-    g_array_free (ca->state_bitflags, TRUE);
+    /* spi_state_set_cache_new frees state_bitflags */
     /* This is a bit of a hack since ref_accessible sets ref_count to 2
      * for a new object, one of the refs being for the cache */
     cspi_object_unref (a);
@@ -556,7 +558,7 @@ typedef struct
   GArray *removals;
 } CacheSignalData;
 
-static const char *cacheSignalType = "a(ooaoassus)ao";
+static const char *cacheSignalType = "a(ooaoassusau)ao";
 
 static DBusHandlerResult
 cspi_dbus_handle_update_tree (DBusConnection *bus, DBusMessage *message, void *user_data)
@@ -631,7 +633,7 @@ cspi_dbus_filter (DBusConnection *bus, DBusMessage *message, void *data)
   char *bus_name;
 
   if (type == DBUS_MESSAGE_TYPE_SIGNAL &&
-      !strcmp (interface, SPI_DBUS_INTERFACE_ACCESSIBLE))
+      !strncmp (interface, "org.freedesktop.atspi.Event.", 28))
   {
     return cspi_dbus_handle_event (bus, message, data);
   }
@@ -643,17 +645,28 @@ cspi_dbus_filter (DBusConnection *bus, DBusMessage *message, void *data)
   {
     return cspi_dbus_handle_update_tree (bus, message, data);
   }
-  if (dbus_message_is_signal (message, spi_interface_tree, "registerApplication"))
+  if (dbus_message_is_method_call (message, spi_interface_registry, "registerApplication"))
   {
     return cspi_dbus_handle_register_application (bus, message, data);
   }
-  if (dbus_message_is_signal (message, spi_interface_registry, "deregisterApplication"))
+  if (dbus_message_is_method_call (message, spi_interface_registry, "deregisterApplication"))
   {
     return cspi_dbus_handle_deregister_application (bus, message, data);
   }
   return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 }
 
+static const char *signal_interfaces[] =
+{
+  "org.freedesktop.atspi.Event.Object",
+  "org.freedesktop.atspi.Event.Window",
+  "org.freedesktop.atspi.Event.Mouse",
+  "org.freedesktop.atspi.Event.Terminal",
+  "org.freedesktop.atspi.Event.Document",
+  "org.freedesktop.atspi.Event.Focus",
+  NULL
+};
+
 /**
  * SPI_init:
  *
@@ -666,6 +679,7 @@ SPI_init (void)
 {
   DBusError error;
   char *match;
+  int i;
 
   if (SPI_inited)
     {
@@ -693,9 +707,15 @@ SPI_init (void)
   dbus_error_init (&error);
   dbus_bus_add_match (bus, match, &error);
   g_free (match);
-  match = g_strdup_printf ("type='signal',interface='%s'", spi_interface_tree);
+  match = g_strdup_printf ("type='method_call',interface='%s'", spi_interface_registry);
   dbus_bus_add_match (bus, match, &error);
   g_free (match);
+  for (i = 0; signal_interfaces[i]; i++)
+  {
+    match = g_strdup_printf ("type='signal',interface='%s'", signal_interfaces[i]);
+    dbus_bus_add_match (bus, match, &error);
+    g_free (match);
+  }
   return 0;
 }
 
index 3f87a4e..bdc5816 100644 (file)
@@ -341,7 +341,7 @@ spi_dec_clear_unlatch_pending (SpiDEController *controller)
     g_object_get_qdata (G_OBJECT (controller), spi_dec_private_quark);
   priv->xkb_latch_mask = 0;
 }
+
 static void emit(SpiDEController *controller, const char *name, int first_type, ...)
 {
   va_list arg;
@@ -356,7 +356,7 @@ spi_dec_button_update_and_emit (SpiDEController *controller,
                                guint mask_return)
 {
   Accessibility_DeviceEvent mouse_e;
-  gchar event_name[24];
+  gchar event_detail[24];
   gboolean is_consumed = FALSE;
 
   if ((mask_return & mouse_button_mask) !=
@@ -435,7 +435,7 @@ spi_dec_button_update_and_emit (SpiDEController *controller,
        fprintf (stderr, "Button %d %s\n",
                 button_number, (is_down) ? "Pressed" : "Released");
 #endif
-       snprintf (event_name, 22, "mouse:button:%d%c", button_number,
+       snprintf (event_detail, 22, "%d%c", button_number,
                  (is_down) ? 'p' : 'r');
        /* TODO: FIXME distinguish between physical and 
         * logical buttons 
@@ -455,7 +455,7 @@ spi_dec_button_update_and_emit (SpiDEController *controller,
        if (!is_consumed)
          {
            dbus_uint32_t x = last_mouse_pos->x, y = last_mouse_pos->y;
-           emit(controller, event_name, DBUS_TYPE_UINT32, &x, DBUS_TYPE_UINT32, &y, DBUS_TYPE_INVALID);
+           emit(controller, SPI_DBUS_INTERFACE_EVENT_MOUSE, "button", event_detail, x, y);
          }
        else
          spi_dec_set_unlatch_pending (controller, mask_return);
@@ -499,10 +499,10 @@ spi_dec_mouse_check (SpiDEController *controller,
     {
       // TODO: combine these two signals?
       dbus_uint32_t ix = *x, iy = *y;
-      emit(controller, "mouse_abs", DBUS_TYPE_UINT32, &ix, DBUS_TYPE_UINT32, &iy, DBUS_TYPE_INVALID);
+      emit(controller, SPI_DBUS_INTERFACE_EVENT_MOUSE, "abs", NULL, ix, iy);
       ix -= last_mouse_pos->x;
       iy -= last_mouse_pos->y;
-      emit(controller, "mouse_rel", DBUS_TYPE_UINT32, &ix, DBUS_TYPE_UINT32, &iy, DBUS_TYPE_INVALID);
+      emit(controller, SPI_DBUS_INTERFACE_EVENT_MOUSE, "rel", NULL, ix, iy);
       last_mouse_pos->x = *x;
       last_mouse_pos->y = *y;
       *moved = True;
@@ -534,7 +534,7 @@ spi_dec_emit_modifier_event (SpiDEController *controller, guint prev_mask,
 
   d1 = prev_mask & key_modifier_mask;
   d2 = current_mask & key_modifier_mask;
-      emit(controller, "keyboard_modifiers", DBUS_TYPE_UINT32, &d1, DBUS_TYPE_UINT32, &d2, DBUS_TYPE_INVALID);
+      emit(controller, SPI_DBUS_INTERFACE_EVENT_KEYBOARD, "modifiers", NULL, d1, d2);
 }
 
 static gboolean
@@ -1026,7 +1026,7 @@ spi_device_event_controller_forward_mouse_event (SpiDEController *controller,
                                                 XEvent *xevent)
 {
   Accessibility_DeviceEvent mouse_e;
-  gchar event_name[24];
+  gchar event_detail[24];
   gboolean is_consumed = FALSE;
   gboolean xkb_mod_unlatch_occurred;
   XButtonEvent *xbutton_event = (XButtonEvent *) xevent;
@@ -1064,7 +1064,7 @@ spi_device_event_controller_forward_mouse_event (SpiDEController *controller,
           (xevent->type == ButtonPress) ? "Press" : "Release",
           mouse_button_state);
 #endif
-  snprintf (event_name, 22, "mouse:button_%d%c", button,
+  snprintf (event_detail, 22, "%d%c", button,
            (xevent->type == ButtonPress) ? 'p' : 'r');
 
   /* TODO: FIXME distinguish between physical and logical buttons */
@@ -1090,7 +1090,7 @@ spi_device_event_controller_forward_mouse_event (SpiDEController *controller,
       ix = last_mouse_pos->x;
       iy = last_mouse_pos->y;
       /* TODO - Work out which part of the spec this emit is fulfilling */
-      //emit(controller, event_name, DBUS_TYPE_UINT32, &ix, DBUS_TYPE_UINT32, &iy, DBUS_TYPE_INVALID);
+      //emit(controller, SPI_DBUS_INTERFACE_EVENT_MOUSE, "button", event_detail, ix, iy);
     }
 
   xkb_mod_unlatch_occurred = (xevent->type == ButtonPress ||
index 3b85ed5..a2bc5b7 100644 (file)
@@ -42,6 +42,8 @@ extern int _dbg;
 #define SPI_DBUS_INTERFACE_DESKTOP "org.freedesktop.atspi.Desktop"
 #define SPI_DBUS_INTERFACE_DOCUMENT "org.freedesktop.atspi.Document"
 #define SPI_DBUS_INTERFACE_EDITABLE_TEXT "org.freedesktop.atspi.EditableText"
+#define SPI_DBUS_INTERFACE_EVENT_KEYBOARD "org.freedesktop.atspi.Event.Keyboard"
+#define SPI_DBUS_INTERFACE_EVENT_MOUSE "org.freedesktop.atspi.Event.Mouse"
 #define SPI_DBUS_INTERFACE_HYPERLINK "org.freedesktop.atspi.Hyperlink"
 #define SPI_DBUS_INTERFACE_HYPERTEXT "org.freedesktop.atspi.Hypertext"
 #define SPI_DBUS_INTERFACE_IMAGE "org.freedesktop.atspi.Image"
index 35fbcf2..4acf203 100644 (file)
@@ -169,7 +169,6 @@ spi_state_set_cache_from_sequence (const GArray *seq)
   set = atk_state_set_new ();
   atk_state_set_add_states (set, states, seq->len);
 
-  g_free (states);
   g_array_free (seq, TRUE);
   return set;
 }
index 01c1e8e..3a02c3a 100644 (file)
        <signal name="button"><arg direction="out" type="suuv" tp:type="Event"/></signal>
 </interface>
 
+<interface name="org.freedesktop.atspi.Event.Keyboard">
+       <signal name="modifiers"><arg direction="out" type="suuv" tp:type="Event"/></signal>
+</interface>
+
 <interface name="org.freedesktop.atspi.Event.Terminal">
        <signal name="line_changed"><arg direction="out" type="suuv" tp:type="Event"/></signal>
        <signal name="comumncount_changed"><arg direction="out" type="suuv" tp:type="Event"/></signal>