diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2020-12-08 13:46:26 +0100 |
---|---|---|
committer | Marge Bot <marge-bot@gnome.org> | 2020-12-08 15:37:38 +0000 |
commit | e21929be82aced9afbfdb681b74148ed22dda59c (patch) | |
tree | 933b20367acb8f11886590e8cfc3abc8871a9e5e /clutter | |
parent | 0842ac936f90b858f9fff22f17253391dfd29286 (diff) | |
download | mutter-e21929be82aced9afbfdb681b74148ed22dda59c.tar.gz |
clutter: Do not poke backend code for motion compression
We now have all info available in ClutterEvent, use it and stop poking
backend internals.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1623>
Diffstat (limited to 'clutter')
-rw-r--r-- | clutter/clutter/clutter-seat.c | 15 | ||||
-rw-r--r-- | clutter/clutter/clutter-seat.h | 8 | ||||
-rw-r--r-- | clutter/clutter/clutter-stage.c | 32 |
3 files changed, 27 insertions, 28 deletions
diff --git a/clutter/clutter/clutter-seat.c b/clutter/clutter/clutter-seat.c index f4309787c..1908fda12 100644 --- a/clutter/clutter/clutter-seat.c +++ b/clutter/clutter/clutter-seat.c @@ -607,21 +607,6 @@ clutter_seat_get_supported_virtual_device_types (ClutterSeat *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); -} - gboolean clutter_seat_handle_event_post (ClutterSeat *seat, const ClutterEvent *event) diff --git a/clutter/clutter/clutter-seat.h b/clutter/clutter/clutter-seat.h index 135789588..5c5dfe6eb 100644 --- a/clutter/clutter/clutter-seat.h +++ b/clutter/clutter/clutter-seat.h @@ -84,10 +84,6 @@ struct _ClutterSeatClass ClutterKeymap * (* get_keymap) (ClutterSeat *seat); - void (* compress_motion) (ClutterSeat *seat, - ClutterEvent *event, - const ClutterEvent *to_discard); - gboolean (* handle_event_post) (ClutterSeat *seat, const ClutterEvent *event); @@ -151,10 +147,6 @@ 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); - CLUTTER_EXPORT void clutter_seat_warp_pointer (ClutterSeat *seat, int x, diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c index af6c413ba..fd12c0381 100644 --- a/clutter/clutter/clutter-stage.c +++ b/clutter/clutter/clutter-stage.c @@ -687,6 +687,32 @@ _clutter_stage_has_queued_events (ClutterStage *stage) return priv->event_queue->length > 0; } +static void +clutter_stage_compress_motion (ClutterStage *stage, + 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 (!clutter_event_get_relative_motion (to_discard, + &dx, &dy, + &dx_unaccel, &dy_unaccel)) + return; + + clutter_event_get_relative_motion (event, + &dst_dx, &dst_dy, + &dst_dx_unaccel, &dst_dy_unaccel); + + event->motion.flags |= CLUTTER_EVENT_FLAG_RELATIVE_MOTION; + event->motion.dx = dx + dst_dx; + event->motion.dy = dy + dst_dy; + event->motion.dx_unaccel = dx_unaccel + dst_dx_unaccel; + event->motion.dy_unaccel = dy_unaccel + dst_dy_unaccel; +} + void _clutter_stage_process_queued_events (ClutterStage *stage) { @@ -754,11 +780,7 @@ _clutter_stage_process_queued_events (ClutterStage *stage) (int) event->motion.y); if (next_event->type == CLUTTER_MOTION) - { - ClutterSeat *seat = clutter_input_device_get_seat (device); - - clutter_seat_compress_motion (seat, next_event, event); - } + clutter_stage_compress_motion (stage, next_event, event); goto next_event; } |