diff --git a/clutter/clutter.symbols b/clutter/clutter.symbols index 346214196..c7ba7b31f 100644 --- a/clutter/clutter.symbols +++ b/clutter/clutter.symbols @@ -1162,6 +1162,7 @@ clutter_wayland_input_device_get_wl_seat clutter_wayland_stage_get_wl_shell_surface clutter_wayland_stage_get_wl_surface clutter_wayland_set_display +clutter_wayland_disable_event_retrieval #endif #ifdef CLUTTER_WINDOWING_WIN32 clutter_win32_disable_event_retrieval diff --git a/clutter/wayland/clutter-backend-wayland.c b/clutter/wayland/clutter-backend-wayland.c index 610df501d..ddfff03ca 100644 --- a/clutter/wayland/clutter-backend-wayland.c +++ b/clutter/wayland/clutter-backend-wayland.c @@ -61,6 +61,7 @@ G_DEFINE_TYPE (ClutterBackendWayland, clutter_backend_wayland, CLUTTER_TYPE_BACKEND); static struct wl_display *_foreign_display = NULL; +static gboolean _no_event_dispatch = FALSE; static void clutter_backend_wayland_load_cursor (ClutterBackendWayland *backend_wayland); @@ -240,6 +241,7 @@ clutter_backend_wayland_get_renderer (ClutterBackend *backend, renderer = cogl_renderer_new (); + cogl_wayland_renderer_set_event_dispatch_enabled (renderer, !_no_event_dispatch); cogl_renderer_set_winsys_id (renderer, COGL_WINSYS_ID_EGL_WAYLAND); cogl_wayland_renderer_set_foreign_display (renderer, @@ -356,3 +358,32 @@ clutter_wayland_set_display (struct wl_display *display) _foreign_display = display; } + +/** + * clutter_wayland_disable_event_retrieval: + * + * Disables the dispatch of the events in the main loop. + * + * This is useful for integrating Clutter with another library that will do the + * event dispatch; in general only a single source should be acting on changes + * on the Wayland file descriptor. + * + * This function can only be called before calling + * clutter_init(). + * + * This function should not be normally used by applications. + * + * Since: 1.16 + */ +void +clutter_wayland_disable_event_retrieval (void) +{ + if (_clutter_context_is_initialized ()) + { + g_warning ("%s() can only be used before calling clutter_init()", + G_STRFUNC); + return; + } + + _no_event_dispatch = TRUE; +} diff --git a/clutter/wayland/clutter-wayland.h b/clutter/wayland/clutter-wayland.h index 00e02b7bd..e56b24129 100644 --- a/clutter/wayland/clutter-wayland.h +++ b/clutter/wayland/clutter-wayland.h @@ -49,5 +49,8 @@ struct wl_surface *clutter_wayland_stage_get_wl_surface (ClutterStage *stage); CLUTTER_AVAILABLE_IN_1_16 void clutter_wayland_set_display (struct wl_display *display); +CLUTTER_AVAILABLE_IN_1_16 +void clutter_wayland_disable_event_retrieval (void); + G_END_DECLS #endif /* __CLUTTER_WAYLAND_H__ */ diff --git a/doc/reference/clutter/clutter2-sections.txt b/doc/reference/clutter/clutter2-sections.txt index 8cae98b58..cc9e977fb 100644 --- a/doc/reference/clutter/clutter2-sections.txt +++ b/doc/reference/clutter/clutter2-sections.txt @@ -923,6 +923,7 @@ clutter_wayland_input_device_get_wl_seat clutter_wayland_stage_get_wl_shell_surface clutter_wayland_stage_get_wl_surface clutter_wayland_set_display +clutter_wayland_disable_event_retrieval