mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-23 02:05:33 +07:00
Implement is-window-cast-target window rule matcher
This commit is contained in:
+22
-3
@@ -642,13 +642,18 @@ impl State {
|
||||
self.niri.refresh_idle_inhibit();
|
||||
self.refresh_pointer_contents();
|
||||
foreign_toplevel::refresh(self);
|
||||
|
||||
#[cfg(feature = "xdp-gnome-screencast")]
|
||||
self.niri.refresh_mapped_cast_outputs();
|
||||
// Should happen before refresh_window_rules(), but after anything that can start or stop
|
||||
// screencasts.
|
||||
#[cfg(feature = "xdp-gnome-screencast")]
|
||||
self.niri.refresh_mapped_cast_window_rules();
|
||||
|
||||
self.niri.refresh_window_rules();
|
||||
self.refresh_ipc_outputs();
|
||||
self.ipc_refresh_layout();
|
||||
self.ipc_refresh_keyboard_layout_index();
|
||||
|
||||
#[cfg(feature = "xdp-gnome-screencast")]
|
||||
self.niri.refresh_mapped_cast_outputs();
|
||||
}
|
||||
|
||||
fn notify_blocker_cleared(&mut self) {
|
||||
@@ -3256,6 +3261,20 @@ impl Niri {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "xdp-gnome-screencast")]
|
||||
pub fn refresh_mapped_cast_window_rules(&mut self) {
|
||||
// O(N^2) but should be fine since there aren't many casts usually.
|
||||
self.layout.with_windows_mut(|mapped, _| {
|
||||
let id = mapped.id().get();
|
||||
// Find regardless of cast.is_active.
|
||||
let value = self
|
||||
.casts
|
||||
.iter()
|
||||
.any(|cast| cast.target == (CastTarget::Window { id }));
|
||||
mapped.set_is_window_cast_target(value);
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(feature = "xdp-gnome-screencast")]
|
||||
pub fn refresh_mapped_cast_outputs(&mut self) {
|
||||
use std::collections::hash_map::Entry;
|
||||
|
||||
Reference in New Issue
Block a user