[Spice-devel] [PATCH spice-gtk] Allow to build without X11 gdk backend
Pavel Grunt
pgrunt at redhat.com
Mon Jun 19 13:59:41 UTC 2017
---
src/spice-gtk-session.c | 2 +-
src/spice-widget-egl.c | 14 +++++++++++++-
src/spice-widget.c | 2 +-
3 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
index 33db3c8..e338ce6 100644
--- a/src/spice-gtk-session.c
+++ b/src/spice-gtk-session.c
@@ -18,10 +18,10 @@
#include "config.h"
#include <glib.h>
+#include <gdk/gdk.h>
#ifdef HAVE_X11_XKBLIB_H
#include <X11/XKBlib.h>
-#include <gdk/gdkx.h>
#endif
#ifdef GDK_WINDOWING_X11
#include <X11/Xlib.h>
diff --git a/src/spice-widget-egl.c b/src/spice-widget-egl.c
index 7c21113..b50641c 100644
--- a/src/spice-widget-egl.c
+++ b/src/spice-widget-egl.c
@@ -18,6 +18,7 @@
#include "config.h"
#include <math.h>
+#include <gdk/gdk.h>
#define EGL_EGLEXT_PROTOTYPES
#define GL_GLEXT_PROTOTYPES
@@ -27,7 +28,9 @@
#include "spice-gtk-session-priv.h"
#include <libdrm/drm_fourcc.h>
+#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
+#endif
#ifdef GDK_WINDOWING_WAYLAND
#include <gdk/gdkwayland.h>
#endif
@@ -291,6 +294,7 @@ gl_make_current(SpiceDisplay *display, GError **err)
g_return_val_if_fail(d->egl.context_ready, FALSE);
+#ifdef GDK_WINDOWING_X11
if (GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
EGLBoolean success = eglMakeCurrent(d->egl.display,
d->egl.surface,
@@ -303,8 +307,12 @@ gl_make_current(SpiceDisplay *display, GError **err)
return FALSE;
}
}
+#endif
#if GTK_CHECK_VERSION(3,16,0)
- else {
+#ifdef GDK_WINDOWING_X11
+ else
+#endif
+ {
/* Ignore GLib's too-new warnings */
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
GtkWidget *area = gtk_stack_get_child_by_name(d->stack, "gl-area");
@@ -402,6 +410,7 @@ void spice_egl_unrealize_display(SpiceDisplay *display)
d->egl.prog = 0;
}
+#ifdef GDK_WINDOWING_X11
if (GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
/* egl.surface && egl.ctx are only created on x11, see
spice_egl_init() */
@@ -422,6 +431,7 @@ void spice_egl_unrealize_display(SpiceDisplay *display)
/* do not call eglterminate() since egl may be used by
* somebody else code */
}
+#endif
}
G_GNUC_INTERNAL
@@ -619,10 +629,12 @@ void spice_egl_update_display(SpiceDisplay *display)
0, 0, 1, 1);
}
+#ifdef GDK_WINDOWING_X11
if (GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
/* gtk+ does the swap with gtkglarea */
eglSwapBuffers(d->egl.display, d->egl.surface);
}
+#endif
glUseProgram(prog);
}
diff --git a/src/spice-widget.c b/src/spice-widget.c
index 386724d..139510d 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -19,10 +19,10 @@
#include <math.h>
#include <glib.h>
+#include <gdk/gdk.h>
#ifdef HAVE_X11_XKBLIB_H
#include <X11/XKBlib.h>
-#include <gdk/gdkx.h>
#endif
#ifdef GDK_WINDOWING_X11
#include <X11/Xlib.h>
--
2.13.0
More information about the Spice-devel
mailing list