mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-07-09 06:25:23 +02: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::MouseCapture(..)
|
||||||
| WindowManagerEvent::Cloak(..)
|
| WindowManagerEvent::Cloak(..)
|
||||||
|
| WindowManagerEvent::LocationChange(..)
|
||||||
| WindowManagerEvent::TitleUpdate(..) => {}
|
| WindowManagerEvent::TitleUpdate(..) => {}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -714,6 +715,7 @@ impl WindowManager {
|
|||||||
if !matches!(
|
if !matches!(
|
||||||
event,
|
event,
|
||||||
WindowManagerEvent::Show(WinEvent::ObjectNameChange, _)
|
WindowManagerEvent::Show(WinEvent::ObjectNameChange, _)
|
||||||
|
| WindowManagerEvent::LocationChange(_, _)
|
||||||
) {
|
) {
|
||||||
tracing::info!("processed: {}", event.window().to_string());
|
tracing::info!("processed: {}", event.window().to_string());
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ pub enum WindowManagerEvent {
|
|||||||
Unmanage(Window),
|
Unmanage(Window),
|
||||||
Raise(Window),
|
Raise(Window),
|
||||||
TitleUpdate(WinEvent, Window),
|
TitleUpdate(WinEvent, Window),
|
||||||
|
LocationChange(WinEvent, Window),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for WindowManagerEvent {
|
impl Display for WindowManagerEvent {
|
||||||
@@ -78,6 +79,9 @@ impl Display for WindowManagerEvent {
|
|||||||
Self::TitleUpdate(winevent, window) => {
|
Self::TitleUpdate(winevent, window) => {
|
||||||
write!(f, "TitleUpdate (WinEvent: {winevent}, Window: {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::Raise(window)
|
||||||
| Self::Manage(window)
|
| Self::Manage(window)
|
||||||
| Self::Unmanage(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::Unmanage(_) => "Unmanage",
|
||||||
WindowManagerEvent::Raise(_) => "Raise",
|
WindowManagerEvent::Raise(_) => "Raise",
|
||||||
WindowManagerEvent::TitleUpdate(_, _) => "TitleUpdate",
|
WindowManagerEvent::TitleUpdate(_, _) => "TitleUpdate",
|
||||||
|
WindowManagerEvent::LocationChange(_, _) => "LocationChange",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,6 +143,7 @@ impl WindowManagerEvent {
|
|||||||
| WindowManagerEvent::MoveResizeStart(event, _)
|
| WindowManagerEvent::MoveResizeStart(event, _)
|
||||||
| WindowManagerEvent::MoveResizeEnd(event, _)
|
| WindowManagerEvent::MoveResizeEnd(event, _)
|
||||||
| WindowManagerEvent::MouseCapture(event, _)
|
| WindowManagerEvent::MouseCapture(event, _)
|
||||||
|
| WindowManagerEvent::LocationChange(event, _)
|
||||||
| WindowManagerEvent::TitleUpdate(event, _) => Some(event.to_string()),
|
| WindowManagerEvent::TitleUpdate(event, _) => Some(event.to_string()),
|
||||||
WindowManagerEvent::Manage(_)
|
WindowManagerEvent::Manage(_)
|
||||||
| WindowManagerEvent::Unmanage(_)
|
| WindowManagerEvent::Unmanage(_)
|
||||||
@@ -202,6 +209,7 @@ impl WindowManagerEvent {
|
|||||||
Option::from(Self::TitleUpdate(winevent, window))
|
Option::from(Self::TitleUpdate(winevent, window))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
WinEvent::ObjectLocationChange => Option::from(Self::LocationChange(winevent, window)),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user