diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index 06a9f488d..4205c3178 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -460,7 +460,7 @@ fn canvas_cursor(app: &mut VectorcraftApp, ui: &Ui, view_info: vectorcraft_engin } Some(hp) if custom - && crate::cursors::paint_glyphs(crate::cursors::HIDES_ONLY_WHEN_KEY, ui.input(|i| i.focused)) + && crate::cursors::paint_glyphs(crate::cursors::HIDES_ONLY_WHEN_KEY, ui.input(|i| i.focused), app.services.no_cursor_theme) && crate::cursors::paint(&painter, c, hp, 1.0 / ui_scale) => { // No cursor theme (Wayland): the glyph is painted, the system pointer stays (#2450). diff --git a/crates/ui-egui/src/cursors.rs b/crates/ui-egui/src/cursors.rs index 44377a2c8..b404f9967 100644 --- a/crates/ui-egui/src/cursors.rs +++ b/crates/ui-egui/src/cursors.rs @@ -714,11 +714,11 @@ pub fn hide_system_pointer(no_cursor_theme: bool) -> bool { /// Over a window behind another app or under a sheet, the system pointer shows (#2020). pub const HIDES_ONLY_WHEN_KEY: bool = cfg!(target_os = "macos"); -/// Does the window paint the glyphs over a hidden pointer, `focused` or not? Not where the system -/// shows its pointer over a window without the focus ([`HIDES_ONLY_WHEN_KEY`]): the system pointer -/// shows alone there. -pub fn paint_glyphs(hides_only_when_key: bool, focused: bool) -> bool { - focused || !hides_only_when_key +/// Does the window paint a glyph over a hidden pointer? Not where it cannot hide the system pointer +/// (no cursor theme on Wayland), or where the system shows its pointer without the focus +/// ([`HIDES_ONLY_WHEN_KEY`]): the system pointer shows alone there. +pub fn paint_glyphs(hides_only_when_key: bool, focused: bool, no_cursor_theme: bool) -> bool { + !no_cursor_theme && (focused || !hides_only_when_key) } /// The cursor bitmaps handed to the OS, by (cursor, pixels per point): each glyph is rasterized diff --git a/crates/ui-egui/src/cursors/tests.rs b/crates/ui-egui/src/cursors/tests.rs index ece8895b4..73c0b5979 100644 --- a/crates/ui-egui/src/cursors/tests.rs +++ b/crates/ui-egui/src/cursors/tests.rs @@ -472,9 +472,10 @@ fn wayland_windows_paint_the_glyphs() { #[test] fn macos_windows_paint_the_glyphs_only_with_the_focus() { - assert!(paint_glyphs(true, true), "macOS with the focus"); - assert!(!paint_glyphs(true, false), "macOS without the focus: the system pointer shows (#2020)"); - assert!(paint_glyphs(false, true) && paint_glyphs(false, false), "Wayland, the web: painted with the focus or without"); + assert!(paint_glyphs(true, true, false), "macOS with the focus"); + assert!(!paint_glyphs(true, false, false), "macOS without the focus: the system pointer shows (#2020)"); + assert!(paint_glyphs(false, true, false) && paint_glyphs(false, false, false), "Wayland, the web: painted with the focus or without"); + assert!(!paint_glyphs(false, true, true), "without a cursor theme, use the system pointer alone"); } #[test]