wayland: Update internal wayland state unconditionally

Things like idle times and the cursor position need to be updated even
if there's a mutter grab in effect.

https://bugzilla.gnome.org/show_bug.cgi?id=712247
This commit is contained in:
Rui Matos 2013-11-13 21:41:29 +01:00
parent ae44bff0b1
commit 63b9110f93
5 changed files with 43 additions and 15 deletions

View File

@ -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;
}

View File

@ -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 */

View File

@ -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,
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:

View File

@ -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);

View File

@ -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);
}