From 3e1d16916033aa4113e5d8abed3170bcf8220ad1 Mon Sep 17 00:00:00 2001 From: Kirill Chibisov Date: Wed, 18 Dec 2019 16:41:44 +0300 Subject: [PATCH] On Wayland, fix cursor icon updates on window borders when using CSD (#1322) * On Wayland, fix cursor icon updates on window borders when using CSD * Move changelog entry to a right place --- CHANGELOG.md | 2 ++ src/platform_impl/linux/wayland/pointer.rs | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 801eb116..b7e89bde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Unreleased +- On Wayland, fix cursor icon updates on window borders when using CSD. + # # 0.20.0 Alpha 5 (2019-12-09) - On macOS, fix application termination on `ControlFlow::Exit` diff --git a/src/platform_impl/linux/wayland/pointer.rs b/src/platform_impl/linux/wayland/pointer.rs index cad299e4..d2785bfe 100644 --- a/src/platform_impl/linux/wayland/pointer.rs +++ b/src/platform_impl/linux/wayland/pointer.rs @@ -56,6 +56,13 @@ pub fn implement_pointer( let wid = store.find_wid(&surface); if let Some(wid) = wid { mouse_focus = Some(wid); + + // Reload cursor style only when we enter winit's surface. Calling + // this function every time on `PtrEvent::Enter` could interfere with + // SCTK CSD handling, since it changes cursor icons when you hover + // cursor over the window borders. + cursor_manager.reload_cursor_style(); + sink.send_window_event( WindowEvent::CursorEntered { device_id: crate::event::DeviceId( @@ -75,8 +82,6 @@ pub fn implement_pointer( wid, ); } - - cursor_manager.reload_cursor_style(); } PtrEvent::Leave { surface, .. } => { mouse_focus = None;