[gimp/gtk3-port: 141/218] app: change the list of available devices to something that makes sense



commit 6fa45c6d8413ba0bac05c819c67b0962c8ba9887
Author: Michael Natterer <mitch gimp org>
Date:   Thu Dec 9 23:31:07 2010 +0100

    app: change the list of available devices to something that makes sense
    
    Include the client pointer, its slaves, and all floating devices.

 app/widgets/gimpdevices.c |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/app/widgets/gimpdevices.c b/app/widgets/gimpdevices.c
index 8ee33c9..84800c7 100644
--- a/app/widgets/gimpdevices.c
+++ b/app/widgets/gimpdevices.c
@@ -429,18 +429,22 @@ gimp_devices_display_opened (GdkDisplayManager *disp_manager,
                              GimpDeviceManager *manager)
 {
   GdkDeviceManager *gdk_manager;
+  GdkDevice        *device;
   GList            *devices;
   GList            *list;
 
   gdk_manager = gdk_display_get_device_manager (gdk_display);
 
+  device = gdk_device_manager_get_client_pointer (gdk_manager);
+  gimp_devices_device_added (gdk_manager, device, manager);
+
   devices = gdk_device_manager_list_devices (gdk_manager,
-                                             GDK_DEVICE_TYPE_MASTER);
+                                             GDK_DEVICE_TYPE_SLAVE);
 
   /*  create device info structures for present devices */
   for (list = devices; list; list = g_list_next (list))
     {
-      GdkDevice *device = list->data;
+      device = list->data;
 
       gimp_devices_device_added (gdk_manager, device, manager);
     }
@@ -453,7 +457,7 @@ gimp_devices_display_opened (GdkDisplayManager *disp_manager,
   /*  create device info structures for present devices */
   for (list = devices; list; list = g_list_next (list))
     {
-      GdkDevice *device = list->data;
+      device = list->data;
 
       gimp_devices_device_added (gdk_manager, device, manager);
     }
@@ -478,17 +482,21 @@ gimp_devices_display_closed (GdkDisplay        *gdk_display,
                              GimpDeviceManager *manager)
 {
   GdkDeviceManager *gdk_manager;
+  GdkDevice        *device;
   GList            *devices;
   GList            *list;
 
   gdk_manager = gdk_display_get_device_manager (gdk_display);
 
+  device = gdk_device_manager_get_client_pointer (gdk_manager);
+  gimp_devices_device_added (gdk_manager, device, manager);
+
   devices = gdk_device_manager_list_devices (gdk_manager,
-                                             GDK_DEVICE_TYPE_MASTER);
+                                             GDK_DEVICE_TYPE_SLAVE);
 
   for (list = devices; list; list = list->next)
     {
-      GdkDevice *device = list->data;
+      device = list->data;
 
       gimp_devices_device_removed (gdk_manager, device, manager);
     }
@@ -500,7 +508,7 @@ gimp_devices_display_closed (GdkDisplay        *gdk_display,
 
   for (list = devices; list; list = list->next)
     {
-      GdkDevice *device = list->data;
+      device = list->data;
 
       gimp_devices_device_removed (gdk_manager, device, manager);
     }
@@ -519,6 +527,10 @@ gimp_devices_device_added (GdkDeviceManager  *gdk_manager,
   if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
     return;
 
+  if (device != gdk_device_manager_get_client_pointer (gdk_manager) &&
+      gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_MASTER)
+    return;
+
   device_info =
     GIMP_DEVICE_INFO (gimp_container_get_child_by_name (manager->device_info_list,
                                                         gdk_device_get_name (device)));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]