diff --git a/src/backend/render/cursor.rs b/src/backend/render/cursor.rs index c1452df1..0c1e2384 100644 --- a/src/backend/render/cursor.rs +++ b/src/backend/render/cursor.rs @@ -20,7 +20,8 @@ use smithay::{ reexports::wayland_server::protocol::wl_surface, render_elements, utils::{ - Buffer as BufferCoords, IsAlive, Logical, Monotonic, Point, Scale, Size, Time, Transform, + Buffer as BufferCoords, IsAlive, Logical, Monotonic, Physical, Point, Scale, Size, Time, + Transform, }, wayland::compositor::{get_role, with_states}, }; @@ -128,7 +129,7 @@ pub fn draw_surface_cursor( surface: &wl_surface::WlSurface, location: impl Into>, scale: impl Into>, -) -> Vec<(CursorRenderElement, Point)> +) -> Vec<(CursorRenderElement, Point)> where R: Renderer + ImportAll, R::TextureId: Clone + 'static, @@ -143,11 +144,7 @@ where .lock() .unwrap() .hotspot - .to_buffer( - 1, - Transform::Normal, - &Size::from((1, 1)), /* Size doesn't matter for Transform::Normal */ - ) + .to_physical_precise_round(scale) }); render_elements_from_surface_tree( @@ -259,7 +256,7 @@ pub fn draw_cursor( buffer_scale: f64, time: Time, draw_default: bool, -) -> Vec<(CursorRenderElement, Point)> +) -> Vec<(CursorRenderElement, Point)> where R: Renderer + ImportMem + ImportAll, R::TextureId: Send + Clone + 'static, @@ -320,7 +317,12 @@ where } }; - let hotspot = Point::::from((frame.xhot as i32, frame.yhot as i32)); + let hotspot = Point::::from((frame.xhot as i32, frame.yhot as i32)) + .to_logical( + actual_scale as i32, + Transform::Normal, + &Size::from((frame.width as i32, frame.height as i32)), + ); state.current_image = Some(frame); return vec![( @@ -336,10 +338,10 @@ where ) .expect("Failed to import cursor bitmap"), ), - hotspot, + hotspot.to_physical_precise_round(scale), )]; } else if let CursorImageStatus::Surface(ref wl_surface) = cursor_status { - return draw_surface_cursor(renderer, wl_surface, location.to_i32_round(), scale); + return draw_surface_cursor(renderer, wl_surface, location, scale); } else { Vec::new() }