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] When my mouse is focused on another monitor , we use primary_monitor , my primary_monitor can't show web-view window #11431

Open
li-yu-tfs opened this issue Oct 21, 2024 · 2 comments
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@li-yu-tfs
Copy link

li-yu-tfs commented Oct 21, 2024

Describe the bug

When my mouse is focused on another monitor , we use primary_monitor , my primary_monitor can't show web-view window, but when i focused on primary_monitor , we use primary_monitor, will show web-view window.

this is my code, pls check.

by the way , when my mouse is another monitor or primary_monitor , the information printed is all my primary_monitor.

if let Some(primary_monitor) = app_handle.primary_monitor().unwrap() {
    let screen_size = primary_monitor.size();
    println!("screen_size: {:?}", screen_size);
    println!("primary_monitor: {:?}", primary_monitor);

    // screen_size: PhysicalSize { width: 3360, height: 2100 }
    // primary_monitor: Monitor { name: Some("Monitor #41032"), size: PhysicalSize { width: 3360, height: 2100 }, position: PhysicalPosition { x: 0, y: 0 }, scale_factor: 2.0 }
    let window_size = voice_bubble.inner_size().unwrap();
    let margin = 140.0;

    let x = screen_size.width as f64 - window_size.width as f64 - margin;
    let y = screen_size.height as f64 - window_size.height as f64 - margin;

    let primary_position = primary_monitor.position();

    voice_bubble
        .set_position(tauri::Position::Physical(tauri::PhysicalPosition {
            x: (primary_position.x as f64 + x) as i32,
            y: (primary_position.y as f64 + y) as i32,
        }))
        .unwrap();
}

voice_bubble.show().unwrap();

Reproduction

No response

Expected behavior

No response

Full tauri info output


[✔] Environment
    - OS: Mac OS 14.6.1 arm64 (X64)
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.81.0 (eeb90cda1 2024-09-04)
    ✔ cargo: 1.81.0 (2dbb1af80 2024-08-20)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (default)
    - node: 20.15.0
    - pnpm: 7.33.7
    - yarn: 1.22.19
    - npm: 8.19.4

[-] Packages
    - tauri 🦀: 2.0.5
    - tauri-build 🦀: 2.0.1
    - wry 🦀: 0.46.2
    - tao 🦀: 0.30.3
    - @tauri-apps/api : 2.0.2 (outdated, latest: 2.0.3)
    - @tauri-apps/cli : 2.0.2 (outdated, latest: 2.0.4)

[-] Plugins
    - tauri-plugin-http 🦀: 2.0.2
    - @tauri-apps/plugin-http : 2.0.0 (outdated, latest: 2.0.1)
    - tauri-plugin-single-instance 🦀: 2.0.1
    - @tauri-apps/plugin-single-instance : not installed!
    - tauri-plugin-updater 🦀: 2.0.2
    - @tauri-apps/plugin-updater : 2.0.0
    - tauri-plugin-fs 🦀: 2.0.2
    - @tauri-apps/plugin-fs : 2.0.0 (outdated, latest: 2.0.1)
    - tauri-plugin-store 🦀: 2.1.0
    - @tauri-apps/plugin-store : 2.0.0 (outdated, latest: 2.1.0)
    - tauri-plugin-dialog 🦀: 2.0.2
    - @tauri-apps/plugin-dialog : 2.0.0 (outdated, latest: 2.0.1)
    - tauri-plugin-os 🦀: 2.0.1
    - @tauri-apps/plugin-os : 2.0.0
    - tauri-plugin-shell 🦀: 2.0.2
    - @tauri-apps/plugin-shell : 2.0.0 (outdated, latest: 2.0.1)
    - tauri-plugin-sql 🦀: 2.0.1
    - @tauri-apps/plugin-sql : 2.0.0
    - tauri-plugin-notification 🦀: 2.0.1
    - @tauri-apps/plugin-notification : 2.0.0

[-] App
    - build-type: bundle
    - CSP: default-src 'self';
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - framework: React
    - bundler: Vite

Stack trace

No response

Additional context

No response

@li-yu-tfs li-yu-tfs added status: needs triage This issue needs to triage, applied to new issues type: bug labels Oct 21, 2024
@FabianLars
Copy link
Member

Please include the output of the tauri info command as required by the issue template.

@li-yu-tfs
Copy link
Author

Please include the output of the tauri info command as required by the issue template.

Sorry, have updated. pls check again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

2 participants