Create the cursor when the widget is realized --- src/spice-widget.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/spice-widget.c b/src/spice-widget.c index 72fbbc8..a27f5a2 100644 --- a/src/spice-widget.c +++ b/src/spice-widget.c @@ -460,12 +460,12 @@ static void spice_display_finalize(GObject *obj) G_OBJECT_CLASS(spice_display_parent_class)->finalize(obj); } -static GdkCursor* get_blank_cursor(void) +static GdkCursor* spice_display_get_blank_cursor(SpiceDisplay *display) { - if (g_getenv("SPICE_DEBUG_CURSOR")) - return gdk_cursor_new(GDK_DOT); + GdkDisplay *gdk_display = gdk_window_get_display(GDK_WINDOW(gtk_widget_get_window(GTK_WIDGET(display)))); + GdkCursorType cursor_type = g_getenv("SPICE_DEBUG_CURSOR") ? GDK_DOT : GDK_BLANK_CURSOR; - return gdk_cursor_new(GDK_BLANK_CURSOR); + return gdk_cursor_new_for_display(gdk_display, cursor_type); } static gboolean grab_broken(SpiceDisplay *self, GdkEventGrabBroken *event, @@ -676,7 +676,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS d->grabseq = spice_grab_sequence_new_from_string("Control_L+Alt_L"); d->activeseq = g_new0(gboolean, d->grabseq->nkeysyms); - d->mouse_cursor = get_blank_cursor(); } static GObject * @@ -986,7 +985,7 @@ static gboolean do_pointer_grab(SpiceDisplay *display) SpiceDisplayPrivate *d = display->priv; GdkWindow *window = GDK_WINDOW(gtk_widget_get_window(GTK_WIDGET(display))); GdkGrabStatus status; - GdkCursor *blank = get_blank_cursor(); + GdkCursor *blank = spice_display_get_blank_cursor(display); gboolean grab_successful = FALSE; if (!gtk_widget_get_realized(GTK_WIDGET(display))) @@ -2076,6 +2075,7 @@ static void realize(GtkWidget *widget) d->keycode_map = vnc_display_keymap_gdk2xtkbd_table(gtk_widget_get_window(widget), &d->keycode_maplen); + d->mouse_cursor = spice_display_get_blank_cursor(display); update_image(display); } @@ -2596,7 +2596,7 @@ static void cursor_hide(SpiceCursorChannel *channel, gpointer data) cursor_invalidate(display); d->show_cursor = d->mouse_cursor; - d->mouse_cursor = get_blank_cursor(); + d->mouse_cursor = spice_display_get_blank_cursor(display); update_mouse_pointer(display); } -- 2.11.0 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel