From a218e9ef197edef59b1a96b50e3656993c28ffda Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Fri, 7 Nov 2008 18:58:45 -0300 Subject: Fix Connected property on input interface always being inverted. is_connected where being used as the compare function on g_slist_find_custom which doesn't work as expected. --- input/device.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/input/device.c b/input/device.c index af118bfa..6564b90d 100644 --- a/input/device.c +++ b/input/device.c @@ -985,6 +985,13 @@ static void device_unregister(void *data) input_device_free(idev); } +static gint connected_cmp(gpointer a, gpointer b) +{ + struct input_conn *iconn = a; + + return !is_connected(iconn); +} + static DBusMessage *device_get_properties(DBusConnection *conn, DBusMessage *msg, void *data) { @@ -1007,7 +1014,7 @@ static DBusMessage *device_get_properties(DBusConnection *conn, /* Connected */ connected = !!g_slist_find_custom(idev->connections, NULL, - (GCompareFunc) is_connected); + (GCompareFunc) connected_cmp); dict_append_entry(&dict, "Connected", DBUS_TYPE_BOOLEAN, &connected); dbus_message_iter_close_container(&iter, &dict); -- cgit