[Spice-devel] [PATCH v2 08/10] gtk: require gtk+ 3.16

Marc-André Lureau marcandre.lureau at gmail.com
Fri Mar 11 20:50:39 UTC 2016


3.16 is the minimal version for GtkGLArea widget, used in following
patches.

Drop conditionnal epoxy, as it is now also required by gtk+.

Signed-off-by: Marc-André Lureau <marcandre.lureau at gmail.com>
---
 configure.ac            | 29 ++---------------------------
 src/Makefile.am         |  9 +--------
 src/spice-widget-priv.h |  4 ----
 src/spice-widget.c      | 28 ++++------------------------
 4 files changed, 7 insertions(+), 63 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5cba2ba..964ee63 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=2.91.3
+  3.0) GTK_REQUIRED=3.16
        ;;
   no)
        AS_IF([test x$enable_gtk_doc = xyes],
@@ -137,7 +137,7 @@ AS_IF([test "x$with_gtk" != "xno"],
       [PKG_CHECK_MODULES(GTK, gtk+-3.0 >= $GTK_REQUIRED)])
 AC_SUBST(GTK_CFLAGS)
 AC_SUBST(GTK_LIBS)
-SPICE_GTK_REQUIRES="${SPICE_GTK_REQUIRES} gtk+-3.0 >= $GTK_REQUIRED"
+SPICE_GTK_REQUIRES="${SPICE_GTK_REQUIRES} gtk+-3.0 >= $GTK_REQUIRED epoxy"
 
 PKG_CHECK_EXISTS([gtk+-quartz-$with_gtk], [have_quartz=yes], [have_quartz=no])
 AS_IF([test "x$have_quartz" = "xyes"], [AC_DEFINE([HAVE_QUARTZ], 1, [Have Quartz?])])
@@ -208,31 +208,6 @@ AS_IF([test "x$have_phodav" = "xyes"],
 
 AM_CONDITIONAL([WITH_PHODAV], [test "x$have_phodav" = "xyes"])
 
-# FIXME: remove with gtk2
-AC_ARG_ENABLE([epoxy],
-  AS_HELP_STRING([--enable-epoxy=@<:@auto/yes/no@:>@],
-  [Enable egl/epoxy support @<:@default=auto@:>@]),
-  [],
-  [enable_epoxy="auto"])
-
-if test "x$enable_epoxy" = "xno"; then
-  have_epoxy="no"
-else
-  PKG_CHECK_MODULES(EPOXY, [epoxy], [have_epoxy=yes], [have_epoxy=no])
-  AC_SUBST(EPOXY_CFLAGS)
-  AC_SUBST(EPOXY_LIBS)
-  if test "x$have_epoxy" = "xyes"; then
-    AC_CHECK_HEADER([epoxy/egl.h],,have_epoxy=no)
-  fi
-  if test "x$have_epoxy" = "xno" && test "x$enable_epoxy" = "xyes"; then
-    AC_MSG_ERROR([epoxy support explicitly requested, but required package is not available])
-  fi
-fi
-AS_IF([test "x$have_epoxy" = "xyes"],
-  AC_DEFINE(USE_EPOXY, [1], [Define if supporting epoxy]))
-
-AM_CONDITIONAL([WITH_EPOXY], [test "x$have_epoxy" = "xyes"])
-
 AC_ARG_WITH([audio],
   AS_HELP_STRING([--with-audio=@<:@gstreamer/pulse/auto/no@:>@], [For legacy compatibility only]),
   [SPICE_WARNING([--with-audio is deprecated. Use --enable-pulse and/or --enable-gstaudio instead])
diff --git a/src/Makefile.am b/src/Makefile.am
index ffc98b9..2e7aa3b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -118,7 +118,6 @@ SPICE_GTK_LIBADD_COMMON =		\
 	libspice-client-glib-2.0.la	\
 	$(GTK_LIBS)			\
 	$(CAIRO_LIBS)			\
-	$(EPOXY_LIBS)			\
 	$(LIBM)				\
 	$(NULL)
 
@@ -149,20 +148,14 @@ nodist_SPICE_GTK_SOURCES_COMMON =	\
 
 SPICE_GTK_SOURCES_COMMON +=		\
 	spice-widget-cairo.c		\
-	$(NULL)
-
-if WITH_GTK
-if WITH_EPOXY
-SPICE_GTK_SOURCES_COMMON +=		\
 	spice-widget-egl.c		\
 	$(NULL)
-endif
 
+if WITH_GTK
 libspice_client_gtk_3_0_la_DEPEDENCIES = $(GTK_SYMBOLS_FILE)
 libspice_client_gtk_3_0_la_LDFLAGS = $(SPICE_GTK_LDFLAGS_COMMON)
 libspice_client_gtk_3_0_la_LIBADD = $(SPICE_GTK_LIBADD_COMMON)
 libspice_client_gtk_3_0_la_SOURCES = $(SPICE_GTK_SOURCES_COMMON)
-libspice_client_gtk_3_0_la_CFLAGS = $(EPOXY_CFLAGS)
 nodist_libspice_client_gtk_3_0_la_SOURCES = $(nodist_SPICE_GTK_SOURCES_COMMON)
 
 libspice_client_gtkincludedir = $(includedir)/spice-client-gtk-3.0
diff --git a/src/spice-widget-priv.h b/src/spice-widget-priv.h
index d28328d..cbedfc7 100644
--- a/src/spice-widget-priv.h
+++ b/src/spice-widget-priv.h
@@ -24,9 +24,7 @@
 #include <windows.h>
 #endif
 
-#ifdef USE_EPOXY
 #include <epoxy/egl.h>
-#endif
 
 #include "spice-widget.h"
 #include "spice-common.h"
@@ -127,7 +125,6 @@ struct _SpiceDisplayPrivate {
     int                     x11_accel_denominator;
     int                     x11_threshold;
 #endif
-#ifdef USE_EPOXY
     struct {
         gboolean            enabled;
         EGLSurface          surface;
@@ -142,7 +139,6 @@ struct _SpiceDisplayPrivate {
         EGLImageKHR         image;
         SpiceGlScanout      scanout;
     } egl;
-#endif
 };
 
 int      spicex_image_create                 (SpiceDisplay *display);
diff --git a/src/spice-widget.c b/src/spice-widget.c
index 1225f5f..74060ed 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -543,7 +543,7 @@ static void spice_display_init(SpiceDisplay *display)
     GtkWidget *widget = GTK_WIDGET(display);
     SpiceDisplayPrivate *d;
     GtkTargetEntry targets = { "text/uri-list", 0, 0 };
-    G_GNUC_UNUSED GError *err = NULL;
+    GError *err = NULL;
 
     d = display->priv = SPICE_DISPLAY_GET_PRIVATE(display);
 
@@ -571,12 +571,10 @@ static void spice_display_init(SpiceDisplay *display)
 
     d->mouse_cursor = get_blank_cursor();
 
-#ifdef USE_EPOXY
     if (!spice_egl_init(display, &err)) {
         g_critical("egl init failed: %s", err->message);
         g_clear_error(&err);
     }
-#endif
 }
 
 static GObject *
@@ -1128,7 +1126,6 @@ static gboolean do_color_convert(SpiceDisplay *display, GdkRectangle *r)
 
 static void set_egl_enabled(SpiceDisplay *display, bool enabled)
 {
-#ifdef USE_EPOXY
     SpiceDisplayPrivate *d = display->priv;
 
     if (d->egl.enabled != enabled) {
@@ -1138,7 +1135,6 @@ static void set_egl_enabled(SpiceDisplay *display, bool enabled)
          * resized. */
         gtk_widget_set_double_buffered(GTK_WIDGET(display), !enabled);
     }
-#endif
 }
 
 static gboolean draw_event(GtkWidget *widget, cairo_t *cr)
@@ -1147,12 +1143,10 @@ static gboolean draw_event(GtkWidget *widget, cairo_t *cr)
     SpiceDisplayPrivate *d = display->priv;
     g_return_val_if_fail(d != NULL, false);
 
-#ifdef USE_EPOXY
     if (d->egl.enabled) {
         spice_egl_update_display(display);
         return false;
     }
-#endif
 
     if (d->mark == 0 || d->data == NULL ||
         d->area.width == 0 || d->area.height == 0)
@@ -1756,10 +1750,8 @@ static void size_allocate(GtkWidget *widget, GtkAllocation *conf, gpointer data)
         d->ww = conf->width;
         d->wh = conf->height;
         recalc_geometry(widget);
-#ifdef USE_EPOXY
         if (d->egl.enabled)
             spice_egl_resize_display(display, conf->width, conf->height);
-#endif
     }
 
     d->mx = conf->x;
@@ -1786,7 +1778,7 @@ static void realize(GtkWidget *widget)
 {
     SpiceDisplay *display = SPICE_DISPLAY(widget);
     SpiceDisplayPrivate *d = display->priv;
-    G_GNUC_UNUSED GError *err = NULL;
+    GError *err = NULL;
 
     GTK_WIDGET_CLASS(spice_display_parent_class)->realize(widget);
 
@@ -1794,21 +1786,18 @@ static void realize(GtkWidget *widget)
         vnc_display_keymap_gdk2xtkbd_table(gtk_widget_get_window(widget),
                                            &d->keycode_maplen);
 
-#ifdef USE_EPOXY
     if (!spice_egl_realize_display(display, gtk_widget_get_window(GTK_WIDGET(display)), &err)) {
         g_critical("egl realize failed: %s", err->message);
         g_clear_error(&err);
     }
-#endif
+
     update_image(display);
 }
 
 static void unrealize(GtkWidget *widget)
 {
     spicex_image_destroy(SPICE_DISPLAY(widget));
-#ifdef USE_EPOXY
     spice_egl_unrealize_display(SPICE_DISPLAY(widget));
-#endif
 
     GTK_WIDGET_CLASS(spice_display_parent_class)->unrealize(widget);
 }
@@ -2257,9 +2246,7 @@ static void cursor_set(SpiceCursorChannel *channel,
     } else
         g_warn_if_reached();
 
-#ifdef USE_EPOXY
     spice_egl_cursor_set(display);
-#endif
     if (d->show_cursor) {
         /* unhide */
         gdk_cursor_unref(d->show_cursor);
@@ -2407,7 +2394,6 @@ static void cursor_reset(SpiceCursorChannel *channel, gpointer data)
     gdk_window_set_cursor(window, NULL);
 }
 
-#ifdef USE_EPOXY
 static void gl_scanout(SpiceDisplay *display)
 {
     SpiceDisplayPrivate *d = display->priv;
@@ -2437,7 +2423,6 @@ static void gl_draw(SpiceDisplay *display,
     spice_egl_update_display(display);
     spice_display_gl_draw_done(SPICE_DISPLAY_CHANNEL(d->display));
 }
-#endif
 
 static void channel_new(SpiceSession *s, SpiceChannel *channel, gpointer data)
 {
@@ -2474,12 +2459,10 @@ static void channel_new(SpiceSession *s, SpiceChannel *channel, gpointer data)
                            primary.stride, primary.shmid, primary.data, display);
             mark(display, primary.marked);
         }
-#ifdef USE_EPOXY
         spice_g_signal_connect_object(channel, "notify::gl-scanout",
                                       G_CALLBACK(gl_scanout), display, G_CONNECT_SWAPPED);
         spice_g_signal_connect_object(channel, "gl-draw",
                                       G_CALLBACK(gl_draw), display, G_CONNECT_SWAPPED);
-#endif
 
         spice_channel_connect(channel);
         return;
@@ -2631,7 +2614,6 @@ GdkPixbuf *spice_display_get_pixbuf(SpiceDisplay *display)
     g_return_val_if_fail(d != NULL, NULL);
     g_return_val_if_fail(d->display != NULL, NULL);
 
-#ifdef USE_EPOXY
     if (d->egl.enabled) {
         GdkPixbuf *tmp;
 
@@ -2646,9 +2628,7 @@ GdkPixbuf *spice_display_get_pixbuf(SpiceDisplay *display)
                                        (GdkPixbufDestroyNotify)g_free, NULL);
         pixbuf = gdk_pixbuf_flip(tmp, false);
         g_object_unref(tmp);
-    } else
-#endif
-    {
+    } else {
         guchar *src, *dest;
         int x, y;
 
-- 
2.5.0



More information about the Spice-devel mailing list