wayland: Do not poll the Wayland socket for events

Since Cogl also polls on this file descriptor we can get into situations
where our event source is woken up to handle events but those events
have instead been handled by Cogl resulting in the source sitting in
poll().

We can safely rely on Cogl to handle the polling on the event source and
to dispatch those events.

https://bugzilla.gnome.org/show_bug.cgi?id=702202
This commit is contained in:
Rob Bradford 2013-06-27 14:45:01 +01:00
parent c3be92a30c
commit cba63dd93f

View File

@ -41,7 +41,6 @@
typedef struct _ClutterEventSourceWayland typedef struct _ClutterEventSourceWayland
{ {
GSource source; GSource source;
GPollFD pfd;
struct wl_display *display; struct wl_display *display;
} ClutterEventSourceWayland; } ClutterEventSourceWayland;
@ -70,12 +69,11 @@ clutter_event_source_wayland_prepare (GSource *base, gint *timeout)
static gboolean static gboolean
clutter_event_source_wayland_check (GSource *base) clutter_event_source_wayland_check (GSource *base)
{ {
ClutterEventSourceWayland *source = (ClutterEventSourceWayland *) base;
gboolean retval; gboolean retval;
_clutter_threads_acquire_lock (); _clutter_threads_acquire_lock ();
retval = clutter_events_pending () || source->pfd.revents; retval = clutter_events_pending ();
_clutter_threads_release_lock (); _clutter_threads_release_lock ();
@ -87,17 +85,10 @@ clutter_event_source_wayland_dispatch (GSource *base,
GSourceFunc callback, GSourceFunc callback,
gpointer data) gpointer data)
{ {
ClutterEventSourceWayland *source = (ClutterEventSourceWayland *) base;
ClutterEvent *event; ClutterEvent *event;
_clutter_threads_acquire_lock (); _clutter_threads_acquire_lock ();
if (source->pfd.revents)
{
wl_display_dispatch (source->display);
source->pfd.revents = 0;
}
event = clutter_event_get (); event = clutter_event_get ();
if (event) if (event)
@ -129,10 +120,6 @@ _clutter_event_source_wayland_new (struct wl_display *display)
g_source_new (&clutter_event_source_wayland_funcs, g_source_new (&clutter_event_source_wayland_funcs,
sizeof (ClutterEventSourceWayland)); sizeof (ClutterEventSourceWayland));
source->display = display; source->display = display;
source->pfd.fd =
wl_display_get_fd (display);
source->pfd.events = G_IO_IN | G_IO_ERR;
g_source_add_poll (&source->source, &source->pfd);
return &source->source; return &source->source;
} }