From c388a8fc9d0a87cf4bb2a55619435743a71f4994 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Fri, 20 Oct 2017 05:00:06 -0500 Subject: [PATCH] display: Ceil pointer cursor theme scale when fractional The fraction of the scale was accidentally casted away, lets ceil it instead. https://bugzilla.gnome.org/show_bug.cgi?id=765011 --- src/core/display.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/core/display.c b/src/core/display.c index 1c80b3939..1531fc945 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -1436,7 +1436,7 @@ meta_cursor_for_grab_op (MetaGrabOp op) return META_CURSOR_DEFAULT; } -static int +static float find_highest_logical_monitor_scale (MetaBackend *backend, MetaCursorSprite *cursor_sprite) { @@ -1447,7 +1447,7 @@ find_highest_logical_monitor_scale (MetaBackend *backend, ClutterRect cursor_rect; GList *logical_monitors; GList *l; - int highest_scale = 0; + float highest_scale = 0.0; cursor_rect = meta_cursor_renderer_calculate_rect (cursor_renderer, cursor_sprite); @@ -1482,13 +1482,18 @@ root_cursor_prepare_at (MetaCursorSpriteXcursor *sprite_xcursor, if (meta_is_stage_views_scaled ()) { - int scale; + float scale; scale = find_highest_logical_monitor_scale (backend, cursor_sprite); - if (scale != 0) + if (scale != 0.0) { - meta_cursor_sprite_xcursor_set_theme_scale (sprite_xcursor, scale); - meta_cursor_sprite_set_texture_scale (cursor_sprite, 1.0 / scale); + float ceiled_scale; + + ceiled_scale = ceilf (scale); + meta_cursor_sprite_xcursor_set_theme_scale (sprite_xcursor, + (int) ceiled_scale); + meta_cursor_sprite_set_texture_scale (cursor_sprite, + 1.0 / ceiled_scale); } } else