[clutter] wayland: Add API for disabling the event dispatching
- From: Rob Bradford <rbradford src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter] wayland: Add API for disabling the event dispatching
- Date: Tue, 23 Jul 2013 17:30:22 +0000 (UTC)
commit a5230278b42cc05fb6ab937bf419fa221c5feeea
Author: Rob Bradford <rob linux intel com>
Date: Mon Jul 15 18:27:33 2013 +0100
wayland: Add API for disabling the event dispatching
This allows the integration of Clutter with another library, like GTK+,
that is dispatching the events itself. This is implemented by calling
into the cogl_wayland_renderer_set_event_dispatch_enabled() and since
that function must be called on the newly created renderer the newly
added clutter_wayland_disable_event_retrieval must be called before
clutter_init()
https://bugzilla.gnome.org/show_bug.cgi?id=704279
clutter/clutter.symbols | 1 +
clutter/wayland/clutter-backend-wayland.c | 31 +++++++++++++++++++++++++++
clutter/wayland/clutter-wayland.h | 3 ++
doc/reference/clutter/clutter2-sections.txt | 1 +
4 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter.symbols b/clutter/clutter.symbols
index 3462141..c7ba7b3 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 610df50..ddfff03 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.
+ *
+ * <warning>This function can only be called before calling
+ * clutter_init().</warning>
+ *
+ * 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 00e02b7..e56b241 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 8cae98b..cc9e977 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
</SECTION>
<SECTION>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]