Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] window.cursorPosition errors in v2 #10340

Closed
bicarlsen opened this issue Jul 21, 2024 · 3 comments · Fixed by #11401
Closed

[bug] window.cursorPosition errors in v2 #10340

bicarlsen opened this issue Jul 21, 2024 · 3 comments · Fixed by #11401
Labels
platform: Linux status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@bicarlsen
Copy link

Describe the bug

In v2 when calling __TAURI__.window.cursorPosition() I receive the error GDK may only be used from the main thread on the backend.

Reproduction

From a Tauri v2 app, in the console run __TAURI__.window.cursorPosition().

Expected behavior

Cursor position should be returned.

Full tauri info output

[✔] Environment
    - OS: Pop!_OS 22.4.0 X64
    ✔ webkit2gtk-4.1: 2.44.2
    ✔ rsvg2: 2.52.5
    ✔ rustc: 1.81.0-nightly (e9e6e2e44 2024-06-28)
    ✔ cargo: 1.81.0-nightly (4ed7bee47 2024-06-25)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: nightly-x86_64-unknown-linux-gnu (environment override by RUSTUP_TOOLCHAIN)
    - node: 19.9.0
    - npm: 9.6.3

[-] Packages
    - tauri [RUST]: 2.0.0-beta.22
    - tauri-build [RUST]: 2.0.0-beta.17
    - wry [RUST]: 0.41.0
    - tao [RUST]: 0.28.1
    - tauri-cli [RUST]: 2.0.0-beta.18
    - @tauri-apps/api : not installed!
    - @tauri-apps/cli [NPM]: 2.0.0-beta.18

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

Stack trace

thread 'tokio-runtime-worker' panicked at /home/xxx/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gdk-0.18.0/src/auto/display.rs:301:9:
GDK may only be used from the main thread.

Additional context

No response

@bicarlsen bicarlsen added status: needs triage This issue needs to triage, applied to new issues type: bug labels Jul 21, 2024
@bicarlsen
Copy link
Author

bicarlsen commented Jul 22, 2024

@FabianLars I also tested on Windows and got the same error, so my guess is it's a platform independent bug.

@FabianLars
Copy link
Member

Do you still have the full error from the Windows test? I doubt it's exactly the same since we don't use GDK on Windows so it'd be interesting to see where it panics.

@bicarlsen
Copy link
Author

Oops, it appears it is working on Windows now. I must have messed something up when testing the first time. Sorry about that.

lucasfernog added a commit that referenced this issue Oct 22, 2024
* fix(runtime-wry): run `cursor_position` getter on main thread

closes #10340

* clippy

* clippy

---------

Co-authored-by: Lucas Nogueira <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: Linux status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants