mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
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:
parent
1c689b83f9
commit
7afbc01fe8
@ -208,10 +208,6 @@ void _clutter_device_manager_select_stage_events (ClutterDeviceMa
|
||||
ClutterStage *stage);
|
||||
ClutterBackend *_clutter_device_manager_get_backend (ClutterDeviceManager *device_manager);
|
||||
|
||||
void _clutter_device_manager_compress_motion (ClutterDeviceManager *device_manger,
|
||||
ClutterEvent *event,
|
||||
const ClutterEvent *to_discard);
|
||||
|
||||
/* input device */
|
||||
CLUTTER_EXPORT
|
||||
gboolean _clutter_input_device_has_sequence (ClutterInputDevice *device,
|
||||
|
@ -437,20 +437,3 @@ _clutter_device_manager_get_backend (ClutterDeviceManager *manager)
|
||||
|
||||
return priv->backend;
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_device_manager_compress_motion (ClutterDeviceManager *device_manager,
|
||||
ClutterEvent *event,
|
||||
const ClutterEvent *to_discard)
|
||||
{
|
||||
ClutterDeviceManagerClass *manager_class;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
|
||||
|
||||
|
||||
manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
|
||||
if (!manager_class->compress_motion)
|
||||
return;
|
||||
|
||||
manager_class->compress_motion (device_manager, event, to_discard);
|
||||
}
|
||||
|
@ -64,9 +64,6 @@ struct _ClutterDeviceManagerClass
|
||||
ClutterInputDevice *device);
|
||||
void (* select_stage_events) (ClutterDeviceManager *manager,
|
||||
ClutterStage *stage);
|
||||
void (* compress_motion) (ClutterDeviceManager *device_manger,
|
||||
ClutterEvent *event,
|
||||
const ClutterEvent *to_discard);
|
||||
|
||||
/* padding */
|
||||
gpointer _padding[4];
|
||||
|
@ -531,3 +531,18 @@ clutter_seat_get_supported_virtual_device_types (ClutterSeat *seat)
|
||||
seat_class = CLUTTER_SEAT_GET_CLASS (seat);
|
||||
return seat_class->get_supported_virtual_device_types (seat);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_seat_compress_motion (ClutterSeat *seat,
|
||||
ClutterEvent *event,
|
||||
const ClutterEvent *to_discard)
|
||||
{
|
||||
ClutterSeatClass *seat_class;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_SEAT (seat));
|
||||
|
||||
seat_class = CLUTTER_SEAT_GET_CLASS (seat);
|
||||
|
||||
if (seat_class->compress_motion)
|
||||
seat_class->compress_motion (seat, event, to_discard);
|
||||
}
|
||||
|
@ -102,6 +102,10 @@ struct _ClutterSeatClass
|
||||
|
||||
ClutterKeymap * (* get_keymap) (ClutterSeat *seat);
|
||||
|
||||
void (* compress_motion) (ClutterSeat *seat,
|
||||
ClutterEvent *event,
|
||||
const ClutterEvent *to_discard);
|
||||
|
||||
/* Event platform data */
|
||||
void (* copy_event_data) (ClutterSeat *seat,
|
||||
const ClutterEvent *src,
|
||||
@ -158,4 +162,8 @@ ClutterVirtualInputDevice *clutter_seat_create_virtual_device (ClutterSeat
|
||||
CLUTTER_EXPORT
|
||||
ClutterVirtualDeviceType clutter_seat_get_supported_virtual_device_types (ClutterSeat *seat);
|
||||
|
||||
void clutter_seat_compress_motion (ClutterSeat *seat,
|
||||
ClutterEvent *event,
|
||||
const ClutterEvent *to_discard);
|
||||
|
||||
#endif /* CLUTTER_SEAT_H */
|
||||
|
@ -1239,11 +1239,9 @@ _clutter_stage_process_queued_events (ClutterStage *stage)
|
||||
|
||||
if (next_event->type == CLUTTER_MOTION)
|
||||
{
|
||||
ClutterDeviceManager *device_manager =
|
||||
clutter_device_manager_get_default ();
|
||||
ClutterSeat *seat = clutter_input_device_get_seat (device);
|
||||
|
||||
_clutter_device_manager_compress_motion (device_manager,
|
||||
next_event, event);
|
||||
clutter_seat_compress_motion (seat, next_event, event);
|
||||
}
|
||||
|
||||
goto next_event;
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user