- key_set = g_array_sized_new (FALSE, TRUE, sizeof (AtspiKeyDefinition), 0);
- dbind_method_call_reentrant (_atspi_bus(), atspi_bus_registry, atspi_path_dec, atspi_interface_dec, "DeregisterKeystrokeListener", &d_error, "oa(iisi)uu", path, &key_set, d_modmask, d_event_types);
+ /* copy the keyval filter values from the C api into the DBind KeySet */
+ if (key_set)
+ {
+ d_key_set = g_array_sized_new (FALSE, TRUE, sizeof (AtspiKeyDefinition), key_set->len);
+ d_key_set->len = key_set->len;
+ for (i = 0; i < key_set->len; ++i)
+ {
+ AtspiKeyDefinition *kd = ((AtspiKeyDefinition *) key_set->data) + i;
+ AtspiKeyDefinition *d_kd = ((AtspiKeyDefinition *) d_key_set->data) + i;
+ d_kd->keycode = kd->keycode;
+ d_kd->keysym = kd->keysym;
+ if (kd->keystring)
+ {
+ d_kd->keystring = kd->keystring;
+ }
+ else
+ {
+ d_kd->keystring = "";
+ }
+ }
+ }
+ else
+ {
+ d_key_set = g_array_sized_new (FALSE, TRUE, sizeof (AtspiKeyDefinition), 0);
+ }
+
+ dbind_method_call_reentrant (_atspi_bus(), atspi_bus_registry,
+ atspi_path_dec, atspi_interface_dec,
+ "DeregisterKeystrokeListener", &d_error,
+ "oa(iisi)uu", path, d_key_set, d_modmask,
+ d_event_types);
+ if (dbus_error_is_set (&d_error))
+ {
+ g_warning ("DeregisterKeystrokeListener failed: %s", d_error.message);
+ dbus_error_free (&d_error);
+ }
+
+ unregister_listener (listener, NULL);
+ for (l = device_listeners; l;)
+ {
+ /* TODO: This code is all wrong / doesn't match what is in
+ * deviceeventcontroller.c. It would be nice to deprecate these methods
+ * in favor of methods that return an ID for the registration that can
+ * be passed to a deregister function, for instance. */
+ DeviceListenerEntry *e = l->data;
+ if (e->modmask == modmask && e->event_types == event_types)
+ {
+ GList *next = l->next;
+ device_listener_entry_free (e);
+ device_listeners = g_list_delete_link (device_listeners, l);
+ l = next;
+ }
+ else
+ l = l->next;
+ }
+ g_array_free (d_key_set, TRUE);