backends: Move device mapping check into backend

Make the upper parts agnostic about the device being relative in
order to apply the display mapping. Just make the low level bits
resort to the identity matrix for those.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
This commit is contained in:
Carlos Garnacho 2020-05-06 20:27:14 +02:00 committed by Jonas Ådahl
parent c4d11f7550
commit 82c6c3f303
2 changed files with 25 additions and 19 deletions

View File

@ -1082,24 +1082,19 @@ update_device_display (MetaInputSettings *input_settings,
priv = meta_input_settings_get_instance_private (input_settings); priv = meta_input_settings_get_instance_private (input_settings);
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings); input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
/* If mapping is relative, the device can move on all displays */ meta_input_settings_find_monitor (input_settings, settings, device,
if (clutter_input_device_get_device_type (device) == CLUTTER_TOUCHSCREEN_DEVICE || &monitor, &logical_monitor);
clutter_input_device_get_mapping_mode (device) == if (monitor)
CLUTTER_INPUT_DEVICE_MAPPING_ABSOLUTE)
{ {
meta_input_settings_find_monitor (input_settings, settings, device, meta_input_mapper_remove_device (priv->input_mapper, device);
&monitor, &logical_monitor); meta_monitor_manager_get_monitor_matrix (priv->monitor_manager,
if (monitor) monitor, logical_monitor,
{ matrix);
meta_input_mapper_remove_device (priv->input_mapper, device); }
meta_monitor_manager_get_monitor_matrix (priv->monitor_manager, else
monitor, logical_monitor, matrix); {
} if (meta_input_settings_delegate_on_mapper (input_settings, device))
else return;
{
if (meta_input_settings_delegate_on_mapper (input_settings, device))
return;
}
} }
input_settings_class->set_matrix (input_settings, device, matrix); input_settings_class->set_matrix (input_settings, device, matrix);

View File

@ -70,8 +70,19 @@ meta_input_settings_native_set_matrix (MetaInputSettings *settings,
{ {
cairo_matrix_t dev_matrix; cairo_matrix_t dev_matrix;
cairo_matrix_init (&dev_matrix, matrix[0], matrix[3], matrix[1], if (clutter_input_device_get_device_type (device) ==
matrix[4], matrix[2], matrix[5]); CLUTTER_TOUCHSCREEN_DEVICE ||
clutter_input_device_get_mapping_mode (device) ==
CLUTTER_INPUT_DEVICE_MAPPING_ABSOLUTE)
{
cairo_matrix_init (&dev_matrix, matrix[0], matrix[3], matrix[1],
matrix[4], matrix[2], matrix[5]);
}
else
{
cairo_matrix_init_identity (&dev_matrix);
}
g_object_set (device, "device-matrix", &dev_matrix, NULL); g_object_set (device, "device-matrix", &dev_matrix, NULL);
} }