Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update webview2 and windows #1454

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changes/webview2-0.35-windows-0.59.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
wry: minor
---

Updated `webview2-com` to `0.35`, `windows` to `0.59`.
7 changes: 3 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ pub struct WebViewAttributes<'a> {
pub background_throttling: Option<BackgroundThrottlingPolicy>,
}

impl<'a> Default for WebViewAttributes<'a> {
impl Default for WebViewAttributes<'_> {
fn default() -> Self {
Self {
id: Default::default(),
Expand Down
11 changes: 7 additions & 4 deletions src/webview2/drag_drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -94,7 +94,10 @@ impl DragDropTarget {
}
}

unsafe fn iterate_filenames<F>(data_obj: Option<&IDataObject>, mut callback: F) -> Option<HDROP>
unsafe fn iterate_filenames<F>(
data_obj: windows_core::Ref<'_, IDataObject>,
mut callback: F,
) -> Option<HDROP>
where
F: FnMut(PathBuf),
{
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
29 changes: 12 additions & 17 deletions src/webview2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,17 +237,17 @@ 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,
)?
};

unsafe {
SetWindowPos(
hwnd,
HWND_TOP,
Some(HWND_TOP),
0,
0,
0,
Expand Down Expand Up @@ -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 {
Expand All @@ -1067,7 +1067,7 @@ impl InnerWebView {
if msg == *EXEC_MSG_ID {
let mut function: Box<Box<dyn FnMut()>> = 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);
}

Expand Down Expand Up @@ -1139,7 +1139,7 @@ impl InnerWebView {
if (*controller).ParentWindow(&mut hwnd).is_ok() {
let _ = SetWindowPos(
hwnd,
HWND::default(),
None,
0,
0,
width,
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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 {
Expand All @@ -1348,7 +1343,7 @@ impl InnerWebView {

SetWindowPos(
self.hwnd,
HWND::default(),
None,
position.x,
position.y,
size.width,
Expand Down Expand Up @@ -1436,7 +1431,7 @@ impl InnerWebView {
unsafe {
let parent = *self.parent.borrow();
if parent != HWND::default() {
SetFocus(parent)?;
SetFocus(Some(parent))?;
}
}

Expand Down Expand Up @@ -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());
Expand Down
4 changes: 2 additions & 2 deletions src/webview2/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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
Expand Down
Loading