mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-03-22 01:19:21 +01:00
fix(wm): hide border when unmanged windows are focused
Previously we were dropping events that don't pertain to managed windows, with one exception in should_manage that could probably do with further cleanup (DisplayChange). This first step fixes the latent border window problem, where we would retain a border window when the last managed window was closed and focus transitioned to an unmanaged window.
This commit is contained in:
@@ -65,6 +65,26 @@ impl WindowManager {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let should_manage = event.window().should_manage(Some(*event))?;
|
||||
|
||||
// Hide or reposition the window based on whether the target is managed.
|
||||
if BORDER_ENABLED.load(Ordering::SeqCst) {
|
||||
if let WindowManagerEvent::FocusChange(_, window) = event {
|
||||
let border_window = Border::from(BORDER_HWND.load(Ordering::SeqCst));
|
||||
if should_manage {
|
||||
border_window.set_position(*window, true)?;
|
||||
} else {
|
||||
border_window.hide()?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// All event handlers below this point should only be processed if the event is
|
||||
// related to a window that should be managed by the WindowManager.
|
||||
if !should_manage {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if let Some(virtual_desktop_id) = &self.virtual_desktop_id {
|
||||
if let Some(id) = current_virtual_desktop() {
|
||||
if id != *virtual_desktop_id {
|
||||
|
||||
@@ -198,13 +198,9 @@ pub extern "system" fn win_event_hook(
|
||||
Some(event) => event,
|
||||
};
|
||||
|
||||
if let Ok(should_manage) = window.should_manage(Option::from(event_type)) {
|
||||
if should_manage {
|
||||
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");
|
||||
}
|
||||
|
||||
pub extern "system" fn border_window(
|
||||
|
||||
Reference in New Issue
Block a user