[gtk+/xi2: 1097/1239] GdkDisplayX11: Improve backwards compatibility for gdk_devices_list().
- From: Carlos Garnacho <carlosg src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtk+/xi2: 1097/1239] GdkDisplayX11: Improve backwards compatibility for gdk_devices_list().
- Date: Tue, 29 Sep 2009 10:55:58 +0000 (UTC)
commit e10f1650dfe64e7ab65048d8f20016b879af936b
Author: Carlos Garnacho <carlos gnome org>
Date: Thu Sep 10 02:07:49 2009 +0200
GdkDisplayX11: Improve backwards compatibility for gdk_devices_list().
Now gdk_devices_list() returns all floating devices that are not keyboards.
This function wasn't meant to return master devices, and slave devices may
cause trouble, such as having them being detached from the master device
when grabbed.
gdk/x11/gdkdisplay-x11.c | 36 ++++++++++++++++++++++++------------
1 files changed, 24 insertions(+), 12 deletions(-)
---
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index aa0d0f8..9783c5c 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -1097,27 +1097,37 @@ _gdk_input_init (GdkDisplay *display)
{
GdkDisplayX11 *display_x11;
GdkDeviceManager *device_manager;
- GList *list;
+ GdkDevice *device;
+ GList *list, *l;
display_x11 = GDK_DISPLAY_X11 (display);
device_manager = gdk_device_manager_get_for_display (display);
- /* Add all devices */
- display_x11->input_devices = gdk_device_manager_get_devices (device_manager, GDK_DEVICE_TYPE_MASTER);
+ /* For backwards compatibility, just add
+ * floating devices that are not keyboards.
+ */
+ list = gdk_device_manager_get_devices (device_manager, GDK_DEVICE_TYPE_FLOATING);
- list = gdk_device_manager_get_devices (device_manager, GDK_DEVICE_TYPE_SLAVE);
- display_x11->input_devices = g_list_concat (display_x11->input_devices, list);
+ for (l = list; l; l = l->next)
+ {
+ device = l->data;
- list = gdk_device_manager_get_devices (device_manager, GDK_DEVICE_TYPE_FLOATING);
- display_x11->input_devices = g_list_concat (display_x11->input_devices, list);
+ if (device->source == GDK_SOURCE_KEYBOARD)
+ continue;
- /* Now set "core" pointer to the first master device that is a pointer */
- list = display_x11->input_devices;
+ display_x11->input_devices = g_list_prepend (display_x11->input_devices, l->data);
+ }
+
+ g_list_free (list);
- while (list)
+ /* Now set "core" pointer to the first
+ * master device that is a pointer.
+ */
+ list = gdk_device_manager_get_devices (device_manager, GDK_DEVICE_TYPE_MASTER);
+
+ for (l = list; l; l = l->next)
{
- GdkDevice *device = list->data;
- list = list->next;
+ device = list->data;
if (device->source != GDK_SOURCE_MOUSE)
continue;
@@ -1125,6 +1135,8 @@ _gdk_input_init (GdkDisplay *display)
display->core_pointer = device;
break;
}
+
+ g_list_free (list);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]