[bug] WindowBuilder::parent_window hides the child window under the parent window on Windows
Describe the bug
WindowBuilder::parent_window hides the child window under the parent window on Windows.
There are similar reports on Disocord. https://discord.com/channels/616186924390023171/1065931904894910525/1067098112067387497 https://discord.com/channels/616186924390023171/807549941936816148/956458609993211954
Reproduced in the tauri example too.
Reproduction
- Go to https://github.com/tauri-apps/tauri
- Run
cargo run --example parent-window - Push
Create child windowbutton
Expected behavior
Child window appears on top of parent window
Platform and versions
Environment
› OS: Windows 10.0.19044 X64
› Webview2: 109.0.1518.78
› MSVC:
- Visual Studio Professional 2017
- Visual Studio Professional 2019
› Node.js: 16.9.0
› npm: 8.2.0
› pnpm: Not installed!
› yarn: 1.22.11
› rustup: 1.25.2
› rustc: 1.67.0
› cargo: 1.67.0
› Rust toolchain: stable-x86_64-pc-windows-msvc Packages
WARNING: no lock files found, defaulting to npm
› @tauri-apps/cli [NPM]: 1.2.2 (outdated, latest: 1.2.3)
Stack trace
No response
Additional context
No response
This is the expected behavior, see the docs https://docs.rs/tauri/latest/x86_64-pc-windows-msvc/tauri/window/struct.WindowBuilder.html#method.parent_window
I think what you need, is to use owner_window
@amrbashir The child window is always displayed under the parent window and I can't control it by mouse. Is this behavior correct?
FabianLars said probably not
https://discord.com/channels/616186924390023171/1073540871833800714/1074623848986714112
Probably the webview2 control of the parent window is displayed above it, and we can't control its z-order unfortunately.
@amrbashir
Probably the webview2 control of the parent window is displayed above it, and we can't control its z-order unfortunately.
where is this problem? Tauri or tao or wry?
I will use owner_window until the issue is resolved. The problem has not been resolved, so would you please reopen issue?
I wouldn't still qualify this as a bug since it is not an intended use-case, but I will re-open this in case someone wants to work on it.
Also this might be useful from MSDN:
If the created window is a child window, its default position is at the bottom of the Z-order. If the created window is a top-level window, its default position is at the top of the Z-order (but beneath all topmost windows unless the created window is itself topmost).
@amrbashir
You said I wouldn't still qualify this as a bug, but as you can see in the video, the child windows are not visible or controlable.
If this is not a bug, how should parent_window be used?
This is the Tauri example video.
https://user-images.githubusercontent.com/6227619/221461648-0ffa4e7c-afb8-464b-a793-7656f64960dd.mp4
What I meant, is that I won't be spending much time debugging why this happens since it is not the main use-case for tauri apps.
https://github.com/MicrosoftEdge/WebView2Feedback/issues/286#issuecomment-1567300095 Looks like there will be way to fix this