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] WindowEvent::Focused does not get fired for App run callback #6460

Closed
NurMarvin opened this issue Mar 15, 2023 · 0 comments
Closed

[bug] WindowEvent::Focused does not get fired for App run callback #6460

NurMarvin opened this issue Mar 15, 2023 · 0 comments
Assignees
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@NurMarvin
Copy link

Describe the bug

The WindowEvent::Focused event does not get fired when listening for it via the App run callback.

Reproduction

  1. Consider the following code:
app.run(move |app_handle, e| {
    match e {
        RunEvent::WindowEvent { event, .. } => {
            match event {
                WindowEvent::Focused(focused) => {
                    println!("Focused: {}", focused);
                }
                _ => (),
            }
        }
        _ => (),
    }
});
  1. Start the program
  2. Try to change the focus state of the window
  3. Observe

Expected behavior

The event should fire printing "Focused: true" or "Focused: false" to the console depending on the focused state of the window.

Platform and versions

Environment
  › OS: Windows 10.0.22621 X64
  › Webview2: 110.0.1587.69
  › MSVC: 
      - Visual Studio Community 2019
  › Node.js: 18.14.0
  › npm: 9.3.1
  › pnpm: 7.23.0
  › yarn: 1.22.19
  › rustup: 1.25.2
  › rustc: 1.69.0-nightly
  › cargo: 1.69.0-nightly
  › Rust toolchain: nightly-x86_64-pc-windows-msvc 

Packages
  › @tauri-apps/cli [NPM]: 1.2.3
  › @tauri-apps/api [NPM]: 1.2.0
  › tauri [RUST]: 1.2.4,
  › tauri-build [RUST]: 1.2.1,
  › tao [RUST]: 0.15.8,
  › wry [RUST]: 0.23.4,

App
  › build-type: bundle
  › CSP: unset
  › distDir: ../dist
  › devPath: http://localhost:1420/
  › framework: React
  › bundler: Vite

App directory structure
  ├─ .git
  ├─ .vscode
  ├─ dist
  ├─ node_modules
  ├─ public
  ├─ src
  └─ src-tauri

Stack trace

No response

Additional context

Adding a handler for it via on_window_event works fine

@NurMarvin NurMarvin added status: needs triage This issue needs to triage, applied to new issues type: bug labels Mar 15, 2023
@amrbashir amrbashir self-assigned this Mar 20, 2023
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