From c528ecf0fcda0597a371f0e9f1b0e9acba3b25f0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 13 Jan 2025 14:23:42 +0100 Subject: [PATCH 1/2] Apply Version Updates From Current Changes (#1447) Co-authored-by: pewsheen --- .changes/disable-background-throttling.md | 5 ----- .changes/traffic-light-inset.md | 5 ----- CHANGELOG.md | 8 ++++++++ Cargo.toml | 2 +- 4 files changed, 9 insertions(+), 11 deletions(-) delete mode 100644 .changes/disable-background-throttling.md delete mode 100644 .changes/traffic-light-inset.md diff --git a/.changes/disable-background-throttling.md b/.changes/disable-background-throttling.md deleted file mode 100644 index 288380492..000000000 --- a/.changes/disable-background-throttling.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'wry': 'patch:enhance' ---- - -Add an option to change the default background throttling policy (currently for WebKit only). diff --git a/.changes/traffic-light-inset.md b/.changes/traffic-light-inset.md deleted file mode 100644 index ad8221531..000000000 --- a/.changes/traffic-light-inset.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -wry: patch ---- - -Add functionality to set the traffic light inset on macOS. This is required to prevent flickers if the WebView is injected via `build()` instead of `build_as_child()`. diff --git a/CHANGELOG.md b/CHANGELOG.md index 85cea74f3..8a05377c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## \[0.48.1] + +- [`cbbcccc`](https://github.com/tauri-apps/wry/commit/cbbcccc38af7d900a0f8f7fa5ea5e6667765ed81) ([#1446](https://github.com/tauri-apps/wry/pull/1446) by [@FabianLars](https://github.com/tauri-apps/wry/../../FabianLars)) Add functionality to set the traffic light inset on macOS. This is required to prevent flickers if the WebView is injected via `build()` instead of `build_as_child()`. + +### enhance + +- [`26abf63`](https://github.com/tauri-apps/wry/commit/26abf63d79c4a0fcff8ea39d0ff677686f5b546c) ([#1445](https://github.com/tauri-apps/wry/pull/1445) by [@bastiankistner](https://github.com/tauri-apps/wry/../../bastiankistner)) Add an option to change the default background throttling policy (currently for WebKit only). + ## \[0.48.0] - [`eb0c816`](https://github.com/tauri-apps/wry/commit/eb0c8163f1e2a11115ef1928b5e4bf0a8f083f3b) ([#1423](https://github.com/tauri-apps/wry/pull/1423) by [@SpikeHD](https://github.com/tauri-apps/wry/../../SpikeHD)) Rename `{WebViewBuilderExtWindows, WebViewBuilderExtUnix}::with_extension_path` to `with_extensions_path`. diff --git a/Cargo.toml b/Cargo.toml index ab5b634ad..eff01b361 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ workspace = {} [package] name = "wry" -version = "0.48.0" +version = "0.48.1" authors = ["Tauri Programme within The Commons Conservancy"] edition = "2021" license = "Apache-2.0 OR MIT" From 95a9319f24cb62add69d468ec0f60530b608fe6b Mon Sep 17 00:00:00 2001 From: Tony <68118705+Legend-Master@users.noreply.github.com> Date: Tue, 14 Jan 2025 11:54:13 +0800 Subject: [PATCH 2/2] chore(deps): update webview2 and windows (#1454) --- .changes/webview2-0.35-windows-0.59.md | 5 +++++ Cargo.toml | 7 +++---- src/lib.rs | 2 +- src/webview2/drag_drop.rs | 11 ++++++---- src/webview2/mod.rs | 29 +++++++++++--------------- src/webview2/util.rs | 4 ++-- 6 files changed, 30 insertions(+), 28 deletions(-) create mode 100644 .changes/webview2-0.35-windows-0.59.md diff --git a/.changes/webview2-0.35-windows-0.59.md b/.changes/webview2-0.35-windows-0.59.md new file mode 100644 index 000000000..8fb5f76db --- /dev/null +++ b/.changes/webview2-0.35-windows-0.59.md @@ -0,0 +1,5 @@ +--- +wry: minor +--- + +Updated `webview2-com` to `0.35`, `windows` to `0.59`. diff --git a/Cargo.toml b/Cargo.toml index eff01b361..1d545df7c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -68,15 +68,14 @@ gdkx11 = { version = "0.18", optional = true } percent-encoding = "2.3" [target."cfg(target_os = \"windows\")".dependencies] -webview2-com = "0.34" +webview2-com = "0.35" windows-version = "0.1" -windows-core = "0.58" +windows-core = "0.59" dunce = "1" [target."cfg(target_os = \"windows\")".dependencies.windows] -version = "0.58" +version = "0.59" features = [ - "implement", "Win32_Foundation", "Win32_Graphics_Gdi", "Win32_System_Com", diff --git a/src/lib.rs b/src/lib.rs index ca9f436af..037f4a6db 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -591,7 +591,7 @@ pub struct WebViewAttributes<'a> { pub background_throttling: Option, } -impl<'a> Default for WebViewAttributes<'a> { +impl Default for WebViewAttributes<'_> { fn default() -> Self { Self { id: Default::default(), diff --git a/src/webview2/drag_drop.rs b/src/webview2/drag_drop.rs index cf3efe8c0..67111c985 100644 --- a/src/webview2/drag_drop.rs +++ b/src/webview2/drag_drop.rs @@ -57,7 +57,7 @@ impl DragDropController { let closure = &mut *(lparam.0 as *mut c_void as *mut &mut dyn FnMut(HWND) -> bool); closure(hwnd).into() } - let _ = unsafe { EnumChildWindows(hwnd, Some(enumerate_callback), lparam) }; + let _ = unsafe { EnumChildWindows(Some(hwnd), Some(enumerate_callback), lparam) }; } controller @@ -94,7 +94,10 @@ impl DragDropTarget { } } - unsafe fn iterate_filenames(data_obj: Option<&IDataObject>, mut callback: F) -> Option + unsafe fn iterate_filenames( + data_obj: windows_core::Ref<'_, IDataObject>, + mut callback: F, + ) -> Option where F: FnMut(PathBuf), { @@ -157,7 +160,7 @@ impl DragDropTarget { impl IDropTarget_Impl for DragDropTarget_Impl { fn DragEnter( &self, - pDataObj: Option<&IDataObject>, + pDataObj: windows_core::Ref<'_, IDataObject>, _grfKeyState: MODIFIERKEYS_FLAGS, pt: &POINTL, pdwEffect: *mut DROPEFFECT, @@ -224,7 +227,7 @@ impl IDropTarget_Impl for DragDropTarget_Impl { fn Drop( &self, - pDataObj: Option<&IDataObject>, + pDataObj: windows_core::Ref<'_, IDataObject>, _grfKeyState: MODIFIERKEYS_FLAGS, pt: &POINTL, _pdwEffect: *mut DROPEFFECT, diff --git a/src/webview2/mod.rs b/src/webview2/mod.rs index ca4bb96c7..564ca2e11 100644 --- a/src/webview2/mod.rs +++ b/src/webview2/mod.rs @@ -237,9 +237,9 @@ impl InnerWebView { y, width, height, - parent, - HMENU::default(), - GetModuleHandleW(PCWSTR::null()).unwrap_or_default(), + Some(parent), + None, + GetModuleHandleW(PCWSTR::null()).map(Into::into).ok(), None, )? }; @@ -247,7 +247,7 @@ impl InnerWebView { unsafe { SetWindowPos( hwnd, - HWND_TOP, + Some(HWND_TOP), 0, 0, 0, @@ -1040,7 +1040,7 @@ impl InnerWebView { let raw = Box::into_raw(boxed2); - let _res = PostMessageW(hwnd, *EXEC_MSG_ID, WPARAM(raw as _), LPARAM(0)); + let _res = PostMessageW(Some(hwnd), *EXEC_MSG_ID, WPARAM(raw as _), LPARAM(0)); #[cfg(any(debug_assertions, feature = "tracing"))] if let Err(err) = _res { @@ -1067,7 +1067,7 @@ impl InnerWebView { if msg == *EXEC_MSG_ID { let mut function: Box> = Box::from_raw(wparam.0 as *mut _); function(); - let _ = RedrawWindow(hwnd, None, HRGN::default(), RDW_INTERNALPAINT); + let _ = RedrawWindow(Some(hwnd), None, None, RDW_INTERNALPAINT); return LRESULT(0); } @@ -1139,7 +1139,7 @@ impl InnerWebView { if (*controller).ParentWindow(&mut hwnd).is_ok() { let _ = SetWindowPos( hwnd, - HWND::default(), + None, 0, 0, width, @@ -1193,12 +1193,7 @@ impl InnerWebView { #[inline] unsafe fn dettach_parent_subclass(parent: HWND) { - SendMessageW( - parent, - PARENT_DESTROY_MESSAGE, - WPARAM::default(), - LPARAM::default(), - ); + SendMessageW(parent, PARENT_DESTROY_MESSAGE, None, None); let _ = RemoveWindowSubclass( parent, Some(Self::parent_subclass_proc), @@ -1321,7 +1316,7 @@ impl InnerWebView { x: rect.left, y: rect.top, }]; - unsafe { MapWindowPoints(self.hwnd, *self.parent.borrow(), position_point) }; + unsafe { MapWindowPoints(Some(self.hwnd), Some(*self.parent.borrow()), position_point) }; bounds.position = PhysicalPosition::new(position_point[0].x, position_point[0].y).into(); } else { @@ -1348,7 +1343,7 @@ impl InnerWebView { SetWindowPos( self.hwnd, - HWND::default(), + None, position.x, position.y, size.width, @@ -1436,7 +1431,7 @@ impl InnerWebView { unsafe { let parent = *self.parent.borrow(); if parent != HWND::default() { - SetFocus(parent)?; + SetFocus(Some(parent))?; } } @@ -1553,7 +1548,7 @@ impl InnerWebView { let parent = HWND(parent as _); unsafe { - SetParent(self.hwnd, parent)?; + SetParent(self.hwnd, Some(parent))?; if !self.is_child { Self::dettach_parent_subclass(*self.parent.borrow()); diff --git a/src/webview2/util.rs b/src/webview2/util.rs index 8f822e42c..f227e15dc 100644 --- a/src/webview2/util.rs +++ b/src/webview2/util.rs @@ -81,7 +81,7 @@ pub unsafe fn hwnd_dpi(hwnd: HWND) -> u32 { BASE_DPI } } else { - let hdc = GetDC(hwnd); + let hdc = GetDC(Some(hwnd)); if hdc.is_invalid() { return BASE_DPI; } @@ -90,7 +90,7 @@ pub unsafe fn hwnd_dpi(hwnd: HWND) -> u32 { if IsProcessDPIAware().as_bool() { // If the process is DPI aware, then scaling must be handled by the application using // this DPI value. - GetDeviceCaps(hdc, LOGPIXELSX) as u32 + GetDeviceCaps(Some(hdc), LOGPIXELSX) as u32 } else { // If the process is DPI unaware, then scaling is performed by the OS; we thus return // 96 (scale factor 1.0) to prevent the window from being re-scaled by both the