Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

gpui(windows): Fix clicks to inactive windows not dispatching to the clicked window (#45237)

Lukas Wirthcebbf77491fa
diff --git a/crates/gpui/src/platform/windows/events.rs b/crates/gpui/src/platform/windows/events.rs
index e6fa6006eb9..f224a1bf3c4 100644
--- a/crates/gpui/src/platform/windows/events.rs
+++ b/crates/gpui/src/platform/windows/events.rs
@@ -40,6 +40,11 @@ impl WindowsWindowInner {
lparam: LPARAM,
) -> LRESULT {
let handled = match msg {
+ // eagerly activate the window, so calls to `active_window` will work correctly
+ WM_MOUSEACTIVATE => {
+ unsafe { SetActiveWindow(handle).log_err() };
+ None
+ }
WM_ACTIVATE => self.handle_activate_msg(wparam),
WM_CREATE => self.handle_create_msg(handle),
WM_MOVE => self.handle_move_msg(handle, lparam),
diff --git a/crates/gpui/src/window.rs b/crates/gpui/src/window.rs
index 840f2223fcc..2ccd7edac86 100644
--- a/crates/gpui/src/window.rs
+++ b/crates/gpui/src/window.rs
@@ -4966,7 +4966,7 @@ impl<V: 'static> From<WindowHandle<V>> for AnyWindowHandle {
}
/// A handle to a window with any root view type, which can be downcast to a window with a specific root view type.
-#[derive(Copy, Clone, PartialEq, Eq, Hash)]
+#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
pub struct AnyWindowHandle {
pub(crate) id: WindowId,
state_type: TypeId,