[Spice-devel] [PATCH v3 2/2] Lower gtk+ requirement to 3.10

Marc-André Lureau marcandre.lureau at gmail.com
Tue Mar 15 11:03:53 UTC 2016


Make GtkGlArea optional allows to lower gtk+ requirement to
3.10 (required for GtkStack). However, gl display is unsupported on
wayland with gtk+ < 3.16.

Signed-off-by: Marc-André Lureau <marcandre.lureau at gmail.com>
---
 configure.ac           |  4 ++--
 src/spice-widget-egl.c |  2 ++
 src/spice-widget.c     | 12 ++++++++++--
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index 052561a..24fddc1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -123,7 +123,7 @@ AC_ARG_WITH([gtk],
   [with_gtk=3.0])
 
 case "$with_gtk" in
-  3.0) GTK_REQUIRED=3.16
+  3.0) GTK_REQUIRED=3.10
        ;;
   no)
        AS_IF([test x$enable_gtk_doc = xyes],
@@ -134,7 +134,7 @@ AC_SUBST([GTK_REQUIRED])
 AM_CONDITIONAL([WITH_GTK],[test "$with_gtk" != "no"])
 
 AS_IF([test "x$with_gtk" != "xno"],
-      [PKG_CHECK_MODULES(GTK, gtk+-3.0 >= $GTK_REQUIRED)])
+      [PKG_CHECK_MODULES(GTK, gtk+-3.0 >= $GTK_REQUIRED epoxy)])
 AC_SUBST(GTK_CFLAGS)
 AC_SUBST(GTK_LIBS)
 SPICE_GTK_REQUIRES="${SPICE_GTK_REQUIRES} gtk+-3.0 >= $GTK_REQUIRED"
diff --git a/src/spice-widget-egl.c b/src/spice-widget-egl.c
index 1b3cd07..a9bea52 100644
--- a/src/spice-widget-egl.c
+++ b/src/spice-widget-egl.c
@@ -29,7 +29,9 @@
 #include <libdrm/drm_fourcc.h>
 
 #include <gdk/gdkx.h>
+#if GTK_CHECK_VERSION(3,16,0)
 #include <gdk/gdkwayland.h>
+#endif
 
 #define VERTS_ARRAY_SIZE (sizeof(GLfloat) * 4 * 4)
 #define TEX_ARRAY_SIZE (sizeof(GLfloat) * 4 * 2)
diff --git a/src/spice-widget.c b/src/spice-widget.c
index 891f2c8..f86054f 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -539,6 +539,7 @@ static void grab_notify(SpiceDisplay *display, gboolean was_grabbed)
         release_keys(display);
 }
 
+#if GTK_CHECK_VERSION(3,16,0)
 static gboolean
 gl_area_render(GtkGLArea *area, GdkGLContext *context, gpointer user_data)
 {
@@ -570,6 +571,7 @@ gl_area_realize(GtkGLArea *area, gpointer user_data)
         g_clear_error(&err);
     }
 }
+#endif
 
 static void
 drawing_area_realize(GtkWidget *area, gpointer user_data)
@@ -611,6 +613,7 @@ static void spice_display_init(SpiceDisplay *display)
     gtk_widget_set_double_buffered(area, true);
     gtk_stack_set_visible_child(GTK_STACK(widget), area);
 
+#if GTK_CHECK_VERSION(3,16,0)
     area = gtk_gl_area_new();
     gtk_gl_area_set_required_version(GTK_GL_AREA(area), 3, 2);
     gtk_gl_area_set_auto_render(GTK_GL_AREA(area), false);
@@ -620,6 +623,7 @@ static void spice_display_init(SpiceDisplay *display)
                      NULL);
     gtk_stack_add_named(GTK_STACK(widget), area, "gl-area");
     gtk_widget_show_all(widget);
+#endif
 
     g_signal_connect(display, "grab-broken-event", G_CALLBACK(grab_broken), NULL);
     g_signal_connect(display, "grab-notify", G_CALLBACK(grab_notify), NULL);
@@ -2494,15 +2498,19 @@ static void gl_draw(SpiceDisplay *display,
                     guint32 x, guint32 y, guint32 w, guint32 h)
 {
     SpiceDisplayPrivate *d = display->priv;
-    GtkWidget *gl = gtk_stack_get_child_by_name(GTK_STACK(display), "gl-area");
 
     SPICE_DEBUG("%s",  __FUNCTION__);
     set_egl_enabled(display, true);
 
+#if GTK_CHECK_VERSION(3,16,0)
+    GtkWidget *gl = gtk_stack_get_child_by_name(GTK_STACK(display), "gl-area");
+
     if (gtk_stack_get_visible_child(GTK_STACK(display)) == gl) {
         gtk_gl_area_queue_render(GTK_GL_AREA(gl));
         d->egl.call_draw_done = TRUE;
-    } else {
+    } else
+#endif
+    {
         spice_egl_update_display(display);
         spice_display_gl_draw_done(SPICE_DISPLAY_CHANNEL(d->display));
     }
-- 
2.5.0



More information about the Spice-devel mailing list