summaryrefslogtreecommitdiff
path: root/clutter/clutter-backend.c
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2011-05-13 16:54:11 +0100
committerRobert Bragg <robert@linux.intel.com>2011-12-08 16:13:37 +0000
commit16ed7677e00fda9e9ef4e85ef7032a367e273e0c (patch)
tree494c2e64e6c5c5b099fb4e085dc10433a64debb0 /clutter/clutter-backend.c
parent07c6f96cb43b1e0c788e50323f1184bd2906e3f7 (diff)
downloadclutter-16ed7677e00fda9e9ef4e85ef7032a367e273e0c.tar.gz
Adds wayland-surface actor for wayland compositors
This adds a --enable-wayland-compositor configure option which will add support for a ClutterWaylandSurface actor which can be used to aid in writing Wayland compositors using Clutter by providing a ClutterActor to represent Wayland client surfaces. Notably this configure option isn't tied into any particular backend since conceptually the compositor support can be used in conjunction with any clutter backend that has corresponding Cogl support. Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
Diffstat (limited to 'clutter/clutter-backend.c')
-rw-r--r--clutter/clutter-backend.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/clutter/clutter-backend.c b/clutter/clutter-backend.c
index 06f4125c7..115d29b20 100644
--- a/clutter/clutter-backend.c
+++ b/clutter/clutter-backend.c
@@ -78,6 +78,10 @@
#include "wayland/clutter-device-manager-wayland.h"
#endif
+#ifdef HAVE_CLUTTER_WAYLAND_COMPOSITOR
+#include <wayland-server.h>
+#endif
+
G_DEFINE_ABSTRACT_TYPE (ClutterBackend, clutter_backend, G_TYPE_OBJECT);
#define DEFAULT_FONT_NAME "Sans 10"
@@ -108,6 +112,13 @@ enum
static guint backend_signals[LAST_SIGNAL] = { 0, };
+/* Global for being able to specify a compositor side wayland display
+ * pointer before clutter initialization */
+#ifdef HAVE_CLUTTER_WAYLAND_COMPOSITOR
+static struct wl_display *_wayland_compositor_display;
+#endif
+
+
static void
clutter_backend_dispose (GObject *gobject)
{
@@ -299,6 +310,11 @@ clutter_backend_real_create_context (ClutterBackend *backend,
if (backend->cogl_display == NULL)
goto error;
+#ifdef HAVE_CLUTTER_WAYLAND_COMPOSITOR
+ cogl_wayland_display_set_compositor_display (backend->cogl_display,
+ _wayland_compositor_display);
+#endif
+
CLUTTER_NOTE (BACKEND, "Setting up the display");
if (!cogl_display_setup (backend->cogl_display, &internal_error))
goto error;
@@ -1307,3 +1323,28 @@ clutter_backend_get_cogl_context (ClutterBackend *backend)
{
return backend->cogl_context;
}
+
+#ifdef HAVE_CLUTTER_WAYLAND_COMPOSITOR
+/**
+ * clutter_wayland_set_compositor_display:
+ * @display: A compositor side struct wl_display pointer
+ *
+ * This informs Clutter of your compositor side Wayland display
+ * object. This must be called before calling clutter_init().
+ *
+ * Since: 1.8
+ * Stability: unstable
+ */
+void
+clutter_wayland_set_compositor_display (struct wl_display *display)
+{
+ if (_clutter_context_is_initialized ())
+ {
+ g_warning ("%s() can only be used before calling clutter_init()",
+ G_STRFUNC);
+ return;
+ }
+
+ _wayland_compositor_display = display;
+}
+#endif