Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d6f8dd7

Browse files
authored
fix(windows): create child webviews on top of the z-order (#1271)
closes tauri-apps/tauri#9798
1 parent 03d2535 commit d6f8dd7

2 files changed

Lines changed: 20 additions & 2 deletions

File tree

.changes/child-webview.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"wry": "patch"
3+
---
4+
5+
On Windows, create child webview at the top of z-order to align with other platforms.

src/webview2/mod.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ use windows::{
3131
self as win32wm, CreateWindowExW, DefWindowProcW, DestroyWindow, GetClientRect,
3232
PostMessageW, RegisterClassExW, RegisterWindowMessageA, SendMessageW, SetParent,
3333
SetWindowPos, ShowWindow, CS_HREDRAW, CS_VREDRAW, CW_USEDEFAULT, HCURSOR, HICON, HMENU,
34-
SWP_ASYNCWINDOWPOS, SWP_NOACTIVATE, SWP_NOMOVE, SWP_NOZORDER, SW_HIDE, SW_SHOW,
35-
WINDOW_EX_STYLE, WM_USER, WNDCLASSEXW, WS_CHILD, WS_CLIPCHILDREN, WS_VISIBLE,
34+
HWND_TOP, SWP_ASYNCWINDOWPOS, SWP_NOACTIVATE, SWP_NOMOVE, SWP_NOOWNERZORDER, SWP_NOSIZE,
35+
SWP_NOZORDER, SW_HIDE, SW_SHOW, WINDOW_EX_STYLE, WM_USER, WNDCLASSEXW, WS_CHILD,
36+
WS_CLIPCHILDREN, WS_VISIBLE,
3637
},
3738
},
3839
},
@@ -240,6 +241,18 @@ impl InnerWebView {
240241
)
241242
};
242243

244+
unsafe {
245+
SetWindowPos(
246+
hwnd,
247+
HWND_TOP,
248+
0,
249+
0,
250+
0,
251+
0,
252+
SWP_ASYNCWINDOWPOS | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOSIZE,
253+
)
254+
}?;
255+
243256
Ok(hwnd)
244257
}
245258

0 commit comments

Comments
 (0)