mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 19:42:05 +00:00
backends/x11: Account for non-zero device origin when setting tablet area
Wacom's display tablets typically do not have (0,0) coincident with the top left corner of the screen. This "outbound" area must be taken into account when setting the area or else an unexpected offset of the pointer will occur. https://bugzilla.gnome.org/show_bug.cgi?id=784009
This commit is contained in:
parent
5f49bda591
commit
74882b2502
@ -555,6 +555,8 @@ meta_input_settings_x11_set_tablet_mapping (MetaInputSettings *settings,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
device_query_area (ClutterInputDevice *device,
|
device_query_area (ClutterInputDevice *device,
|
||||||
|
gint *x,
|
||||||
|
gint *y,
|
||||||
gint *width,
|
gint *width,
|
||||||
gint *height)
|
gint *height)
|
||||||
{
|
{
|
||||||
@ -580,9 +582,15 @@ device_query_area (ClutterInputDevice *device,
|
|||||||
if (valuator->type != XIValuatorClass)
|
if (valuator->type != XIValuatorClass)
|
||||||
continue;
|
continue;
|
||||||
if (valuator->label == abs_x)
|
if (valuator->label == abs_x)
|
||||||
*width = valuator->max - valuator->min;
|
{
|
||||||
|
*x = valuator->min;
|
||||||
|
*width = valuator->max - valuator->min;
|
||||||
|
}
|
||||||
else if (valuator->label == abs_y)
|
else if (valuator->label == abs_y)
|
||||||
*height = valuator->max - valuator->min;
|
{
|
||||||
|
*y = valuator->min;
|
||||||
|
*height = valuator->max - valuator->min;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
XIFreeDeviceInfo (info);
|
XIFreeDeviceInfo (info);
|
||||||
@ -606,15 +614,15 @@ meta_input_settings_x11_set_tablet_area (MetaInputSettings *settings,
|
|||||||
gdouble padding_top,
|
gdouble padding_top,
|
||||||
gdouble padding_bottom)
|
gdouble padding_bottom)
|
||||||
{
|
{
|
||||||
gint32 width, height, area[4] = { 0 };
|
gint32 x, y, width, height, area[4] = { 0 };
|
||||||
|
|
||||||
if (!device_query_area (device, &width, &height))
|
if (!device_query_area (device, &x, &y, &width, &height))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
area[0] = width * padding_left;
|
area[0] = (width * padding_left) + x;
|
||||||
area[1] = height * padding_top;
|
area[1] = (height * padding_top) + y;
|
||||||
area[2] = width - (width * padding_right);
|
area[2] = width - (width * padding_right) + x;
|
||||||
area[3] = height - (height * padding_bottom);
|
area[3] = height - (height * padding_bottom) + y;
|
||||||
update_tablet_area (settings, device, area);
|
update_tablet_area (settings, device, area);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -624,9 +632,9 @@ meta_input_settings_x11_set_tablet_keep_aspect (MetaInputSettings *settings,
|
|||||||
MetaLogicalMonitor *logical_monitor,
|
MetaLogicalMonitor *logical_monitor,
|
||||||
gboolean keep_aspect)
|
gboolean keep_aspect)
|
||||||
{
|
{
|
||||||
gint32 width, height, dev_width, dev_height, area[4] = { 0 };
|
gint32 width, height, dev_x, dev_y, dev_width, dev_height, area[4] = { 0 };
|
||||||
|
|
||||||
if (!device_query_area (device, &dev_width, &dev_height))
|
if (!device_query_area (device, &dev_x, &dev_y, &dev_width, &dev_height))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (keep_aspect)
|
if (keep_aspect)
|
||||||
@ -658,8 +666,10 @@ meta_input_settings_x11_set_tablet_keep_aspect (MetaInputSettings *settings,
|
|||||||
dev_height = dev_width / aspect_ratio;
|
dev_height = dev_width / aspect_ratio;
|
||||||
}
|
}
|
||||||
|
|
||||||
area[2] = dev_width;
|
area[0] = dev_x;
|
||||||
area[3] = dev_height;
|
area[1] = dev_y;
|
||||||
|
area[2] = dev_width + dev_x;
|
||||||
|
area[3] = dev_height + dev_y;
|
||||||
update_tablet_area (settings, device, area);
|
update_tablet_area (settings, device, area);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user