Travis Watkins wrote:
Remaining problems:
* need to figure out what to do with activate/deactivate
Could you try this patch and let me know if it works when you
set the signature to "a{sv}", in theory it should work. It looks
like the python dbus bindings check the introspection data before
sending a dictionary type because it could differ depending on
what is in the data.
I tried it with a simple test script but it failed because the Introspect
function did not return, I might have another go later but I am using
python 2.4.
I was testing with this simple script
import dbus
COMPIZ_DBUS_DESTINATION = 'org.freedesktop.compiz'
COMPIZ_DBUS_ROOT_OBJ_PATH = '/org/freedesktop/compiz/%s'
COMPIZ_DBUS_INTERFACE = 'org.freedesktop.compiz'
bus = dbus.SessionBus()
data = {'root': 0x1a5, 'something_else': 'blah'}
rotate_obj = bus.get_object(COMPIZ_DBUS_DESTINATION,
COMPIZ_DBUS_ROOT_OBJ_PATH % 'rotate/allscreens/rotate_right')
rotate_iface = dbus.Interface(rotate_obj, COMPIZ_DBUS_INTERFACE)
rotate_iface.activate(data)
--- dbus.head.c 2007-03-04 19:29:32.538479072 +0000
+++ dbus.c 2007-03-04 19:27:35.510270064 +0000
@@ -216,67 +216,63 @@
return FALSE;
}
- if (dbus_message_iter_init (message, &iter))
+ if (dbus_message_iter_init (message, &iter) &&
+ dbus_message_iter_get_arg_type (&iter) == DBUS_TYPE_ARRAY)
{
CompOptionValue value;
CompOptionType type = 0;
char *name;
Bool hasValue;
+ DBusMessageIter aiter, diter, viter;
+
+ dbus_message_iter_recurse (&iter, &aiter);
do
{
+ double tmp;
name = NULL;
hasValue = FALSE;
+ dbus_message_iter_recurse (&aiter, &diter);
+ dbus_message_iter_get_basic (&diter, &name);
- while (!name)
- {
- switch (dbus_message_iter_get_arg_type (&iter)) {
- case DBUS_TYPE_STRING:
- dbus_message_iter_get_basic (&iter, &name);
- default:
- break;
- }
+ if (!dbus_message_iter_next (&diter))
+ break;
- if (!dbus_message_iter_next (&iter))
- break;
- }
+ dbus_message_iter_recurse (&diter, &viter);
- while (!hasValue)
+ switch (dbus_message_iter_get_arg_type (&viter))
{
- double tmp;
-
- switch (dbus_message_iter_get_arg_type (&iter)) {
- case DBUS_TYPE_BOOLEAN:
+ case DBUS_TYPE_BOOLEAN:
hasValue = TRUE;
type = CompOptionTypeBool;
- dbus_message_iter_get_basic (&iter, &value.b);
+ dbus_message_iter_get_basic (&viter, &value.b);
break;
- case DBUS_TYPE_INT32:
+ case DBUS_TYPE_INT32:
hasValue = TRUE;
type = CompOptionTypeInt;
- dbus_message_iter_get_basic (&iter, &value.i);
+ dbus_message_iter_get_basic (&viter, &value.i);
break;
- case DBUS_TYPE_DOUBLE:
+ case DBUS_TYPE_DOUBLE:
hasValue = TRUE;
type = CompOptionTypeFloat;
- dbus_message_iter_get_basic (&iter, &tmp);
+ dbus_message_iter_get_basic (&viter, &tmp);
value.f = tmp;
break;
- case DBUS_TYPE_STRING:
+ case DBUS_TYPE_STRING:
hasValue = TRUE;
- /* XXX: use match option type if name is "match" */
+ /* XXX: use match option type if name is "match" */
if (name && strcmp (name, "match") == 0)
{
char *s;
type = CompOptionTypeMatch;
- dbus_message_iter_get_basic (&iter, &s);
+ dbus_message_iter_get_basic (&viter, &s);
matchInit (&value.match);
matchAddFromString (&value.match, s);
@@ -285,13 +281,9 @@
{
type = CompOptionTypeString;
- dbus_message_iter_get_basic (&iter, &value.s);
+ dbus_message_iter_get_basic (&viter, &value.s);
}
- default:
- break;
- }
-
- if (!dbus_message_iter_next (&iter))
+ default:
break;
}
@@ -312,7 +304,8 @@
nArgument++;
}
}
- } while (dbus_message_iter_has_next (&iter));
+ } while (dbus_message_iter_has_next (&aiter) &&
+ dbus_message_iter_get_arg_type (&aiter) == DBUS_TYPE_DICT_ENTRY);
}
if (activate)
_______________________________________________
compiz mailing list
compiz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/compiz