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



commit 64e16517720f9a6ffd53d513ee3ec4d834e819a6
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/gimpdevicemanager.c |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)
---
diff --git a/app/widgets/gimpdevicemanager.c b/app/widgets/gimpdevicemanager.c
index c5e52f1..4715a77 100644
--- a/app/widgets/gimpdevicemanager.c
+++ b/app/widgets/gimpdevicemanager.c
@@ -311,6 +311,7 @@ gimp_device_manager_display_opened (GdkDisplayManager *disp_manager,
 {
   GimpDeviceManagerPrivate *private = GET_PRIVATE (manager);
   GdkDeviceManager         *gdk_manager;
+  GdkDevice                *device;
   GList                    *devices;
   GList                    *list;
   const gchar              *display_name;
@@ -330,13 +331,16 @@ gimp_device_manager_display_opened (GdkDisplayManager *disp_manager,
 
   gdk_manager = gdk_display_get_device_manager (gdk_display);
 
+  device = gdk_device_manager_get_client_pointer (gdk_manager);
+  gimp_device_manager_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_device_manager_device_added (gdk_manager, device, manager);
     }
@@ -349,7 +353,7 @@ gimp_device_manager_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_device_manager_device_added (gdk_manager, device, manager);
     }
@@ -375,6 +379,7 @@ gimp_device_manager_display_closed (GdkDisplay        *gdk_display,
 {
   GimpDeviceManagerPrivate *private = GET_PRIVATE (manager);
   GdkDeviceManager         *gdk_manager;
+  GdkDevice               *device;
   GList                    *devices;
   GList                    *list;
   const gchar              *display_name;
@@ -408,12 +413,17 @@ gimp_device_manager_display_closed (GdkDisplay        *gdk_display,
                                         gimp_device_manager_display_closed,
                                         manager);
 
+  gdk_manager = gdk_display_get_device_manager (gdk_display);
+
+  device = gdk_device_manager_get_client_pointer (gdk_manager);
+  gimp_device_manager_device_removed (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_device_manager_device_removed (gdk_manager, device, manager);
     }
@@ -425,7 +435,7 @@ gimp_device_manager_display_closed (GdkDisplay        *gdk_display,
 
   for (list = devices; list; list = list->next)
     {
-      GdkDevice *device = list->data;
+      device = list->data;
 
       gimp_device_manager_device_removed (gdk_manager, device, manager);
     }
@@ -445,6 +455,10 @@ gimp_device_manager_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;
+
   display = gdk_device_manager_get_display (gdk_manager);
 
   device_info =


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