tauri-apps / tauri

Build smaller, faster, and more secure desktop applications with a web frontend.
https://tauri.app
Apache License 2.0
81.85k stars 2.46k forks source link

[bug] `window.set_cursor_visible(false)` does not work. #10231

Open ILikeTeaALot opened 2 months ago

ILikeTeaALot commented 2 months ago

Describe the bug

When creating a window, and running window.set_cursor_visible(false), the cursor should be hidden when the window opens. It isn't.

Reproduction

during setup, run the following:

tauri::Builder::default()
    // ... initial tauri context builder calls
    app.setup(|app| {
        let window = app.get_webview_window("main").unwrap();
        // Cursor
        window.set_cursor_visible(false)?;
    })
    // ... rest of tauri init
    .run(tauri::generate_context!())

Expected behavior

The cursor should be hidden/invisible.

Full tauri info output

`cargo tauri info`

[✔] Environment
    - OS: Windows 10.0.19045 X64
    ✔ WebView2: 126.0.2592.87
    ✔ MSVC: 
        - Visual Studio Community 2019
        - Visual Studio Community 2022
    ✔ rustc: 1.78.0 (9b00956e5 2024-04-29)
    ✔ cargo: 1.78.0 (54d8815d0 2024-03-26)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (environment override by RUSTUP_TOOLCHAIN)
    - node: 20.13.1
    - yarn: 1.22.15
    - npm: 10.5.2

[-] Packages
    - tauri [RUST]: 2.0.0-beta.23      
    - tauri-build [RUST]: 2.0.0-beta.18
    - wry [RUST]: 0.41.0
    - tao [RUST]: 0.28.1
    - tauri-cli [RUST]: 2.0.0-beta.17  
    - @tauri-apps/api [NPM]: 2.0.0-beta.14
    - @tauri-apps/cli [NPM]: 2.0.0-beta.17

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - framework: React
    - bundler: Vite

Stack trace

N/A - Not a crash

Additional context

Setting the CSS cursor: none; property works, but requires user interaction to take effect.

(to help this come up if someone else searches for it: the method set_cursor_visible on window is not working)

brooke-ec commented 1 month ago

I am having this same issue in Tauri 1.7.0.