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



commit cea778a81169f91b449f5bc8f66a0bb9cd60e594
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 edeabcf..82dbceb 100644
--- a/app/widgets/gimpdevices.c
+++ b/app/widgets/gimpdevices.c
@@ -289,21 +289,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 6009083..a0ca74c 100644
--- a/app/widgets/gimpdevicestatus.c
+++ b/app/widgets/gimpdevicestatus.c
@@ -456,7 +456,8 @@ gimp_device_status_update_entry (GimpDeviceInfo        *device_info,
                                  GimpDeviceStatusEntry *entry)
 {
   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]