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
This commit is contained in:
Jason Gerecke 2017-06-19 15:13:09 -07:00 committed by Carlos Garnacho
parent 8a7b564219
commit 5fc6200375

View File

@ -451,8 +451,18 @@ meta_input_settings_native_set_tablet_area (MetaInputSettings *settings,
gdouble padding_bottom) gdouble padding_bottom)
{ {
struct libinput_device *libinput_device; struct libinput_device *libinput_device;
gfloat matrix[6] = { 1. - (padding_left + padding_right), 0., padding_left, gfloat scale_x;
0., 1. - (padding_top + padding_bottom), padding_top }; 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); libinput_device = clutter_evdev_input_device_get_libinput_device (device);
if (!libinput_device || if (!libinput_device ||