[Spice-commits] 11 commits - gtk/channel-inputs.c gtk/controller gtk/spice-session.c gtk/spice-widget.c gtk/spice-widget-cairo.c gtk/spice-widget-priv.h vapi/Makefile.am

Marc-André Lureau elmarco at kemper.freedesktop.org
Fri Dec 9 05:01:55 PST 2011


 gtk/channel-inputs.c           |    3 
 gtk/controller/controller.vala |   15 ++-
 gtk/spice-session.c            |    2 
 gtk/spice-widget-cairo.c       |   24 +++--
 gtk/spice-widget-priv.h        |    3 
 gtk/spice-widget.c             |  175 ++++++++++++++++++++++++++---------------
 vapi/Makefile.am               |    2 
 7 files changed, 144 insertions(+), 80 deletions(-)

New commits:
commit 923c586bfd2948e869d6a1609d3b28c41a33f366
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Fri Dec 9 13:56:56 2011 +0100

    Document the pointer ungrab for drag-n-drop in multihead

diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index 7a7da90..d6a8602 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -1149,8 +1149,16 @@ static gboolean button_event(GtkWidget *widget, GdkEventButton *button)
         }
     } else
         /* allow to drag and drop between windows/displays:
+
+           By default, X (and other window system) do a pointer grab
+           when you press a button, so that the release event is
+           received by the same window regardless of where the pointer
+           is. Here, we change that behaviour, so that you can press
+           and release in two differents displays. This is only
+           supported in client mouse mode.
+
            FIXME: should be multiple widget grab, but how?
-           or should now the position of the other widgets?..
+           or should know the position of the other widgets?
         */
         gdk_pointer_ungrab(GDK_CURRENT_TIME);
 
commit e0ebf260e0815897d02b95ed6f954c4c6c7bd9b7
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Thu Dec 8 15:05:11 2011 +0100

    Draw mouse with cairo in server mode

diff --git a/gtk/spice-widget-cairo.c b/gtk/spice-widget-cairo.c
index f78b670..3fc2a22 100644
--- a/gtk/spice-widget-cairo.c
+++ b/gtk/spice-widget-cairo.c
@@ -95,15 +95,23 @@ void spicex_draw_event(SpiceDisplay *display, cairo_t *cr)
     if (d->ximage) {
         if (d->allow_scaling) {
             double sx, sy;
-            /* Scale to fill window */
-            sx = (double)ww / (double)fbw;
-            sy = (double)wh / (double)fbh;
+            spice_display_get_scaling(display, &sx, &sy);
             cairo_scale(cr, sx, sy);
             cairo_set_source_surface(cr, d->ximage, 0, 0);
         } else {
             cairo_set_source_surface(cr, d->ximage, d->mx, d->my);
         }
         cairo_paint(cr);
+
+        if (d->mouse_mode == SPICE_MOUSE_MODE_SERVER) {
+            GdkPixbuf *image = d->mouse_pixbuf;
+            if (image != NULL) {
+                gdk_cairo_set_source_pixbuf(cr, image,
+                                            d->mx + d->mouse_guest_x - d->mouse_hotspot.x,
+                                            d->my + d->mouse_guest_y - d->mouse_hotspot.y);
+                cairo_paint(cr);
+            }
+        }
     }
 }
 
diff --git a/gtk/spice-widget-priv.h b/gtk/spice-widget-priv.h
index bd5eec6..e0c6c4c 100644
--- a/gtk/spice-widget-priv.h
+++ b/gtk/spice-widget-priv.h
@@ -87,6 +87,8 @@ struct _SpiceDisplayPrivate {
     int                     mouse_grab_active;
     bool                    mouse_have_pointer;
     GdkCursor               *mouse_cursor;
+    GdkPixbuf               *mouse_pixbuf;
+    GdkPoint                mouse_hotspot;
     GdkCursor               *show_cursor;
     int                     mouse_last_x;
     int                     mouse_last_y;
@@ -116,6 +118,7 @@ void     spicex_draw_event                   (SpiceDisplay *display, cairo_t *cr
 void     spicex_expose_event                 (SpiceDisplay *display, GdkEventExpose *ev);
 #endif
 gboolean spicex_is_scaled                    (SpiceDisplay *display);
+void     spice_display_get_scaling           (SpiceDisplay *display, double *sx, double *sy);
 
 G_END_DECLS
 
diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index 63e8c02..7a7da90 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -116,6 +116,7 @@ static void disconnect_display(SpiceDisplay *display);
 static void channel_new(SpiceSession *s, SpiceChannel *channel, gpointer data);
 static void channel_destroy(SpiceSession *s, SpiceChannel *channel, gpointer data);
 static void sync_keyboard_lock_modifiers(SpiceDisplay *display);
+static void cursor_invalidate(SpiceDisplay *display);
 
 /* ---------------------------------------------------------------- */
 
@@ -507,6 +508,7 @@ static GdkGrabStatus do_pointer_grab(SpiceDisplay *display)
     SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
     GdkWindow *window = GDK_WINDOW(gtk_widget_get_window(GTK_WIDGET(display)));
     GdkGrabStatus status;
+    GdkCursor *blank = get_blank_cursor();
 
     if (!gtk_widget_get_realized(GTK_WIDGET(display)))
         return GDK_GRAB_BROKEN;
@@ -527,7 +529,8 @@ static GdkGrabStatus do_pointer_grab(SpiceDisplay *display)
                      GDK_BUTTON_RELEASE_MASK |
                      GDK_BUTTON_MOTION_MASK |
                      GDK_SCROLL_MASK,
-                     NULL, d->mouse_cursor,
+                     NULL,
+                     blank,
                      GDK_CURRENT_TIME);
     if (status != GDK_GRAB_SUCCESS) {
         d->mouse_grab_active = false;
@@ -539,6 +542,7 @@ static GdkGrabStatus do_pointer_grab(SpiceDisplay *display)
 
     gtk_grab_add(GTK_WIDGET(display));
 
+    g_object_unref(blank);
     return status;
 }
 
@@ -558,8 +562,6 @@ static void update_mouse_pointer(SpiceDisplay *display)
         if (!d->mouse_grab_active) {
             gdk_window_set_cursor(window, NULL);
         } else {
-            // FIXME: should it be transparent instead?
-            gdk_window_set_cursor(window, d->mouse_cursor);
             try_mouse_grab(display);
         }
         break;
@@ -600,24 +602,22 @@ static void mouse_check_edges(GtkWidget *widget, GdkEventMotion *motion)
     int x = (int)motion->x_root;
     int y = (int)motion->y_root;
 
-    if (d->mouse_guest_x != -1 && d->mouse_guest_y != -1) {
-        SPICE_DEBUG("skip mouse_check_edges");
-        return;
-    }
-
     /* from gtk-vnc:
      * In relative mode check to see if client pointer hit one of the
-     * screen edges, and if so move it back by 200 pixels. This is
+     * screen edges, and if so move it back by 100 pixels. This is
      * important because the pointer in the server doesn't correspond
      * 1-for-1, and so may still be only half way across the
      * screen. Without this warp, the server pointer would thus appear
      * to hit an invisible wall */
-    if (motion->x <= 0) x += 200;
-    if (motion->y <= 0) y += 200;
-    if (motion->x >= (gdk_screen_get_width(screen) - 1)) x -= 200;
-    if (motion->y >= (gdk_screen_get_height(screen) - 1)) y -= 200;
+    if (x <= 0) x += 100;
+    if (y <= 0) y += 100;
+    if (x >= (gdk_screen_get_width(screen) - 1)) x -= 100;
+    if (y >= (gdk_screen_get_height(screen) - 1)) y -= 100;
 
     if (x != (int)motion->x_root || y != (int)motion->y_root) {
+        /* FIXME: we try our best to ignore that next pointer move event.. */
+        gdk_display_sync(gdk_screen_get_display(screen));
+
         gdk_display_warp_pointer(gtk_widget_get_display(widget),
                                  screen, x, y);
         d->mouse_last_x = -1;
@@ -1129,7 +1129,8 @@ static gboolean button_event(GtkWidget *widget, GdkEventButton *button)
     if (d->disable_inputs)
         return true;
 
-    if (!spicex_is_scaled(display)) {
+    if (!spicex_is_scaled(display)
+        && d->mouse_mode == SPICE_MOUSE_MODE_CLIENT) {
         gint x, y;
 
         /* rule out clicks in outside region */
@@ -1471,31 +1472,34 @@ static void cursor_set(SpiceCursorChannel *channel,
     SpiceDisplay *display = data;
     SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
 
+    cursor_invalidate(display);
+
     if (d->mouse_cursor) {
         gdk_cursor_unref(d->mouse_cursor);
         d->mouse_cursor = NULL;
     }
 
-    if (rgba != NULL) {
-        GdkPixbuf *pixbuf;
-        GdkDisplay *gtkdpy;
-
-        gtkdpy = gtk_widget_get_display(GTK_WIDGET(display));
+    if (d->mouse_pixbuf) {
+        g_object_unref(d->mouse_pixbuf);
+        d->mouse_pixbuf = NULL;
+    }
 
-        pixbuf = gdk_pixbuf_new_from_data(rgba,
-                                          GDK_COLORSPACE_RGB,
-                                          TRUE, 8,
-                                          width,
-                                          height,
-                                          width * 4,
-                                          NULL, NULL);
+    if (rgba != NULL) {
+        d->mouse_pixbuf = gdk_pixbuf_new_from_data(g_memdup(rgba, width * height * 4),
+                                                   GDK_COLORSPACE_RGB,
+                                                   TRUE, 8,
+                                                   width,
+                                                   height,
+                                                   width * 4,
+                                                   (GdkPixbufDestroyNotify)g_free, NULL);
+        d->mouse_hotspot.x = hot_x;
+        d->mouse_hotspot.y = hot_y;
 
         /* gdk_cursor_new_from_pixbuf() will copy pixbuf data on
            x11/win32/macos. No worries if rgba pointer is freed
            after. */
-        d->mouse_cursor = gdk_cursor_new_from_pixbuf(gtkdpy, pixbuf,
-                                                     hot_x, hot_y);
-        g_object_unref(pixbuf);
+        d->mouse_cursor = gdk_cursor_new_from_pixbuf(gtk_widget_get_display(GTK_WIDGET(display)),
+                                                     d->mouse_pixbuf, hot_x, hot_y);
     }
 
     update_mouse_pointer(display);
@@ -1510,42 +1514,59 @@ static void cursor_hide(SpiceCursorChannel *channel, gpointer data)
         return;
 
     d->show_cursor = d->mouse_cursor;
-    d->mouse_cursor = gdk_cursor_new(GDK_BLANK_CURSOR);
+    d->mouse_cursor = get_blank_cursor();
     update_mouse_pointer(display);
 }
 
+G_GNUC_INTERNAL
+void spice_display_get_scaling(SpiceDisplay *display, double *sx, double *sy)
+{
+    SpiceDisplayPrivate *d = display->priv;
+    int fbw = d->width, fbh = d->height;
+    int ww, wh;
+
+    if (!spicex_is_scaled(display)) {
+        *sx = 1.0;
+        *sy = 1.0;
+        return;
+    }
+
+    gdk_drawable_get_size(gtk_widget_get_window(GTK_WIDGET(display)), &ww, &wh);
+
+    *sx = (double)ww / (double)fbw;
+    *sy = (double)wh / (double)fbh;
+}
+
+static void cursor_invalidate(SpiceDisplay *display)
+{
+    SpiceDisplayPrivate *d = display->priv;
+    double sx, sy;
+
+    if (d->mouse_pixbuf == NULL)
+        return;
+
+    spice_display_get_scaling(display, &sx, &sy);
+
+    gtk_widget_queue_draw_area(GTK_WIDGET(display),
+                               (d->mouse_guest_x + d->mx - d->mouse_hotspot.x) * sx,
+                               (d->mouse_guest_y + d->my - d->mouse_hotspot.y) * sy,
+                               gdk_pixbuf_get_width(d->mouse_pixbuf) * sx,
+                               gdk_pixbuf_get_height(d->mouse_pixbuf) * sy);
+}
+
 static void cursor_move(SpiceCursorChannel *channel, gint x, gint y, gpointer data)
 {
     SpiceDisplay *display = data;
-    SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
-    GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(display));
-    int wx, wy;
+    SpiceDisplayPrivate *d = display->priv;
 
-    SPICE_DEBUG("%s: +%d+%d", __FUNCTION__, x, y);
+    cursor_invalidate(display);
 
-    d->mouse_last_x = x;
-    d->mouse_last_y = y;
     d->mouse_guest_x = x;
     d->mouse_guest_y = y;
 
-    if (spicex_is_scaled(display) && gtk_widget_get_realized(GTK_WIDGET(display))) {
-        gint ww, wh;
-
-        gdk_drawable_get_size(gtk_widget_get_window(GTK_WIDGET(display)), &ww, &wh);
-        x = x * ((double)ww / (double)(d->width));
-        y = y * ((double)wh / (double)(d->height));
-    } else {
-        /* black borders offset */
-        x += d->mx;
-        y += d->my;
-    }
-
-    if (d->mouse_grab_active && gtk_widget_get_realized(GTK_WIDGET(display))) {
-        gdk_window_get_origin(GDK_WINDOW(gtk_widget_get_window(GTK_WIDGET(display))), &wx, &wy);
-        gdk_display_warp_pointer(gtk_widget_get_display(GTK_WIDGET(display)), screen, x + wx, y + wy);
-    }
+    cursor_invalidate(display);
 
-    /* FIXME: apparently we have to restore cursor when "cursor_move" ?? */
+    /* apparently we have to restore cursor when "cursor_move" */
     if (d->show_cursor != NULL) {
         gdk_cursor_unref(d->mouse_cursor);
         d->mouse_cursor = d->show_cursor;
commit 8f2890d20f83f854ab219979399e68ba0acfe030
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Thu Dec 8 15:00:53 2011 +0100

    Ignore the first mouse click when taking the grab

diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index 4f55a27..63e8c02 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -1141,12 +1141,16 @@ static gboolean button_event(GtkWidget *widget, GdkEventButton *button)
     }
 
     gtk_widget_grab_focus(widget);
-    if (d->mouse_mode == SPICE_MOUSE_MODE_SERVER)
-        try_mouse_grab(display);
-    else /* allow to drag and drop between windows/displays:
-            FIXME: should be multiple widget grab, but how?
-            or should now the position of the other widgets?..
-         */
+    if (d->mouse_mode == SPICE_MOUSE_MODE_SERVER) {
+        if (!d->mouse_grab_active) {
+            try_mouse_grab(display);
+            return true;
+        }
+    } else
+        /* allow to drag and drop between windows/displays:
+           FIXME: should be multiple widget grab, but how?
+           or should now the position of the other widgets?..
+        */
         gdk_pointer_ungrab(GDK_CURRENT_TIME);
 
     if (!d->inputs)
commit 670a4008304d7df7b4cff2194150febec4442f54
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Thu Dec 8 14:59:33 2011 +0100

    Grab on the display too
    
    Without this additional grab, the pointer grab was effective for the
    whole application

diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index 6e4597a..4f55a27 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -537,6 +537,8 @@ static GdkGrabStatus do_pointer_grab(SpiceDisplay *display)
         g_signal_emit(display, signals[SPICE_DISPLAY_MOUSE_GRAB], 0, true);
     }
 
+    gtk_grab_add(GTK_WIDGET(display));
+
     return status;
 }
 
@@ -631,7 +633,10 @@ static void try_mouse_ungrab(SpiceDisplay *display)
         return;
 
     gdk_pointer_ungrab(GDK_CURRENT_TIME);
+    gtk_grab_remove(GTK_WIDGET(display));
+
     d->mouse_grab_active = false;
+
     update_mouse_pointer(display);
     g_signal_emit(display, signals[SPICE_DISPLAY_MOUSE_GRAB], 0, false);
 }
@@ -936,8 +941,13 @@ static gboolean leave_event(GtkWidget *widget, GdkEventCrossing *crossing G_GNUC
     SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
 
     SPICE_DEBUG("%s", __FUNCTION__);
+
+    if (d->mouse_grab_active)
+        return true;
+
     d->mouse_have_pointer = false;
     try_keyboard_ungrab(display);
+
     return true;
 }
 
commit f52f62d241c0456660e6ba4e52c3ecaa903de9d6
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Thu Dec 8 14:56:13 2011 +0100

    Add a get_blank_cursor() helper

diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index f86284a..6e4597a 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -282,6 +282,14 @@ static void spice_display_finalize(GObject *obj)
     G_OBJECT_CLASS(spice_display_parent_class)->finalize(obj);
 }
 
+static GdkCursor* get_blank_cursor(void)
+{
+    if (g_getenv("SPICE_DEBUG_CURSOR"))
+        return gdk_cursor_new(GDK_DOT);
+
+    return gdk_cursor_new(GDK_BLANK_CURSOR);
+}
+
 static void spice_display_init(SpiceDisplay *display)
 {
     GtkWidget *widget = GTK_WIDGET(display);
@@ -305,10 +313,7 @@ static void spice_display_init(SpiceDisplay *display)
     d->grabseq = spice_grab_sequence_new_from_string("Control_L+Alt_L");
     d->activeseq = g_new0(gboolean, d->grabseq->nkeysyms);
 
-    if (g_getenv("SPICE_DEBUG_CURSOR"))
-        d->mouse_cursor = gdk_cursor_new(GDK_DOT);
-    else
-        d->mouse_cursor = gdk_cursor_new(GDK_BLANK_CURSOR);
+    d->mouse_cursor = get_blank_cursor();
     d->have_mitshm = true;
 }
 
commit 4ef330c422413a9e3f51f4510ff6ef3dfa4f1a5f
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Thu Dec 8 14:54:30 2011 +0100

    Use the border margin from recalc_geometry()

diff --git a/gtk/spice-widget-cairo.c b/gtk/spice-widget-cairo.c
index acb91ad..f78b670 100644
--- a/gtk/spice-widget-cairo.c
+++ b/gtk/spice-widget-cairo.c
@@ -71,16 +71,10 @@ void spicex_draw_event(SpiceDisplay *display, cairo_t *cr)
 {
     SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
     int fbw = d->width, fbh = d->height;
-    int mx = 0, my = 0;
     int ww, wh;
 
     gdk_drawable_get_size(gtk_widget_get_window(GTK_WIDGET(display)), &ww, &wh);
 
-    if (ww > fbw)
-        mx = (ww - fbw) / 2;
-    if (wh > fbh)
-        my = (wh - fbh) / 2;
-
     /* If we don't have a pixmap, or we're not scaling, then
        we need to fill with background color */
     if (!d->ximage ||
@@ -92,7 +86,7 @@ void spicex_draw_event(SpiceDisplay *display, cairo_t *cr)
            behaviour of drawing the rectangle from right to left
            to cut out the whole */
         if (d->ximage)
-            cairo_rectangle(cr, mx + fbw, my,
+            cairo_rectangle(cr, d->mx + fbw, d->my,
                             -1 * fbw, fbh);
         cairo_fill(cr);
     }
@@ -107,7 +101,7 @@ void spicex_draw_event(SpiceDisplay *display, cairo_t *cr)
             cairo_scale(cr, sx, sy);
             cairo_set_source_surface(cr, d->ximage, 0, 0);
         } else {
-            cairo_set_source_surface(cr, d->ximage, mx, my);
+            cairo_set_source_surface(cr, d->ximage, d->mx, d->my);
         }
         cairo_paint(cr);
     }
diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index 816a3e2..f86284a 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -196,6 +196,7 @@ static void spice_display_set_property(GObject      *object,
         break;
     case PROP_SCALING:
         d->allow_scaling = g_value_get_boolean(value);
+        recalc_geometry(GTK_WIDGET(display), FALSE);
         if (d->ximage &&
             gtk_widget_get_window(GTK_WIDGET(display))) { /* if not yet shown */
             int ww, wh;
commit e3e22c61c2f6f421f4c8c5926879602eccdd0130
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Thu Dec 8 14:52:31 2011 +0100

    Do not send pointer motion of 0x0

diff --git a/gtk/channel-inputs.c b/gtk/channel-inputs.c
index bacbba3..a29c707 100644
--- a/gtk/channel-inputs.c
+++ b/gtk/channel-inputs.c
@@ -326,6 +326,9 @@ void spice_inputs_motion(SpiceInputsChannel *channel, gint dx, gint dy,
     if (SPICE_CHANNEL(channel)->priv->state != SPICE_CHANNEL_STATE_READY)
         return;
 
+    if (dx == 0 && dy == 0)
+        return;
+
     c = channel->priv;
     c->bs  = button_state;
     c->dx += dx;
commit ecb5fcc9a8d69ed31bd4783c5915d0980c09de86
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Mon Dec 5 17:51:52 2011 +0100

    Warn with the connect connect socket error

diff --git a/gtk/spice-session.c b/gtk/spice-session.c
index 4405fd2..2b10635 100644
--- a/gtk/spice-session.c
+++ b/gtk/spice-session.c
@@ -1317,6 +1317,8 @@ GSocket* spice_session_channel_open_host(SpiceSession *session, gboolean use_tls
         SPICE_DEBUG("Trying one socket");
         g_clear_error(&conn_error);
         sock = channel_connect_socket(sockaddr, &conn_error);
+        if (conn_error != NULL)
+            g_warning(conn_error->message);
         g_object_unref(sockaddr);
     }
     g_object_unref(enumerator);
commit da471b813c36b0319875e8dd03cc24378a2047e0
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Mon Dec 5 14:42:44 2011 +0100

    Fix controller with newer vala

diff --git a/gtk/controller/controller.vala b/gtk/controller/controller.vala
index af0f800..e33278f 100644
--- a/gtk/controller/controller.vala
+++ b/gtk/controller/controller.vala
@@ -76,9 +76,9 @@ public class Controller: Object {
 	private int nclients;
 	List<IOStream> clients;
 
-	private bool handle_message (SpiceProtocol.Controller.Msg msg) {
-		var v = (SpiceProtocol.Controller.MsgValue*)(&msg);
-		var d = (SpiceProtocol.Controller.MsgData*)(&msg);
+	private bool handle_message (SpiceProtocol.Controller.Msg* msg) {
+		var v = (SpiceProtocol.Controller.MsgValue*)(msg);
+		var d = (SpiceProtocol.Controller.MsgData*)(msg);
 		unowned string str = (string)(&d.data);
 
 		switch (msg.id) {
@@ -209,7 +209,7 @@ public class Controller: Object {
 					break;
 			}
 
-			handle_message (*msg);
+			handle_message (msg);
 		}
 
 		if (excl)
commit ac435f6a8f6d9cb924b02e92085655ef0d3376ac
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Sat Dec 3 01:17:37 2011 +0100

    build: vapi bindings only available if HAVE_INTROSPECTION

diff --git a/vapi/Makefile.am b/vapi/Makefile.am
index b85d8ab..4b99645 100644
--- a/vapi/Makefile.am
+++ b/vapi/Makefile.am
@@ -1,6 +1,7 @@
 NULL =
 CLEANFILES =
 
+if HAVE_INTROSPECTION
 if WITH_VALA
 BUILT_VAPI =						\
 	spice-client-glib-2.0.vapi			\
@@ -34,5 +35,6 @@ spice-client-gtk-$(SPICE_GTK_API_VERSION).deps: spice-client-gtk-$(SPICE_GTK_API
 	@echo "gtk+-$(GTK_API_VERSION)" >> $@
 
 endif
+endif
 
 -include $(top_srcdir)/git.mk
commit ac3271cdb37cd824dbaff622813bd6ffedcc05b5
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Sat Dec 3 01:17:15 2011 +0100

    controller: use SPICE_XPI_NAMEDPIPE first

diff --git a/gtk/controller/controller.vala b/gtk/controller/controller.vala
index d635984..af0f800 100644
--- a/gtk/controller/controller.vala
+++ b/gtk/controller/controller.vala
@@ -223,13 +223,16 @@ public class Controller: Object {
 	{
 		if (addr == null)
 #if WIN32
-			addr = (string*)"\\\\.\\pipe\\SpiceController-%lu".printf (GetCurrentProcessId ());
+			if (Environment.get_variable ("SPICE_XPI_NAMEDPIPE") != null)
+				addr = (string*)"%s".printf (Environment.get_variable ("SPICE_XPI_NAMEDPIPE")); // FIXME vala...
+            else
+                addr = (string*)"\\\\.\\pipe\\SpiceController-%lu".printf (GetCurrentProcessId ());
 #else
 			if (Environment.get_variable ("SPICE_XPI_SOCKET") != null)
 				addr = (string*)"%s".printf (Environment.get_variable ("SPICE_XPI_SOCKET")); // FIXME vala...
 #endif
 		if (addr == null)
-			throw new SpiceCtrl.Error.VALUE ("Missing SPICE_XPI_SOCKET");
+			throw new SpiceCtrl.Error.VALUE ("Missing socket or namedpipe address");
 		FileUtils.unlink (addr);
 
 #if WIN32


More information about the Spice-commits mailing list