mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-03-22 09:29:24 +01:00
feat(wm): listen to event_object_locationchange
This commit adds a new WindowManagerEvent, LocationChange, which allows komorebi to listen to and dispatch events to border_manager when EVENT_OBJECT_LOCATIONCHANGE is emitted by the operating system. This is required because there is no other event which fires on window maximize/unmaximize. fix #1137
This commit is contained in:
@@ -669,6 +669,7 @@ impl WindowManager {
|
||||
}
|
||||
WindowManagerEvent::MouseCapture(..)
|
||||
| WindowManagerEvent::Cloak(..)
|
||||
| WindowManagerEvent::LocationChange(..)
|
||||
| WindowManagerEvent::TitleUpdate(..) => {}
|
||||
};
|
||||
|
||||
@@ -714,6 +715,7 @@ impl WindowManager {
|
||||
if !matches!(
|
||||
event,
|
||||
WindowManagerEvent::Show(WinEvent::ObjectNameChange, _)
|
||||
| WindowManagerEvent::LocationChange(_, _)
|
||||
) {
|
||||
tracing::info!("processed: {}", event.window().to_string());
|
||||
} else {
|
||||
|
||||
@@ -28,6 +28,7 @@ pub enum WindowManagerEvent {
|
||||
Unmanage(Window),
|
||||
Raise(Window),
|
||||
TitleUpdate(WinEvent, Window),
|
||||
LocationChange(WinEvent, Window),
|
||||
}
|
||||
|
||||
impl Display for WindowManagerEvent {
|
||||
@@ -78,6 +79,9 @@ impl Display for WindowManagerEvent {
|
||||
Self::TitleUpdate(winevent, window) => {
|
||||
write!(f, "TitleUpdate (WinEvent: {winevent}, Window: {window})")
|
||||
}
|
||||
Self::LocationChange(winevent, window) => {
|
||||
write!(f, "LocationChange (WinEvent: {winevent}, Window: {window})")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -98,7 +102,8 @@ impl WindowManagerEvent {
|
||||
| Self::Raise(window)
|
||||
| Self::Manage(window)
|
||||
| Self::Unmanage(window)
|
||||
| Self::TitleUpdate(_, window) => window,
|
||||
| Self::TitleUpdate(_, window)
|
||||
| Self::LocationChange(_, window) => window,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,6 +127,7 @@ impl WindowManagerEvent {
|
||||
WindowManagerEvent::Unmanage(_) => "Unmanage",
|
||||
WindowManagerEvent::Raise(_) => "Raise",
|
||||
WindowManagerEvent::TitleUpdate(_, _) => "TitleUpdate",
|
||||
WindowManagerEvent::LocationChange(_, _) => "LocationChange",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,6 +143,7 @@ impl WindowManagerEvent {
|
||||
| WindowManagerEvent::MoveResizeStart(event, _)
|
||||
| WindowManagerEvent::MoveResizeEnd(event, _)
|
||||
| WindowManagerEvent::MouseCapture(event, _)
|
||||
| WindowManagerEvent::LocationChange(event, _)
|
||||
| WindowManagerEvent::TitleUpdate(event, _) => Some(event.to_string()),
|
||||
WindowManagerEvent::Manage(_)
|
||||
| WindowManagerEvent::Unmanage(_)
|
||||
@@ -202,6 +209,7 @@ impl WindowManagerEvent {
|
||||
Option::from(Self::TitleUpdate(winevent, window))
|
||||
}
|
||||
}
|
||||
WinEvent::ObjectLocationChange => Option::from(Self::LocationChange(winevent, window)),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user