[Spice-devel] [PATCH spice-gtk] gtk: add spice-widget GL scanout support

Marc-André Lureau mlureau at redhat.com
Tue Feb 16 12:19:13 UTC 2016


Hi

----- Original Message -----
> Hi,
> 
> with gtk2:
> spice-widget-egl.c: In function ‘spice_egl_init’:
> spice-widget-egl.c:203:9: error: implicit declaration of function
> ‘GDK_IS_X11_DISPLAY’ [-Werror=implicit-function-declaration]
>      if (GDK_IS_X11_DISPLAY(gdk_dpy)) {
>          ^
> spice-widget-egl.c:203:5: error: nested extern declaration of
> ‘GDK_IS_X11_DISPLAY’ [-Werror=nested-externs]
>      if (GDK_IS_X11_DISPLAY(gdk_dpy)) {
>      ^
> spice-widget-egl.c: In function ‘spice_widget_init_egl_win’:
> spice-widget-egl.c:272:9: error: implicit declaration of function
> ‘GDK_IS_X11_WINDOW’ [-Werror=implicit-function-declaration]
>      if (GDK_IS_X11_WINDOW(win)) {
>          ^
> spice-widget-egl.c:272:5: error: nested extern declaration of
> ‘GDK_IS_X11_WINDOW’ [-Werror=nested-externs]
>      if (GDK_IS_X11_WINDOW(win)) {
>      ^
> spice-widget-egl.c:273:39: error: implicit declaration of function
> ‘gdk_x11_window_get_xid’ [-Werror=implicit-function-declaration]
>          native = (EGLNativeWindowType)gdk_x11_window_get_xid(win);
>                                        ^
> spice-widget-egl.c:273:9: error: nested extern declaration of
> ‘gdk_x11_window_get_xid’ [-Werror=nested-externs]
>          native = (EGLNativeWindowType)gdk_x11_window_get_xid(win);
> 

That fixes it:

diff --git a/src/gtk-compat.h b/src/gtk-compat.h
index be143b2..aac3b55 100644
--- a/src/gtk-compat.h
+++ b/src/gtk-compat.h
@@ -25,6 +25,7 @@
 #if !GTK_CHECK_VERSION (2, 91, 0)
 #define GDK_IS_X11_DISPLAY(D) TRUE
 #define gdk_window_get_display(W) gdk_drawable_get_display(GDK_DRAWABLE(W))
+#define GDK_IS_X11_WINDOW(D) TRUE
 #endif
 
 #if GTK_CHECK_VERSION (2, 91, 0)
diff --git a/src/spice-widget-egl.c b/src/spice-widget-egl.c
index d0f9381..4fa2818 100644
--- a/src/spice-widget-egl.c
+++ b/src/spice-widget-egl.c
@@ -22,6 +22,7 @@
 #define EGL_EGLEXT_PROTOTYPES
 #define GL_GLEXT_PROTOTYPES
 
+#include "gtk-compat.h"
 #include "spice-widget.h"
 #include "spice-widget-priv.h"
 #include "spice-gtk-session-priv.h"
@@ -270,7 +271,7 @@ static gboolean spice_widget_init_egl_win(SpiceDisplay *display, GdkWindow *win,
 
 #ifdef GDK_WINDOWING_X11
     if (GDK_IS_X11_WINDOW(win)) {
-        native = (EGLNativeWindowType)gdk_x11_window_get_xid(win);
+        native = (EGLNativeWindowType)GDK_WINDOW_XID(win);
     }
 #endif

> besides that I have done some tests and haven't noticed any issues.

cool

> For the future (when all bits are in) would be nice to have some instruction
> how to make it run in the SPICE manual.

Good idea. I have been more focused in getting things working with virt-install/virt-manager/boxes (I have patches ready, once qemu bits land)

> Pavel
> 
> Also copyright should be till 2016?

ok


More information about the Spice-devel mailing list