From 46621fc5d51e4330079959bb0ed46616e5ac3da6 Mon Sep 17 00:00:00 2001 From: SmileSky Date: Tue, 14 Jan 2025 18:05:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Fix=20errors=20and=20warnings=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: SmileSky --- src/webview2/mod.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/webview2/mod.rs b/src/webview2/mod.rs index bf0691380..dcc338ae3 100644 --- a/src/webview2/mod.rs +++ b/src/webview2/mod.rs @@ -179,8 +179,8 @@ impl InnerWebView { if msg == WM_SETFOCUS { // Fix https://github.com/DioxusLabs/dioxus/issues/2900 // Get the first child window of the window - let child = GetWindow(hwnd, GW_CHILD).unwrap_or_default(); - if child != HWND::default() { + let child = GetWindow(hwnd, GW_CHILD).ok(); + if child.is_some() { // Set focus to the child window(WebView document) let _ = SetFocus(child); } @@ -1681,14 +1681,19 @@ unsafe fn set_background_color( controller: &ICoreWebView2Controller, background_color: RGBA, ) -> Result<()> { - let (R, G, B, mut A) = background_color; - if is_windows_7() || A != 0 { - A = 255; + let (r, g, b, mut a) = background_color; + if is_windows_7() || a != 0 { + a = 255; } let controller2: ICoreWebView2Controller2 = controller.cast()?; controller2 - .SetDefaultBackgroundColor(COREWEBVIEW2_COLOR { R, G, B, A }) + .SetDefaultBackgroundColor(COREWEBVIEW2_COLOR { + R: r, + G: g, + B: b, + A: a, + }) .map_err(Into::into) }