fix(wm): cycle stack focus w/ mff disabled

This commit ensures that the focus changes to the appropriate window
when a container stack is being cycled through by a user who has
disabled the mouse_follows_focus feature.

fix #680
This commit is contained in:
LGUG2Z
2024-02-24 13:01:41 -08:00
parent 0160e8eeeb
commit a6deeef717
2 changed files with 23 additions and 9 deletions

View File

@@ -866,6 +866,20 @@ impl WindowManager {
}
}
// if we passed false for follow_focus
if !follow_focus
// and we have a stack with >1 windows
&& self.focused_container_mut()?.windows().len() > 1
// and we don't have a maxed window
&& self.focused_workspace()?.maximized_window().is_none()
// and we don't have a monocle container
&& self.focused_workspace()?.monocle_container().is_none()
{
if let Ok(window) = self.focused_window_mut() {
window.focus(self.mouse_follows_focus)?;
}
};
Ok(())
}

View File

@@ -239,9 +239,9 @@ pub extern "system" fn hidden_window(
match message {
WM_DISPLAYCHANGE => {
let event_type = WindowManagerEvent::DisplayChange(Window { hwnd: window.0 });
winevent_listener::event_tx()
.send(event_type)
.expect("could not send message on winevent_listener::event_tx");
winevent_listener::event_tx()
.send(event_type)
.expect("could not send message on winevent_listener::event_tx");
LRESULT(0)
}
@@ -252,9 +252,9 @@ pub extern "system" fn hidden_window(
|| wparam.0 as u32 == SPI_ICONVERTICALSPACING.0
{
let event_type = WindowManagerEvent::DisplayChange(Window { hwnd: window.0 });
winevent_listener::event_tx()
.send(event_type)
.expect("could not send message on winevent_listener::event_tx");
winevent_listener::event_tx()
.send(event_type)
.expect("could not send message on winevent_listener::event_tx");
}
LRESULT(0)
}
@@ -263,9 +263,9 @@ pub extern "system" fn hidden_window(
#[allow(clippy::cast_possible_truncation)]
if wparam.0 as u32 == DBT_DEVNODES_CHANGED {
let event_type = WindowManagerEvent::DisplayChange(Window { hwnd: window.0 });
winevent_listener::event_tx()
.send(event_type)
.expect("could not send message on winevent_listener::event_tx");
winevent_listener::event_tx()
.send(event_type)
.expect("could not send message on winevent_listener::event_tx");
}
LRESULT(0)
}