fix(wm): ensure window restore on stackbar click

This commit ensures that a window is restored before a focus call is
made on it when switching windows in a stack by using a window's tab in
the stackbar.

This handles the issue where two clicks are required to trigger a layout
update the first time a window that is not currently at the top of the
stack is brought to the front via a stackbar click.
This commit is contained in:
LGUG2Z
2024-04-13 22:38:39 -07:00
parent efa562de5c
commit 4ba3125dde
2 changed files with 2 additions and 3 deletions

View File

@@ -55,8 +55,6 @@ use komorebi_core::Rect;
use crate::window::Window;
use crate::windows_api::WindowsApi;
use crate::winevent_listener::event_tx;
use crate::WindowManagerEvent;
use crate::DEFAULT_CONTAINER_PADDING;
use crate::STACKBAR_FOCUSED_TEXT_COLOUR;
use crate::STACKBAR_TAB_BACKGROUND_COLOUR;
@@ -115,6 +113,7 @@ impl Stackbar {
if x >= left && x <= right && y >= top && y <= bottom {
let window = Window { hwnd: *win_hwnd };
window.restore();
if let Err(err) = window.focus(false) {
tracing::error!("Stackbar focus error: HWND:{} {}", *win_hwnd, err);
}

View File

@@ -323,7 +323,7 @@ impl Window {
return Ok(false);
}
let is_cloaked = self.is_cloaked()?;
let is_cloaked = self.is_cloaked().unwrap_or_default();
let mut allow_cloaked = false;