[Spice-devel] [PATCH spice-gtk] widget: don't redraw server mouse until moved

Marc-André Lureau marcandre.lureau at gmail.com
Mon Nov 12 12:25:30 PST 2012


When switching between client mode and server mode, the pointer is
being invalidated on each display and the cursor will end up being
drawn on both. Since there is no information on which display the
cursor is supposed to be until a move is received, hide the cursor
until it actually moves.
---
 gtk/spice-widget-cairo.c | 1 +
 gtk/spice-widget.c       | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/gtk/spice-widget-cairo.c b/gtk/spice-widget-cairo.c
index 9ddbe51..bd8e351 100644
--- a/gtk/spice-widget-cairo.c
+++ b/gtk/spice-widget-cairo.c
@@ -135,6 +135,7 @@ void spicex_draw_event(SpiceDisplay *display, cairo_t *cr)
         cairo_fill(cr);
 
         if (d->mouse_mode == SPICE_MOUSE_MODE_SERVER &&
+            d->mouse_guest_x != -1 && d->mouse_guest_y != -1 &&
             !d->show_cursor) {
             GdkPixbuf *image = d->mouse_pixbuf;
             if (image != NULL) {
diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index cdcff03..588d028 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -1849,13 +1849,14 @@ static void update_mouse_mode(SpiceChannel *channel, gpointer data)
         break;
     case SPICE_MOUSE_MODE_SERVER:
         try_mouse_grab(display);
+        d->mouse_guest_x = -1;
+        d->mouse_guest_y = -1;
         break;
     default:
         g_warn_if_reached();
     }
 
     update_mouse_pointer(display);
-    cursor_invalidate(display);
 }
 
 static void update_area(SpiceDisplay *display,
-- 
1.7.11.7



More information about the Spice-devel mailing list