[gimp/gtk3-port: 450/451] app: always show pointer devices unless disabled floating.



commit a7925510aa841e9d29671b7673e03108db715027
Author: Jehan <jehan girinstud io>
Date:   Mon May 14 23:05:46 2018 +0200

    app: always show pointer devices unless disabled floating.
    
    The docs of gdk_device_set_mode() clearly states:
    
    >  * Note: This is only meaningful for floating devices, master devices (and
    >  * slaves connected to these) drive the pointer cursor, which is not limited
    >  * by the input mode.
    
    I can anyway see that tablets work now out of the box with pressure,
    tilt, etc. We don't need to enable them anymore. And obviously even if
    we did, GDK docs clearly tells us the settings would not change a thing.
    
    I am aware this change actually breaks some use cases. For instance on a
    laptop with trackpoint, physical buttons and a touchpad, it is customary
    to use the physical buttons both for the trackpoint and the touchpad.
    But since now all input devices are seemingly enabled, clicking with
    physical buttons while moving with touchpad fails to paint (because it
    considers these as 2 separate devices). We'll have to take care of such
    cases. This is work-in-progress.

 app/widgets/gimpdevices.c      |   16 +++++-----------
 app/widgets/gimpdevicestatus.c |    3 ++-
 2 files changed, 7 insertions(+), 12 deletions(-)
---
diff --git a/app/widgets/gimpdevices.c b/app/widgets/gimpdevices.c
index 20ee1b7..084f9a3 100644
--- a/app/widgets/gimpdevices.c
+++ b/app/widgets/gimpdevices.c
@@ -283,21 +283,15 @@ gimp_devices_get_from_event (Gimp            *gimp,
           return NULL;
 
         case GDK_DEVICE_TYPE_SLAVE:
-          /*  this is the tricky part: we do want to distingiugh slave
-           *  devices, but only if we actually enabled them ourselves
-           *  explicitely (like the pens of a tablet); however we
-           *  usually don't enable the different incarnations of the
-           *  mouse itself (like touchpad, trackpoint, usb mouse
-           *  etc.), so for these return their respective master so
-           *  its settings are used
+          /*
+           * Disabled mode is only meaningfull for floating devices.
+           * See docs of gdk_device_set_mode().
            */
-          if (gdk_device_get_mode (device) == GDK_MODE_DISABLED)
+          if (gdk_device_get_mode (device) == GDK_MODE_DISABLED &&
+              gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_FLOATING)
             {
               return gdk_device_get_associated_device (device);
             }
-
-          return device;
-
         case GDK_DEVICE_TYPE_FLOATING:
           /*  we only get events for floating devices which have
            *  enabled ourselves, so return the floating device
diff --git a/app/widgets/gimpdevicestatus.c b/app/widgets/gimpdevicestatus.c
index 140f63f..d76bbaf 100644
--- a/app/widgets/gimpdevicestatus.c
+++ b/app/widgets/gimpdevicestatus.c
@@ -538,7 +538,8 @@ gimp_device_status_notify_info (GimpDeviceInfo        *device_info,
     }
 
   if (! gimp_device_info_get_device (device_info, NULL) ||
-      gimp_device_info_get_mode (device_info) == GDK_MODE_DISABLED)
+      (gimp_device_info_get_mode (device_info) == GDK_MODE_DISABLED &&
+       gdk_device_get_device_type (device_info->device) == GDK_DEVICE_TYPE_FLOATING))
     {
       gtk_widget_hide (entry->ebox);
     }


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