From 0884305e43e65a3ac47b6bea8c46c3a653358c08 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Sun, 21 Dec 2025 17:14:23 +0100 Subject: [PATCH] gpui(windows): Don't log incorrect errors on `SetActiveWindow` calls (#45493) The function returns the previous focus handle, which may be null if there is no previous focus. Unfortunately that also overlaps with the error return value, so winapi will hand us a error 0 back in those cases which we log ... Release Notes: - N/A *or* Added/Fixed/Improved ... --- crates/gpui/src/platform/windows/events.rs | 2 +- crates/gpui/src/platform/windows/window.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/gpui/src/platform/windows/events.rs b/crates/gpui/src/platform/windows/events.rs index 1f0a4a0d28c2b266fb8588e4ce54251be010a78d..8d44ba274ea7a3eec2714d83bb6dac63fbac370b 100644 --- a/crates/gpui/src/platform/windows/events.rs +++ b/crates/gpui/src/platform/windows/events.rs @@ -42,7 +42,7 @@ impl WindowsWindowInner { let handled = match msg { // eagerly activate the window, so calls to `active_window` will work correctly WM_MOUSEACTIVATE => { - unsafe { SetActiveWindow(handle).log_err() }; + unsafe { SetActiveWindow(handle).ok() }; None } WM_ACTIVATE => self.handle_activate_msg(wparam), diff --git a/crates/gpui/src/platform/windows/window.rs b/crates/gpui/src/platform/windows/window.rs index 3fcc29ad7864f8e45d27638bef489ffbf03788b2..fa804e3d160a370851701ea0a7600103b66356a8 100644 --- a/crates/gpui/src/platform/windows/window.rs +++ b/crates/gpui/src/platform/windows/window.rs @@ -740,8 +740,8 @@ impl PlatformWindow for WindowsWindow { ShowWindowAsync(hwnd, SW_RESTORE).ok().log_err(); } - SetActiveWindow(hwnd).log_err(); - SetFocus(Some(hwnd)).log_err(); + SetActiveWindow(hwnd).ok(); + SetFocus(Some(hwnd)).ok(); } // premium ragebait by windows, this is needed because the window