[Spice-devel] [PATCH spice-gtk] Fix cursor hide not hiding in some cases

Marc-André Lureau marcandre.lureau at gmail.com
Tue Apr 10 04:26:36 PDT 2012


cursor_set() didn't un-hide correctly by setting "show_cursor" to
NULL.

The code is simplified a bit in server mode case, where the new cursor
will be invalidated and shown during cursor move only, instead of
twice (checked no regression with dual-head server mode)
---
 gtk/spice-widget.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index ff361bf..30e58dc 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -1645,17 +1645,21 @@ static void cursor_set(SpiceCursorChannel *channel,
     } else
         g_warn_if_reached();
 
-    if (d->show_cursor && d->mouse_mode == SPICE_MOUSE_MODE_SERVER) {
-        /* keep hidden cursor, will be shown in cursor_move() */
+    if (d->show_cursor) {
+        /* unhide */
         gdk_cursor_unref(d->show_cursor);
-        d->show_cursor = cursor;
-    } else {
-        gdk_cursor_unref(d->mouse_cursor);
-        d->mouse_cursor = cursor;
+        d->show_cursor = NULL;
+        if (d->mouse_mode == SPICE_MOUSE_MODE_SERVER) {
+            /* keep a hidden cursor, will be shown in cursor_move() */
+            d->show_cursor = cursor;
+            return;
+        }
     }
 
-    update_mouse_pointer(display);
+    gdk_cursor_unref(d->mouse_cursor);
+    d->mouse_cursor = cursor;
 
+    update_mouse_pointer(display);
     cursor_invalidate(display);
 }
 
-- 
1.7.7.6



More information about the Spice-devel mailing list