mirror of
https://github.com/brl/mutter.git
synced 2024-11-28 19:10:43 -05:00
input-settings/native: Check mapping mode in input thread
When we set the matrix, we checked the device mapping mode in the main thread, then passed along the calculated matrix to the input thread for application. This could however be racy, as the mapping mode is managed in the input thread. Fix this by sending the unaltered matrix, having the input thread checking the mapping mode. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1806>
This commit is contained in:
parent
efde781747
commit
90eab42867
@ -134,12 +134,25 @@ meta_input_settings_native_set_send_events (MetaInputSettings *settings,
|
||||
static gboolean
|
||||
set_matrix (GTask *task)
|
||||
{
|
||||
ClutterInputDevice *device;
|
||||
cairo_matrix_t *dev_matrix;
|
||||
ClutterInputDevice *device = g_task_get_source_object (task);
|
||||
float *matrix = g_task_get_task_data (task);
|
||||
cairo_matrix_t dev_matrix;
|
||||
|
||||
device = g_task_get_source_object (task);
|
||||
dev_matrix = g_task_get_task_data (task);
|
||||
g_object_set (device, "device-matrix", dev_matrix, NULL);
|
||||
if (clutter_input_device_get_device_type (device) ==
|
||||
CLUTTER_TOUCHSCREEN_DEVICE ||
|
||||
meta_input_device_native_get_mapping_mode_in_impl (device) ==
|
||||
META_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);
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
@ -150,26 +163,11 @@ meta_input_settings_native_set_matrix (MetaInputSettings *settings,
|
||||
const float matrix[6])
|
||||
{
|
||||
MetaInputSettingsNative *input_settings_native;
|
||||
cairo_matrix_t *dev_matrix;
|
||||
GTask *task;
|
||||
|
||||
dev_matrix = g_new0 (cairo_matrix_t, 1);
|
||||
|
||||
if (clutter_input_device_get_device_type (device) ==
|
||||
CLUTTER_TOUCHSCREEN_DEVICE ||
|
||||
meta_input_device_native_get_mapping_mode_in_impl (device) ==
|
||||
META_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);
|
||||
}
|
||||
|
||||
task = g_task_new (device, NULL, NULL, NULL);
|
||||
g_task_set_task_data (task, dev_matrix, g_free);
|
||||
|
||||
g_task_set_task_data (task, g_memdup2 (matrix, sizeof (float) * 6), g_free);
|
||||
|
||||
input_settings_native = META_INPUT_SETTINGS_NATIVE (settings);
|
||||
meta_seat_impl_run_input_task (input_settings_native->seat_impl,
|
||||
|
Loading…
Reference in New Issue
Block a user