Skip to content

Commit

Permalink
enhance(windows): disable our in-client resizing for undecorated wind…
Browse files Browse the repository at this point in the history
…ow with shadows (#12817)

* enhance(windows): disable our in-client resizing for undecorated window with shadows

ref: tauri-apps/tao#1052

* skip hittesting for undeceorated windows
  • Loading branch information
amrbashir authored Feb 26, 2025
1 parent 955832e commit 385a41d
Show file tree
Hide file tree
Showing 5 changed files with 199 additions and 61 deletions.
5 changes: 5 additions & 0 deletions .changes/undecorated-resizing-windows-outside.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri": "patch:enhance"
---

On Windows, undecorated window with shadows, now have native resize handles outside of the window client area.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/tauri-runtime-wry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ wry = { version = "0.50.0", default-features = false, features = [
"os-webview",
"linux-body",
] }
tao = { version = "0.32.1", default-features = false, features = ["rwh_06"] }
tao = { version = "0.32.2", default-features = false, features = ["rwh_06"] }
tauri-runtime = { version = "2.3.0", path = "../tauri-runtime" }
tauri-utils = { version = "2.1.1", path = "../tauri-utils" }
raw-window-handle = "0.6"
Expand Down
17 changes: 13 additions & 4 deletions crates/tauri-runtime-wry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3013,7 +3013,10 @@ fn handle_user_message<T: UserEvent>(
if !resizable {
undecorated_resizing::detach_resize_handler(window.hwnd());
} else if !window.is_decorated() {
undecorated_resizing::attach_resize_handler(window.hwnd());
undecorated_resizing::attach_resize_handler(
window.hwnd(),
window.has_undecorated_shadow(),
);
}
}
WindowMessage::SetMaximizable(maximizable) => window.set_maximizable(maximizable),
Expand All @@ -3039,12 +3042,18 @@ fn handle_user_message<T: UserEvent>(
if decorations {
undecorated_resizing::detach_resize_handler(window.hwnd());
} else if window.is_resizable() {
undecorated_resizing::attach_resize_handler(window.hwnd());
undecorated_resizing::attach_resize_handler(
window.hwnd(),
window.has_undecorated_shadow(),
);
}
}
WindowMessage::SetShadow(_enable) => {
#[cfg(windows)]
window.set_undecorated_shadow(_enable);
{
window.set_undecorated_shadow(_enable);
undecorated_resizing::update_drag_hwnd_rgn_for_undecorated(window.hwnd(), _enable);
}
#[cfg(target_os = "macos")]
window.set_has_shadow(_enable);
}
Expand Down Expand Up @@ -4490,7 +4499,7 @@ fn create_webview<T: UserEvent>(
undecorated_resizing::attach_resize_handler(&webview);
#[cfg(windows)]
if window.is_resizable() && !window.is_decorated() {
undecorated_resizing::attach_resize_handler(window.hwnd());
undecorated_resizing::attach_resize_handler(window.hwnd(), window.has_undecorated_shadow());
}
}

Expand Down
Loading

0 comments on commit 385a41d

Please sign in to comment.