[Spice-devel] [PATCH spice-gtk 3/7] widget: check backend is X11

Marc-André Lureau marcandre.lureau at gmail.com
Fri May 10 13:46:04 PDT 2013


spice-gtk blindly assume the backend is X11 if it's compiled on
Unix. But nowadays, gtk+ support runtime backend selection.

https://bugzilla.redhat.com/show_bug.cgi?id=961577
---
 gtk/spice-widget.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index 93c1e60..0b1fe31 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -784,8 +784,13 @@ static void set_mouse_accel(SpiceDisplay *display, gboolean enabled)
 
 #if defined GDK_WINDOWING_X11
     GdkWindow *w = GDK_WINDOW(gtk_widget_get_window(GTK_WIDGET(display)));
-    Display *x_display = GDK_WINDOW_XDISPLAY(w);
 
+    if (!GDK_IS_X11_DISPLAY(gdk_window_get_display(w))) {
+        SPICE_DEBUG("FIXME: gtk backend is not X11");
+        return;
+    }
+
+    Display *x_display = GDK_WINDOW_XDISPLAY(w);
     if (enabled) {
         /* restore mouse acceleration */
         XChangePointerControl(x_display, True, True,
@@ -2600,6 +2605,11 @@ static void sync_keyboard_lock_modifiers(SpiceDisplay *display)
     if (w == NULL) /* it can happen if the display is not yet shown */
         return;
 
+    if (!GDK_IS_X11_DISPLAY(gdk_window_get_display(w))) {
+        SPICE_DEBUG("FIXME: gtk backend is not X11");
+        return;
+    }
+
     x_display = GDK_WINDOW_XDISPLAY(w);
     modifiers = get_keyboard_lock_modifiers(x_display);
     if (d->inputs)
-- 
1.8.2.1.342.gfa7285d



More information about the Spice-devel mailing list