mirror of
https://github.com/brl/mutter.git
synced 2025-08-03 07:04:41 +00:00
xlib: Internally retrieve XEvents
Previously we relied on the application to send all X events through Cogl using cogl_xlib_renderer_handle_event. This breaks the abstraction that an application shouldn't need to know what winsys Cogl is using. Now that we have main loop integreation in Cogl, the Xlib-based winsys's can report that Cogl needs to block on the file descriptor of the X connection and it can manually handle the events. The event retrieval can be disabled by an application if it calls the new cogl_xlib_renderer_set_event_retrieval_enabled() function. The event retrieval will also automatically be disabled if the application sets a foreign display. Reviewed-by: Robert Bragg <robert@linux.intel.com>
This commit is contained in:
@@ -564,6 +564,28 @@ _cogl_winsys_xlib_get_visual_info (void)
|
||||
return get_visual_info (ctx->display, egl_display->egl_config);
|
||||
}
|
||||
|
||||
static void
|
||||
_cogl_winsys_poll_get_info (CoglContext *context,
|
||||
CoglPollFD **poll_fds,
|
||||
int *n_poll_fds,
|
||||
gint64 *timeout)
|
||||
{
|
||||
_cogl_xlib_renderer_poll_get_info (context->display->renderer,
|
||||
poll_fds,
|
||||
n_poll_fds,
|
||||
timeout);
|
||||
}
|
||||
|
||||
static void
|
||||
_cogl_winsys_poll_dispatch (CoglContext *context,
|
||||
const CoglPollFD *poll_fds,
|
||||
int n_poll_fds)
|
||||
{
|
||||
_cogl_xlib_renderer_poll_dispatch (context->display->renderer,
|
||||
poll_fds,
|
||||
n_poll_fds);
|
||||
}
|
||||
|
||||
#ifdef EGL_KHR_image_pixmap
|
||||
|
||||
static gboolean
|
||||
@@ -710,6 +732,9 @@ _cogl_winsys_egl_xlib_get_vtable (void)
|
||||
|
||||
vtable.xlib_get_visual_info = _cogl_winsys_xlib_get_visual_info;
|
||||
|
||||
vtable.poll_get_info = _cogl_winsys_poll_get_info;
|
||||
vtable.poll_dispatch = _cogl_winsys_poll_dispatch;
|
||||
|
||||
#ifdef EGL_KHR_image_pixmap
|
||||
/* X11 tfp support... */
|
||||
/* XXX: instead of having a rather monolithic winsys vtable we could
|
||||
|
@@ -2051,6 +2051,27 @@ _cogl_winsys_texture_pixmap_x11_get_texture (CoglTexturePixmapX11 *tex_pixmap)
|
||||
return glx_tex_pixmap->glx_tex;
|
||||
}
|
||||
|
||||
static void
|
||||
_cogl_winsys_poll_get_info (CoglContext *context,
|
||||
CoglPollFD **poll_fds,
|
||||
int *n_poll_fds,
|
||||
gint64 *timeout)
|
||||
{
|
||||
_cogl_xlib_renderer_poll_get_info (context->display->renderer,
|
||||
poll_fds,
|
||||
n_poll_fds,
|
||||
timeout);
|
||||
}
|
||||
|
||||
static void
|
||||
_cogl_winsys_poll_dispatch (CoglContext *context,
|
||||
const CoglPollFD *poll_fds,
|
||||
int n_poll_fds)
|
||||
{
|
||||
_cogl_xlib_renderer_poll_dispatch (context->display->renderer,
|
||||
poll_fds,
|
||||
n_poll_fds);
|
||||
}
|
||||
|
||||
static CoglWinsysVtable _cogl_winsys_vtable =
|
||||
{
|
||||
@@ -2082,6 +2103,9 @@ static CoglWinsysVtable _cogl_winsys_vtable =
|
||||
_cogl_winsys_onscreen_remove_swap_buffers_callback,
|
||||
.onscreen_set_visibility = _cogl_winsys_onscreen_set_visibility,
|
||||
|
||||
.poll_get_info = _cogl_winsys_poll_get_info,
|
||||
.poll_dispatch = _cogl_winsys_poll_dispatch,
|
||||
|
||||
/* X11 tfp support... */
|
||||
/* XXX: instead of having a rather monolithic winsys vtable we could
|
||||
* perhaps look for a way to separate these... */
|
||||
|
Reference in New Issue
Block a user