diff --git a/src/core/display.c b/src/core/display.c index f49b64bd7..0d437760c 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -2044,6 +2044,15 @@ meta_display_handle_event (MetaDisplay *display, { MetaWindow *window; gboolean frame_was_receiver; +#ifdef HAVE_WAYLAND + MetaWaylandCompositor *compositor; + + if (meta_is_wayland_compositor ()) + { + compositor = meta_wayland_compositor_get_default (); + meta_wayland_compositor_update (compositor, event); + } +#endif /* HAVE_WAYLAND */ window = get_window_for_actor (event->any.source, &frame_was_receiver); @@ -2288,9 +2297,6 @@ meta_display_handle_event (MetaDisplay *display, #ifdef HAVE_WAYLAND if (meta_is_wayland_compositor () && (display->grab_op == META_GRAB_OP_NONE)) { - MetaWaylandCompositor *compositor; - compositor = meta_wayland_compositor_get_default (); - if (meta_wayland_compositor_handle_event (compositor, event)) return TRUE; } diff --git a/src/wayland/meta-wayland-private.h b/src/wayland/meta-wayland-private.h index 140ce63cf..d13090bb3 100644 --- a/src/wayland/meta-wayland-private.h +++ b/src/wayland/meta-wayland-private.h @@ -107,5 +107,7 @@ MetaWaylandBuffer * meta_wayland_buffer_from_resource (struct wl_resou void meta_wayland_buffer_reference (MetaWaylandBufferReference *ref, MetaWaylandBuffer *buffer); +void meta_wayland_compositor_update (MetaWaylandCompositor *compositor, + const ClutterEvent *event); #endif /* META_WAYLAND_PRIVATE_H */ diff --git a/src/wayland/meta-wayland-seat.c b/src/wayland/meta-wayland-seat.c index ef404faf9..0b9415a83 100644 --- a/src/wayland/meta-wayland-seat.c +++ b/src/wayland/meta-wayland-seat.c @@ -257,11 +257,6 @@ notify_motion (MetaWaylandSeat *seat, const ClutterEvent *event) { MetaWaylandPointer *pointer = &seat->pointer; - float x, y; - - clutter_event_get_coords (event, &x, &y); - pointer->x = wl_fixed_from_double (x); - pointer->y = wl_fixed_from_double (y); meta_wayland_seat_repick (seat, event); @@ -363,10 +358,16 @@ count_buttons (const ClutterEvent *event) return count; } -gboolean -meta_wayland_seat_handle_event (MetaWaylandSeat *seat, - const ClutterEvent *event) +void +meta_wayland_seat_update_pointer (MetaWaylandSeat *seat, + const ClutterEvent *event) { + float x, y; + + clutter_event_get_coords (event, &x, &y); + seat->pointer.x = wl_fixed_from_double (x); + seat->pointer.y = wl_fixed_from_double (y); + seat->pointer.button_count = count_buttons (event); if (seat->cursor_tracker) @@ -381,7 +382,12 @@ meta_wayland_seat_handle_event (MetaWaylandSeat *seat, meta_cursor_tracker_queue_redraw (seat->cursor_tracker, CLUTTER_ACTOR (event->any.stage)); } +} +gboolean +meta_wayland_seat_handle_event (MetaWaylandSeat *seat, + const ClutterEvent *event) +{ switch (event->type) { case CLUTTER_MOTION: diff --git a/src/wayland/meta-wayland-seat.h b/src/wayland/meta-wayland-seat.h index c5c88e246..dd2b85e72 100644 --- a/src/wayland/meta-wayland-seat.h +++ b/src/wayland/meta-wayland-seat.h @@ -77,6 +77,10 @@ MetaWaylandSeat * meta_wayland_seat_new (struct wl_display *display, gboolean is_native); +void +meta_wayland_seat_update_pointer (MetaWaylandSeat *seat, + const ClutterEvent *event); + gboolean meta_wayland_seat_handle_event (MetaWaylandSeat *seat, const ClutterEvent *event); diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c index ce80bfd87..dabdc1ed3 100644 --- a/src/wayland/meta-wayland.c +++ b/src/wayland/meta-wayland.c @@ -533,8 +533,9 @@ stage_destroy_cb (void) meta_quit (META_EXIT_SUCCESS); } -static void -reset_idletimes (const ClutterEvent *event) +void +meta_wayland_compositor_update (MetaWaylandCompositor *compositor, + const ClutterEvent *event) { ClutterInputDevice *device, *source_device; MetaIdleMonitor *core_monitor, *device_monitor; @@ -559,14 +560,23 @@ reset_idletimes (const ClutterEvent *event) device_monitor = meta_idle_monitor_get_for_device (device_id); meta_idle_monitor_reset_idletime (device_monitor); } + + switch (event->type) + { + case CLUTTER_MOTION: + case CLUTTER_BUTTON_PRESS: + case CLUTTER_BUTTON_RELEASE: + case CLUTTER_SCROLL: + meta_wayland_seat_update_pointer (compositor->seat, event); + default: + break; + } } gboolean meta_wayland_compositor_handle_event (MetaWaylandCompositor *compositor, const ClutterEvent *event) { - reset_idletimes (event); - return meta_wayland_seat_handle_event (compositor->seat, event); }