Commit 515a84ba authored by hexchain's avatar hexchain Committed by Frediano Ziglio
Browse files

spice-widget: prevent mouse cursor from being too small



Caps the minimum scale of the mouse cursor to 50% so that it is still
visible even if the window is too small.

This also workarounds a GDK warning when SpiceDisplay is used in
remote-viewer. Upon its initialization there is a possible race
condition, where update_mouse_cursor is called but the widget still has
a size of 1x1. In such case, the calculated scale is very small and the
mouse surface width and height are both zero, causing a warning:

gdk_cursor_new_from_surface: assertion '0 <= x && x < cairo_image_surface_get_width (surface)' failed
Signed-off-by: hexchain's avatarHaochen Tong <i@hexchain.org>
Acked-by: Frediano Ziglio's avatarFrediano Ziglio <fziglio@redhat.com>
parent cbdda333
Pipeline #192046 passed with stage
in 2 minutes and 57 seconds
......@@ -3018,6 +3018,8 @@ static void update_mouse_cursor(SpiceDisplay *display)
spice_display_get_scaling(display, &scale, NULL, NULL, NULL, NULL);
scale_factor = gtk_widget_get_scale_factor(GTK_WIDGET(display));
scale = MAX(0.5, scale);
cairo_surface_destroy(d->cursor_surface);
/* scale mouse cursor surface */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment