[Spice-devel] [PATCH spice-gtk] Allow to build without X11 gdk backend

Marc-André Lureau marcandre.lureau at redhat.com
Mon Jun 19 14:36:53 UTC 2017



----- Original Message -----
> On Mon, 2017-06-19 at 10:06 -0400, Frediano Ziglio wrote:
> > Question: can GDK have no X11?
> chances are low but there may be a distro shipping gtk without the x11
> backend
> 
> > I suppose only wayland compiled in?
> or win32 or quartz (macOS).
> 
> The issue I noticed was in egl - which can work with wayland or X11
> 
> Pavel

ok, ack then!
thanks

> 
> > 
> > > 
> > > ---
> > >  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>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
> 


More information about the Spice-devel mailing list