summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2011-03-31 20:15:54 +0200
committerMarc-André Lureau <marcandre.lureau@redhat.com>2011-03-31 20:15:54 +0200
commit818f3fded3d2dcbd61e111611a9ac5f213a89680 (patch)
tree52e426381b95c9ce6a314f03d3654735d90d6901 /gtk
parentcf7b7bfdf572fc08f5e03e268e6f928980b15739 (diff)
gtk: show cursor when cursor-move
Diffstat (limited to 'gtk')
-rw-r--r--gtk/spice-widget-priv.h1
-rw-r--r--gtk/spice-widget.c14
2 files changed, 13 insertions, 2 deletions
diff --git a/gtk/spice-widget-priv.h b/gtk/spice-widget-priv.h
index 24b42a5..92cb347 100644
--- a/gtk/spice-widget-priv.h
+++ b/gtk/spice-widget-priv.h
@@ -91,6 +91,7 @@ struct spice_display {
int mouse_grab_active;
bool mouse_have_pointer;
GdkCursor *mouse_cursor;
+ GdkCursor *show_cursor;
int mouse_last_x;
int mouse_last_y;
int mouse_guest_x;
diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index 97b4f7a..dc652d9 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -1385,8 +1385,10 @@ static void cursor_hide(SpiceCursorChannel *channel, gpointer data)
SpiceDisplay *display = data;
spice_display *d = SPICE_DISPLAY_GET_PRIVATE(display);
- if (d->mouse_cursor)
- gdk_cursor_unref(d->mouse_cursor);
+ if (d->show_cursor != NULL) /* then we are already hidden */
+ return;
+
+ d->show_cursor = d->mouse_cursor;
d->mouse_cursor = gdk_cursor_new(GDK_BLANK_CURSOR);
update_mouse_pointer(display);
}
@@ -1421,6 +1423,14 @@ static void cursor_move(SpiceCursorChannel *channel, gint x, gint y, gpointer da
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);
}
+
+ /* FIXME: 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;
+ d->show_cursor = NULL;
+ update_mouse_pointer(display);
+ }
}
static void cursor_reset(SpiceCursorChannel *channel, gpointer data)