clutter: Move motion compression handling to ClutterSeat
Another responsibility taken away from ClutterDeviceManager https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
This commit is contained in:
@ -127,31 +127,6 @@ meta_device_manager_native_get_device (ClutterDeviceManager *manager,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_device_manager_native_compress_motion (ClutterDeviceManager *device_manger,
|
||||
ClutterEvent *event,
|
||||
const ClutterEvent *to_discard)
|
||||
{
|
||||
double dx, dy;
|
||||
double dx_unaccel, dy_unaccel;
|
||||
double dst_dx = 0.0, dst_dy = 0.0;
|
||||
double dst_dx_unaccel = 0.0, dst_dy_unaccel = 0.0;
|
||||
|
||||
if (!meta_event_native_get_relative_motion (to_discard,
|
||||
&dx, &dy,
|
||||
&dx_unaccel, &dy_unaccel))
|
||||
return;
|
||||
|
||||
meta_event_native_get_relative_motion (event,
|
||||
&dst_dx, &dst_dy,
|
||||
&dst_dx_unaccel, &dst_dy_unaccel);
|
||||
meta_event_native_set_relative_motion (event,
|
||||
dx + dst_dx,
|
||||
dy + dst_dy,
|
||||
dx_unaccel + dst_dx_unaccel,
|
||||
dy_unaccel + dst_dy_unaccel);
|
||||
}
|
||||
|
||||
static void
|
||||
on_device_added (ClutterSeat *seat,
|
||||
ClutterInputDevice *parent,
|
||||
@ -213,7 +188,6 @@ meta_device_manager_native_class_init (MetaDeviceManagerNativeClass *klass)
|
||||
manager_class->get_devices = meta_device_manager_native_get_devices;
|
||||
manager_class->get_core_device = meta_device_manager_native_get_core_device;
|
||||
manager_class->get_device = meta_device_manager_native_get_device;
|
||||
manager_class->compress_motion = meta_device_manager_native_compress_motion;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2587,6 +2587,31 @@ meta_seat_native_get_supported_virtual_device_types (ClutterSeat *seat)
|
||||
CLUTTER_VIRTUAL_DEVICE_TYPE_TOUCHSCREEN);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_seat_native_compress_motion (ClutterSeat *seat,
|
||||
ClutterEvent *event,
|
||||
const ClutterEvent *to_discard)
|
||||
{
|
||||
double dx, dy;
|
||||
double dx_unaccel, dy_unaccel;
|
||||
double dst_dx = 0.0, dst_dy = 0.0;
|
||||
double dst_dx_unaccel = 0.0, dst_dy_unaccel = 0.0;
|
||||
|
||||
if (!meta_event_native_get_relative_motion (to_discard,
|
||||
&dx, &dy,
|
||||
&dx_unaccel, &dy_unaccel))
|
||||
return;
|
||||
|
||||
meta_event_native_get_relative_motion (event,
|
||||
&dst_dx, &dst_dy,
|
||||
&dst_dx_unaccel, &dst_dy_unaccel);
|
||||
meta_event_native_set_relative_motion (event,
|
||||
dx + dst_dx,
|
||||
dy + dst_dy,
|
||||
dx_unaccel + dst_dx_unaccel,
|
||||
dy_unaccel + dst_dy_unaccel);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_seat_native_class_init (MetaSeatNativeClass *klass)
|
||||
{
|
||||
@ -2609,6 +2634,7 @@ meta_seat_native_class_init (MetaSeatNativeClass *klass)
|
||||
seat_class->apply_kbd_a11y_settings = meta_seat_native_apply_kbd_a11y_settings;
|
||||
seat_class->create_virtual_device = meta_seat_native_create_virtual_device;
|
||||
seat_class->get_supported_virtual_device_types = meta_seat_native_get_supported_virtual_device_types;
|
||||
seat_class->compress_motion = meta_seat_native_compress_motion;
|
||||
|
||||
props[PROP_SEAT_ID] =
|
||||
g_param_spec_string ("seat-id",
|
||||
|
Reference in New Issue
Block a user