[Spice-commits] 3 commits - configure.ac src/Makefile.am src/spice-widget.c src/spice-widget-egl.c src/spice-widget-priv.h
Marc-André Lureau
elmarco at kemper.freedesktop.org
Mon Mar 14 12:49:28 UTC 2016
configure.ac | 29 ---------
src/Makefile.am | 9 --
src/spice-widget-egl.c | 9 ++
src/spice-widget-priv.h | 9 --
src/spice-widget.c | 154 +++++++++++++++++++++++++++++++++---------------
5 files changed, 124 insertions(+), 86 deletions(-)
New commits:
commit 6d8ca210d89e4dc7bed90534e91e1c3650e00d2a
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date: Mon Jan 11 11:57:41 2016 +0100
gtk: add GtkGLArea
GtkGLArea is the proper modern way to have opengl in an gtk+
application. Unfortunately, it may use various backends and interfaces
to initialize it, but dmabuf image sharing requires egl atm.
This patch keeps using our egl setup on X11, while it uses gtkglarea on
known gdk backend based on egl, such as the wayland one. This brings
wayland support for local gl to spice-gtk.
Signed-off-by: Marc-André Lureau <marcandre.lureau at gmail.com>
Acked-by: Fabiano Fidêncio <fidencio at redhat.com>
diff --git a/src/spice-widget-egl.c b/src/spice-widget-egl.c
index 1748189..1b3cd07 100644
--- a/src/spice-widget-egl.c
+++ b/src/spice-widget-egl.c
@@ -29,6 +29,7 @@
#include <libdrm/drm_fourcc.h>
#include <gdk/gdkx.h>
+#include <gdk/gdkwayland.h>
#define VERTS_ARRAY_SIZE (sizeof(GLfloat) * 4 * 4)
#define TEX_ARRAY_SIZE (sizeof(GLfloat) * 4 * 2)
@@ -200,6 +201,14 @@ gboolean spice_egl_init(SpiceDisplay *display, GError **err)
EGLNativeDisplayType dpy = 0;
GdkDisplay *gdk_dpy = gdk_display_get_default();
+#ifdef GDK_WINDOWING_WAYLAND
+ if (GDK_IS_WAYLAND_DISPLAY(gdk_dpy)) {
+ d->egl.ctx = eglGetCurrentContext();
+ dpy = (EGLNativeDisplayType)gdk_wayland_display_get_wl_display(gdk_dpy);
+ d->egl.display = eglGetDisplay(dpy);
+ return spice_egl_init_shaders(display, err);
+ }
+#endif
#ifdef GDK_WINDOWING_X11
if (GDK_IS_X11_DISPLAY(gdk_dpy)) {
dpy = (EGLNativeDisplayType)gdk_x11_display_get_xdisplay(gdk_dpy);
diff --git a/src/spice-widget-priv.h b/src/spice-widget-priv.h
index cf055d3..0d1c3ae 100644
--- a/src/spice-widget-priv.h
+++ b/src/spice-widget-priv.h
@@ -137,6 +137,7 @@ struct _SpiceDisplayPrivate {
guint tex_pointer_id;
guint prog;
EGLImageKHR image;
+ gboolean call_draw_done;
SpiceGlScanout scanout;
} egl;
};
diff --git a/src/spice-widget.c b/src/spice-widget.c
index 286eeca..891f2c8 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -539,12 +539,48 @@ static void grab_notify(SpiceDisplay *display, gboolean was_grabbed)
release_keys(display);
}
+static gboolean
+gl_area_render(GtkGLArea *area, GdkGLContext *context, gpointer user_data)
+{
+ SpiceDisplay *display = SPICE_DISPLAY(user_data);
+ SpiceDisplayPrivate *d = display->priv;
+
+ spice_egl_update_display(display);
+ glFlush();
+ if (d->egl.call_draw_done) {
+ spice_display_gl_draw_done(SPICE_DISPLAY_CHANNEL(d->display));
+ d->egl.call_draw_done = FALSE;
+ }
+
+ return TRUE;
+}
+
+static void
+gl_area_realize(GtkGLArea *area, gpointer user_data)
+{
+ SpiceDisplay *display = SPICE_DISPLAY(user_data);
+ GError *err = NULL;
+
+ gtk_gl_area_make_current(area);
+ if (gtk_gl_area_get_error(area) != NULL)
+ return;
+
+ if (!spice_egl_init(display, &err)) {
+ g_critical("egl init failed: %s", err->message);
+ g_clear_error(&err);
+ }
+}
+
static void
drawing_area_realize(GtkWidget *area, gpointer user_data)
{
+#ifdef GDK_WINDOWING_X11
SpiceDisplay *display = SPICE_DISPLAY(user_data);
GError *err = NULL;
+ if (!GDK_IS_X11_DISPLAY(gdk_display_get_default()))
+ return;
+
if (!spice_egl_init(display, &err)) {
g_critical("egl init failed: %s", err->message);
g_clear_error(&err);
@@ -554,6 +590,7 @@ drawing_area_realize(GtkWidget *area, gpointer user_data)
g_critical("egl realize failed: %s", err->message);
g_clear_error(&err);
}
+#endif
}
static void spice_display_init(SpiceDisplay *display)
@@ -574,6 +611,16 @@ static void spice_display_init(SpiceDisplay *display)
gtk_widget_set_double_buffered(area, true);
gtk_stack_set_visible_child(GTK_STACK(widget), area);
+ 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);
+ g_object_connect(area,
+ "signal::render", gl_area_render, display,
+ "signal::realize", gl_area_realize, display,
+ NULL);
+ gtk_stack_add_named(GTK_STACK(widget), area, "gl-area");
+ gtk_widget_show_all(widget);
+
g_signal_connect(display, "grab-broken-event", G_CALLBACK(grab_broken), NULL);
g_signal_connect(display, "grab-notify", G_CALLBACK(grab_notify), NULL);
@@ -1152,11 +1199,20 @@ static void set_egl_enabled(SpiceDisplay *display, bool enabled)
if (d->egl.enabled == enabled)
return;
- /* even though the function is marked as deprecated, it's the
- * only way I found to prevent glitches when the window is
- * resized. */
- area = gtk_stack_get_child_by_name(GTK_STACK(display), "draw-area");
- gtk_widget_set_double_buffered(GTK_WIDGET(area), !enabled);
+#ifdef GDK_WINDOWING_X11
+ if (GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
+ /* even though the function is marked as deprecated, it's the
+ * only way I found to prevent glitches when the window is
+ * resized. */
+ area = gtk_stack_get_child_by_name(GTK_STACK(display), "draw-area");
+ gtk_widget_set_double_buffered(GTK_WIDGET(area), !enabled);
+ } else
+#endif
+ {
+ area = gtk_stack_get_child_by_name(GTK_STACK(display), "gl-area");
+ gtk_stack_set_visible_child_name(GTK_STACK(display),
+ enabled ? "gl-area" : "draw-area");
+ }
if (enabled) {
spice_egl_resize_display(display, d->ww, d->wh);
@@ -1171,7 +1227,8 @@ static gboolean draw_event(GtkWidget *widget, cairo_t *cr, gpointer data)
SpiceDisplayPrivate *d = display->priv;
g_return_val_if_fail(d != NULL, false);
- if (d->egl.enabled) {
+ if (d->egl.enabled &&
+ g_str_equal(gtk_stack_get_visible_child_name(GTK_STACK(display)), "draw-area")) {
spice_egl_update_display(display);
return false;
}
@@ -2437,12 +2494,18 @@ 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);
- spice_egl_update_display(display);
- spice_display_gl_draw_done(SPICE_DISPLAY_CHANNEL(d->display));
+ 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 {
+ spice_egl_update_display(display);
+ spice_display_gl_draw_done(SPICE_DISPLAY_CHANNEL(d->display));
+ }
}
static void channel_new(SpiceSession *s, SpiceChannel *channel, gpointer data)
commit 2cb74f4ac1fc5c3601cbc780f7eefa6e867ba4d2
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date: Mon Jan 11 11:52:23 2016 +0100
gtk: use GtkStack
Move the GtkDrawingArea in a GtkStack, so other widgets can be switched
to for the display: the next patch adds a GtkGLArea for an opengl
rendering. One can imagine other display widgets to show text etc..
Signed-off-by: Marc-André Lureau <marcandre.lureau at gmail.com>
Acked-by: Fabiano Fidêncio <fidencio at redhat.com>
diff --git a/src/spice-widget-priv.h b/src/spice-widget-priv.h
index cbedfc7..cf055d3 100644
--- a/src/spice-widget-priv.h
+++ b/src/spice-widget-priv.h
@@ -35,12 +35,12 @@ G_BEGIN_DECLS
typedef struct _SpiceDisplayPrivate SpiceDisplayPrivate;
struct _SpiceDisplay {
- GtkDrawingArea parent;
+ GtkStack parent;
SpiceDisplayPrivate *priv;
};
struct _SpiceDisplayClass {
- GtkDrawingAreaClass parent_class;
+ GtkStackClass parent_class;
/* signals */
void (*mouse_grab)(SpiceChannel *channel, gint grabbed);
diff --git a/src/spice-widget.c b/src/spice-widget.c
index 74060ed..286eeca 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -71,7 +71,7 @@
* save to disk).
*/
-G_DEFINE_TYPE(SpiceDisplay, spice_display, GTK_TYPE_DRAWING_AREA)
+G_DEFINE_TYPE(SpiceDisplay, spice_display, GTK_TYPE_STACK)
/* Properties */
enum {
@@ -117,6 +117,7 @@ static void cursor_invalidate(SpiceDisplay *display);
static void update_area(SpiceDisplay *display, gint x, gint y, gint width, gint height);
static void release_keys(SpiceDisplay *display);
static void size_allocate(GtkWidget *widget, GtkAllocation *conf, gpointer data);
+static gboolean draw_event(GtkWidget *widget, cairo_t *cr, gpointer data);
/* ---------------------------------------------------------------- */
@@ -538,15 +539,41 @@ static void grab_notify(SpiceDisplay *display, gboolean was_grabbed)
release_keys(display);
}
+static void
+drawing_area_realize(GtkWidget *area, gpointer user_data)
+{
+ SpiceDisplay *display = SPICE_DISPLAY(user_data);
+ GError *err = NULL;
+
+ if (!spice_egl_init(display, &err)) {
+ g_critical("egl init failed: %s", err->message);
+ g_clear_error(&err);
+ }
+
+ if (!spice_egl_realize_display(display, gtk_widget_get_window(area), &err)) {
+ g_critical("egl realize failed: %s", err->message);
+ g_clear_error(&err);
+ }
+}
+
static void spice_display_init(SpiceDisplay *display)
{
GtkWidget *widget = GTK_WIDGET(display);
+ GtkWidget *area;
SpiceDisplayPrivate *d;
GtkTargetEntry targets = { "text/uri-list", 0, 0 };
- GError *err = NULL;
d = display->priv = SPICE_DISPLAY_GET_PRIVATE(display);
+ area = gtk_drawing_area_new();
+ g_object_connect(area,
+ "signal::draw", draw_event, display,
+ "signal::realize", drawing_area_realize, display,
+ NULL);
+ gtk_stack_add_named(GTK_STACK(widget), area, "draw-area");
+ gtk_widget_set_double_buffered(area, true);
+ gtk_stack_set_visible_child(GTK_STACK(widget), area);
+
g_signal_connect(display, "grab-broken-event", G_CALLBACK(grab_broken), NULL);
g_signal_connect(display, "grab-notify", G_CALLBACK(grab_notify), NULL);
@@ -564,17 +591,10 @@ static void spice_display_init(SpiceDisplay *display)
GDK_LEAVE_NOTIFY_MASK |
GDK_KEY_PRESS_MASK |
GDK_SCROLL_MASK);
- gtk_widget_set_double_buffered(widget, true);
gtk_widget_set_can_focus(widget, true);
d->grabseq = spice_grab_sequence_new_from_string("Control_L+Alt_L");
d->activeseq = g_new0(gboolean, d->grabseq->nkeysyms);
-
d->mouse_cursor = get_blank_cursor();
-
- if (!spice_egl_init(display, &err)) {
- g_critical("egl init failed: %s", err->message);
- g_clear_error(&err);
- }
}
static GObject *
@@ -1127,19 +1147,27 @@ static gboolean do_color_convert(SpiceDisplay *display, GdkRectangle *r)
static void set_egl_enabled(SpiceDisplay *display, bool enabled)
{
SpiceDisplayPrivate *d = display->priv;
+ GtkWidget *area;
- if (d->egl.enabled != enabled) {
- d->egl.enabled = enabled;
- /* even though the function is marked as deprecated, it's the
- * only way I found to prevent glitches when the window is
- * resized. */
- gtk_widget_set_double_buffered(GTK_WIDGET(display), !enabled);
+ if (d->egl.enabled == enabled)
+ return;
+
+ /* even though the function is marked as deprecated, it's the
+ * only way I found to prevent glitches when the window is
+ * resized. */
+ area = gtk_stack_get_child_by_name(GTK_STACK(display), "draw-area");
+ gtk_widget_set_double_buffered(GTK_WIDGET(area), !enabled);
+
+ if (enabled) {
+ spice_egl_resize_display(display, d->ww, d->wh);
}
+
+ d->egl.enabled = enabled;
}
-static gboolean draw_event(GtkWidget *widget, cairo_t *cr)
+static gboolean draw_event(GtkWidget *widget, cairo_t *cr, gpointer data)
{
- SpiceDisplay *display = SPICE_DISPLAY(widget);
+ SpiceDisplay *display = SPICE_DISPLAY(data);
SpiceDisplayPrivate *d = display->priv;
g_return_val_if_fail(d != NULL, false);
@@ -1778,7 +1806,6 @@ static void realize(GtkWidget *widget)
{
SpiceDisplay *display = SPICE_DISPLAY(widget);
SpiceDisplayPrivate *d = display->priv;
- GError *err = NULL;
GTK_WIDGET_CLASS(spice_display_parent_class)->realize(widget);
@@ -1786,11 +1813,6 @@ static void realize(GtkWidget *widget)
vnc_display_keymap_gdk2xtkbd_table(gtk_widget_get_window(widget),
&d->keycode_maplen);
- 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);
- }
-
update_image(display);
}
@@ -1810,7 +1832,6 @@ static void spice_display_class_init(SpiceDisplayClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
GtkWidgetClass *gtkwidget_class = GTK_WIDGET_CLASS(klass);
- gtkwidget_class->draw = draw_event;
gtkwidget_class->key_press_event = key_event;
gtkwidget_class->key_release_event = key_event;
gtkwidget_class->enter_notify_event = enter_event;
commit c73950df1f7d0c67f85f54444c28d851a757104a
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date: Wed Dec 23 14:36:17 2015 +0100
gtk: require gtk+ 3.16
3.16 is the minimal version for GtkGLArea widget, used in following
patches.
Drop conditional epoxy support, as it is now required by gtk+.
Signed-off-by: Marc-André Lureau <marcandre.lureau at gmail.com>
Acked-by: Fabiano Fidêncio <fidencio at redhat.com>
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;
More information about the Spice-commits
mailing list