Skip to content

Commit 20817b0

Browse files
alex-ds13LGUG2Z
authored andcommitted
fix(wm): prevent floating focus change event infinite loops
This commit stops the `FocusChange` event from focusing a floating window when it is the one emitting said `FocusChange` event, since it's not needed and is the cause of some flicker bugs reported! If that floating window was the one emitting the `FocusChange` event then it means it is already the foreground window, and there is no reason for us to focus the window again (since that will create an infinite loop of events). When the window emitting this event is not floating we don't try to focus the window, we simply set the focus index for the container of that window and the focused index for the window of that container. Except in one case, which is if the workspace has a monocle container, then it does focus a window, it focuses the monocle window to make sure the monocle keeps showing in front of everything and doesn't let anything come in front of it.
1 parent 394709e commit 20817b0

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

komorebi/src/process_event.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,7 @@ impl WindowManager {
285285
workspace.set_layer(WorkspaceLayer::Tiling);
286286
}
287287
Some(idx) => {
288-
if let Some(window) = workspace.floating_windows().get(idx) {
289-
window.focus(false)?;
288+
if let Some(_window) = workspace.floating_windows().get(idx) {
290289
workspace.set_layer(WorkspaceLayer::Floating);
291290
}
292291
}

0 commit comments

Comments
 (0)