| author | nobled <nobled@dreamwidth.org> | 2011-02-14 15:50:48 (GMT) |
|---|---|---|
| committer | nobled <nobled@dreamwidth.org> | 2011-02-14 19:12:00 (GMT) |
| commit | d73142d1b31501d1fa2aa7bf55048678e1bafd56 (patch) (side-by-side diff) | |
| tree | 0b723044aac965d68b232ffb42d1771b412de9f5 | |
| parent | 9b468fad670fff544119835521006f15d1944fb6 (diff) | |
| download | clayland-d73142d1b31501d1fa2aa7bf55048678e1bafd56.zip clayland-d73142d1b31501d1fa2aa7bf55048678e1bafd56.tar.gz | |
ifdef out x11-specific code
This makes way for using alternate backends, like
clutter-wayland (for a nested compositor).
| -rw-r--r-- | src/Makefile.am | 2 | ||||
| -rw-r--r-- | src/clayland-buffer.c | 8 | ||||
| -rw-r--r-- | src/clayland-private.h | 30 | ||||
| -rw-r--r-- | src/dri2-x11.c (renamed from src/dri2.c) | 4 |
4 files changed, 38 insertions, 6 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index c2ee7b3..3ed91dd 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -20,5 +20,5 @@ libclayland_la_SOURCES = \ output.c \ shell.c \ wayland-source.c \ - dri2.c + dri2-x11.c diff --git a/src/clayland-buffer.c b/src/clayland-buffer.c index bc559bd..39b361c 100644 --- a/src/clayland-buffer.c +++ b/src/clayland-buffer.c @@ -1,5 +1,8 @@ +#include <clutter/clutter.h> +#if defined(CLUTTER_WINDOWING_EGL) #include <clutter/egl/clutter-egl.h> +#endif #include <string.h> #include "clayland-private.h" @@ -240,8 +243,11 @@ _clayland_add_buffer_interfaces(ClaylandCompositor *compositor) g_warning("DRI2 connect failed, disabling DRM buffers"); return; } - +#if defined(CLUTTER_WINDOWING_X11) && defined(CLUTTER_WINDOWING_EGL) edpy = clutter_egl_display (); +#else + edpy = EGL_NO_DISPLAY; +#endif extensions = eglQueryString(edpy, EGL_EXTENSIONS); glextensions = glGetString(GL_EXTENSIONS); drm = has_extension(extensions, 18, "EGL_MESA_drm_image"); diff --git a/src/clayland-private.h b/src/clayland-private.h index 2752852..20341b9 100644 --- a/src/clayland-private.h +++ b/src/clayland-private.h @@ -10,7 +10,9 @@ #include <glib.h> #include <glib-object.h> #include <wayland-server.h> +#if defined(CLUTTER_WINDOWING_X11) #include <X11/Xlib-xcb.h> +#endif #if defined(COGL_HAS_GL) #include <GL/gl.h> @@ -63,10 +65,32 @@ VISUAL_RGB G_GNUC_INTERNAL GSource *wl_glib_source_new(struct wl_event_loop *loop); +#if defined(CLUTTER_WINDOWING_X11) G_GNUC_INTERNAL -int dri2_connect(ClaylandCompositor *compositor); +int dri2_x11_connect(ClaylandCompositor *compositor); G_GNUC_INTERNAL -int dri2_authenticate(ClaylandCompositor *compositor, uint32_t magic); +int dri2_x11_authenticate(ClaylandCompositor *compositor, uint32_t magic); +#endif + +static inline +int dri2_connect(ClaylandCompositor *compositor) +{ +#if defined(CLUTTER_WINDOWING_X11) +return dri2_x11_connect(compositor); +#else +return -1; +#endif +} + +static inline +int dri2_authenticate(ClaylandCompositor *compositor, uint32_t magic) +{ +#if defined(CLUTTER_WINDOWING_X11) +return dri2_x11_authenticate(compositor, magic); +#else +return -1; +#endif +} G_GNUC_INTERNAL extern const struct wl_surface_interface clayland_surface_interface; @@ -119,8 +143,10 @@ struct _ClaylandCompositor { int drm_fd; char *drm_path; +#ifdef CLUTTER_WINDOWING_X11 xcb_connection_t *xconn; Window root_window; +#endif }; struct _ClaylandCompositorClass { diff --git a/src/dri2.c b/src/dri2-x11.c index 1b58c4e..4794005 100644 --- a/src/dri2.c +++ b/src/dri2-x11.c @@ -9,7 +9,7 @@ #include "clayland-config.h" int -dri2_connect(ClaylandCompositor *compositor) +dri2_x11_connect(ClaylandCompositor *compositor) { Display *dpy; xcb_connection_t *conn; @@ -100,7 +100,7 @@ dri2_connect(ClaylandCompositor *compositor) } int -dri2_authenticate(ClaylandCompositor *compositor, uint32_t magic) +dri2_x11_authenticate(ClaylandCompositor *compositor, uint32_t magic) { xcb_connection_t *conn; xcb_dri2_authenticate_reply_t *authenticate; |
