Device events now use uint32 for hw_code and modifiers in the IPC
authorMike Gorse <mgorse@novell.com>
Thu, 24 Feb 2011 18:28:25 +0000 (12:28 -0600)
committerMike Gorse <mgorse@novell.com>
Thu, 24 Feb 2011 18:28:25 +0000 (12:28 -0600)
Changed device event IPC to use uint32 for hw_code and modifiers, to be
more consistent with the rest of the API.
Kept AT-SPI struct using gushorts to avoid ABI break, and the registry daemon
will continue to accept the old API as well as the new for now.

atspi/atspi-device-listener.c
registryd/de-marshaller.c
registryd/de-types.h
registryd/introspection.c
xml/DeviceEventController.xml
xml/DeviceEventListener.xml

index 0cc6c89..669f874 100644 (file)
@@ -312,8 +312,8 @@ read_device_event_from_iter (DBusMessageIter *iter, AtspiDeviceEvent *event)
 {
   dbus_uint32_t type;
   dbus_int32_t id;
-  dbus_int16_t hw_code;
-  dbus_int16_t modifiers;
+  dbus_int32_t hw_code;
+  dbus_int32_t modifiers;
   dbus_int32_t timestamp;
   dbus_bool_t is_text;
   DBusMessageIter iter_struct;
@@ -328,12 +328,13 @@ read_device_event_from_iter (DBusMessageIter *iter, AtspiDeviceEvent *event)
   event->id = id;
   dbus_message_iter_next (&iter_struct);
 
+  /* TODO: Remove cast from next two on ABI break */
   dbus_message_iter_get_basic (&iter_struct, &hw_code);
-  event->hw_code = hw_code;
+  event->hw_code = (gushort) hw_code;
   dbus_message_iter_next (&iter_struct);
 
   dbus_message_iter_get_basic (&iter_struct, &modifiers);
-  event->modifiers = modifiers;
+  event->modifiers = (gushort) modifiers;
   dbus_message_iter_next (&iter_struct);
 
   dbus_message_iter_get_basic (&iter_struct, &timestamp);
@@ -363,7 +364,7 @@ atspi_dbus_handle_DeviceEvent (DBusConnection *bus, DBusMessage *message, void *
   GList *l;
   DBusMessage *reply;
 
-  if (strcmp (dbus_message_get_signature (message), "(uinnisb)") != 0)
+  if (strcmp (dbus_message_get_signature (message), "(uiuuisb)") != 0)
   {
     g_warning ("Atspi: Unknown signature for an event");
     goto done;
index 3f62686..560020a 100644 (file)
@@ -81,7 +81,7 @@ dbus_bool_t spi_dbus_marshal_deviceEvent(DBusMessage *message, const Accessibili
 
   if (!message) return FALSE;
   dbus_message_iter_init_append(message, &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);
+  return spi_dbus_message_iter_append_struct(&iter, DBUS_TYPE_UINT32, &e->type, DBUS_TYPE_INT32, &e->id, DBUS_TYPE_UINT32, &e->hw_code, DBUS_TYPE_UINT32, &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_demarshal_deviceEvent(DBusMessage *message, Accessibility_DeviceEvent *e)
@@ -89,7 +89,9 @@ dbus_bool_t spi_dbus_demarshal_deviceEvent(DBusMessage *message, Accessibility_D
   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);
+  /* TODO: Remove the || for 2.1 */
+  return spi_dbus_message_iter_get_struct(&iter, DBUS_TYPE_UINT32, &e->type, DBUS_TYPE_INT32, &e->id, DBUS_TYPE_INT32, &e->hw_code, DBUS_TYPE_INT32, &e->modifiers, DBUS_TYPE_INT32, &e->timestamp, DBUS_TYPE_STRING, &e->event_string, DBUS_TYPE_BOOLEAN, &e->is_text, DBUS_TYPE_INVALID) ||
+         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);
 }
 
 /*
index d7020b1..a338e38 100644 (file)
@@ -54,8 +54,8 @@ struct _Accessibility_DeviceEvent
 {
   Accessibility_EventType type;
   dbus_uint32_t id;
-  dbus_uint16_t hw_code;
-  dbus_uint16_t modifiers;
+  dbus_uint32_t hw_code;
+  dbus_uint32_t modifiers;
   dbus_uint32_t timestamp;
   char * event_string;
   dbus_bool_t is_text;
index 837b655..b5daee5 100644 (file)
@@ -812,13 +812,13 @@ const char *spi_org_a11y_atspi_DeviceEventController =
 "  </method>"
 ""
 "  <method name=\"NotifyListenersSync\">"
-"    <arg direction=\"in\" name=\"event\" type=\"(uinnisb)\" />"
+"    <arg direction=\"in\" name=\"event\" type=\"(uiuuisb)\" />"
 "    <arg direction=\"out\" type=\"b\" />"
 "    "
 "  </method>"
 ""
 "  <method name=\"NotifyListenersAsync\">"
-"    <arg direction=\"in\" name=\"event\" type=\"(uinnisb)\" />"
+"    <arg direction=\"in\" name=\"event\" type=\"(uiuuisb)\" />"
 "    "
 "  </method>"
 ""
@@ -829,7 +829,7 @@ const char *spi_org_a11y_atspi_DeviceEventListener =
 "<interface name=\"org.a11y.atspi.DeviceEventListener\" version=\"0.1.7\">"
 ""
 "  <method name=\"NotifyEvent\">"
-"    <arg direction=\"in\" name=\"event\" type=\"(uinnisb)\" />"
+"    <arg direction=\"in\" name=\"event\" type=\"(uiuuisb)\" />"
 "    "
 "    <arg direction=\"out\" type=\"b\" />"
 "  </method>"
index 1f680ef..0af9aac 100644 (file)
   </method>
 
   <method name="NotifyListenersSync">
-    <arg direction="in" name="event" type="(uinnisb)"/>
+    <arg direction="in" name="event" type="(uiuuisb)"/>
     <arg direction="out" type="b"/>
     <annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="QSpiDeviceEvent"/>
   </method>
 
   <method name="NotifyListenersAsync">
-    <arg direction="in" name="event" type="(uinnisb)"/>
+    <arg direction="in" name="event" type="(uiuuisb)"/>
     <annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="QSpiDeviceEvent"/>
   </method>
 
index 0a10c16..a6dd3b6 100644 (file)
@@ -3,7 +3,7 @@
 <interface name="org.a11y.atspi.DeviceEventListener">
 
   <method name="NotifyEvent">
-    <arg direction="in" name="event" type="(uinnisb)"/>
+    <arg direction="in" name="event" type="(uiuuisb)"/>
     <annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="QSpiDeviceEvent"/>
     <arg direction="out" type="b"/>
   </method>