Repository: tauri-apps/wry (language: rust)

Issue:
Support WebView2 non client area APIs
Add support for WebView2 non client area APIs

> https://learn.microsoft.com/en-us/microsoft-edge/webview2/release-notes/?tabs=win32cpp#10242047


Discussion / hints:
The linked API is for composition API which we can't use atm because it doesn't support Windows 7
Also these APIs exist so as a way to forward `WM_NCHITTEST` to Webview2 not the other way around.
Can we at least support the setting that enables `app-region` css property?

> https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2settings9?view=webview2-1.0.2478.35
yeah sure, we can enable it by default

Fix patch:
diff --git a/.changes/webview-drag-client-region.md b/.changes/webview-drag-client-region.md
new file mode 100644
index 000000000..4e116cdd9
--- /dev/null
+++ b/.changes/webview-drag-client-region.md
@@ -0,0 +1,5 @@
+---
+"wry": "patch"
+---
+
+On Windows, enable webview2 [non client region support](https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2settings9?view=webview2-1.0.2478.35#get_isnonclientregionsupportenabled) which allows using `app-region` CSS style.
diff --git a/src/webview2/mod.rs b/src/webview2/mod.rs
index fffe36401..230232cdd 100644
--- a/src/webview2/mod.rs
+++ b/src/webview2/mod.rs
@@ -512,6 +512,10 @@ impl InnerWebView {
     let settings6 = settings.cast::<ICoreWebView2Settings6>()?;
     settings6.SetIsSwipeNavigationEnabled(attributes.back_forward_navigation_gestures)?;
 
+    if let Ok(settings9) = settings.cast::<ICoreWebView2Settings9>() {
+      settings9.SetIsNonClientRegionSupportEnabled(true)?;
+    }
+
     Ok(())
   }
 


Test patch: