static gboolean clutter_event_dispatch (GSource *source, GSourceFunc callback, gpointer user_data) { ClutterEvent *event; MSG msg; clutter_threads_enter (); /* Process Windows messages until we've got one that translates into the clutter event queue */ while (!clutter_events_pending () && PeekMessageW (&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageW (&msg); /* Pop an event off the queue if any */ if ((event = clutter_event_get ())) { /* forward the event into clutter for emission etc. */ clutter_do_event (event); clutter_event_free (event); } clutter_threads_leave (); return TRUE; }
static void events_queue (ClutterBackendX11 *backend_x11) { ClutterBackend *backend = CLUTTER_BACKEND (backend_x11); Display *xdisplay = backend_x11->xdpy; ClutterEvent *event; XEvent xevent; while (!clutter_events_pending () && XPending (xdisplay)) { XNextEvent (xdisplay, &xevent); event = clutter_event_new (CLUTTER_NOTHING); #ifdef HAVE_XGE XGetEventData (xdisplay, &xevent.xcookie); #endif if (_clutter_backend_translate_event (backend, &xevent, event)) _clutter_event_push (event, FALSE); else clutter_event_free (event); #ifdef HAVE_XGE XFreeEventData (xdisplay, &xevent.xcookie); #endif } }
static void events_queue (ClutterBackend *backend) { ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend); ClutterBackendX11Class *backend_x11_class = CLUTTER_BACKEND_X11_GET_CLASS (backend_x11); ClutterEvent *event; Display *xdisplay = backend_x11->xdpy; XEvent xevent; ClutterMainContext *clutter_context; clutter_context = _clutter_context_get_default (); while (!clutter_events_pending () && XPending (xdisplay)) { XNextEvent (xdisplay, &xevent); if (backend_x11_class->handle_event (backend_x11, &xevent)) continue; event = clutter_event_new (CLUTTER_NOTHING); if (event_translate (backend, event, &xevent)) { /* push directly here to avoid copy of queue_put */ g_queue_push_head (clutter_context->events_queue, event); } else { clutter_event_free (event); } } }
static gboolean event_prepare (GSource *source, gint *timeout_) { *timeout_ = -1; return clutter_events_pending (); }
static gboolean clutter_event_source_wayland_check (GSource *base) { ClutterEventSourceWayland *source = (ClutterEventSourceWayland *) base; gboolean retval; clutter_threads_enter (); retval = clutter_events_pending () || source->pfd.revents; clutter_threads_leave (); return retval; }
static gboolean clutter_event_prepare (GSource *source, gint *timeout) { gboolean retval; clutter_threads_enter (); *timeout = -1; retval = (clutter_events_pending () || check_msg_pending ()); clutter_threads_leave (); return retval; }
static gboolean clutter_event_prepare (GSource *source, gint *timeout) { ClutterBackendX11 *backend = ((ClutterEventSource *) source)->backend; gboolean retval; _clutter_threads_acquire_lock (); *timeout = -1; retval = (clutter_events_pending () || XPending (backend->xdpy)); _clutter_threads_release_lock (); return retval; }
static gboolean clutter_event_prepare (GSource *source, gint *timeout) { ClutterBackend *backend = ((ClutterEventSource *) source)->backend; gboolean retval; clutter_threads_enter (); *timeout = -1; retval = (clutter_events_pending () || check_xpending (backend)); clutter_threads_leave (); return retval; }
static gboolean clutter_event_check (GSource *source) { ClutterEventSource *event_source = (ClutterEventSource *) source; gboolean retval; clutter_threads_enter (); if ((event_source->event_poll_fd.revents & G_IO_IN)) retval = (clutter_events_pending () || check_msg_pending ()); else retval = FALSE; clutter_threads_leave (); return retval; }
static gboolean clutter_event_check (GSource *source) { ClutterEventSource *event_source = (ClutterEventSource *) source; ClutterBackendX11 *backend = event_source->backend; gboolean retval; _clutter_threads_acquire_lock (); if (event_source->event_poll_fd.revents & G_IO_IN) retval = (clutter_events_pending () || XPending (backend->xdpy)); else retval = FALSE; _clutter_threads_release_lock (); return retval; }
static void events_queue (ClutterBackend *backend) { ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend); Display *xdisplay = backend_x11->xdpy; ClutterEvent *event; XEvent xevent; while (!clutter_events_pending () && XPending (xdisplay)) { XNextEvent (xdisplay, &xevent); event = clutter_event_new (CLUTTER_NOTHING); if (_clutter_backend_translate_event (backend, &xevent, event)) _clutter_event_push (event, FALSE); else clutter_event_free (event); } }
static gboolean clutter_event_source_wayland_prepare (GSource *base, gint *timeout) { ClutterEventSourceWayland *source = (ClutterEventSourceWayland *) base; gboolean retval; clutter_threads_enter (); *timeout = -1; /* We have to add/remove the GPollFD if we want to update our * poll event mask dynamically. Instead, let's just flush all * writes on idle */ wl_display_flush (source->display); retval = clutter_events_pending (); clutter_threads_leave (); return retval; }
IO_METHOD(IoClutterEvent, hasPending) { return IOBOOL(self, clutter_events_pending()); }
static gboolean event_check (GSource *source) { return clutter_events_pending (); }