[mutter/gnome-3-24] backends/native: Interpret tablet padding as being input-centric



commit 5fc62003752b8ae40ebd95c33c0b5ffe444025e4
Author: Jason Gerecke <killertofu gmail com>
Date:   Mon Jun 19 15:13:09 2017 -0700

    backends/native: Interpret tablet padding as being input-centric
    
    It is possible to interpret the ammount of padding provided to the
    *_set_tablet_area functions in two different and incompatible ways. The X11
    backend effectively treats them as being input-centric (i.e., the padding
    defines the size of the "dead zone" on the tablet) while the native backend
    has an output-centric viewpoint (i.e., the padding defines the size of the
    "dead zone" on the display) viewpoint. This difference in opinion causes the
    cursor offset to change when switching between Xorg and a Wayland sessions.
    
    The calibration utility within g-c-c does its calculations with an input-
    centric viewpoint, so this patch modifies the native backend to work
    correctly with these values. To change viewpoints, we can simply invert
    the scale and negate the offset. It should be noted that this function
    also forgot to apply scaling to the offsets (as required by the matrix
    transform done by libinput) which would have further compounded the
    cursor offset issue under Wayland.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=784009

 src/backends/native/meta-input-settings-native.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/backends/native/meta-input-settings-native.c 
b/src/backends/native/meta-input-settings-native.c
index 952625e..f0d7057 100644
--- a/src/backends/native/meta-input-settings-native.c
+++ b/src/backends/native/meta-input-settings-native.c
@@ -451,8 +451,18 @@ meta_input_settings_native_set_tablet_area (MetaInputSettings  *settings,
                                             gdouble             padding_bottom)
 {
   struct libinput_device *libinput_device;
-  gfloat matrix[6] = { 1. - (padding_left + padding_right), 0., padding_left,
-                       0., 1. - (padding_top + padding_bottom), padding_top };
+  gfloat scale_x;
+  gfloat scale_y;
+  gfloat offset_x;
+  gfloat offset_y;
+
+  scale_x = 1. / (1. - (padding_left + padding_right));
+  scale_y = 1. / (1. - (padding_top + padding_bottom));
+  offset_x = -padding_left * scale_x;
+  offset_y = -padding_top * scale_y;
+
+  gfloat matrix[6] = { scale_x, 0., offset_x,
+                       0., scale_y, offset_y };
 
   libinput_device = clutter_evdev_input_device_get_libinput_device (device);
   if (!libinput_device ||


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