aboutsummaryrefslogtreecommitdiff
path: root/src/window
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2025-02-11 09:52:05 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2025-02-11 10:31:12 +0300
commit29b7a41692b9773ac939c2b18fe9dbf6735cfef1 (patch)
treea0a1ec4a15566ed6eb8d0bcb2ef8dd4c96674a8b /src/window
parent216753678a9fc51b0d639b6ed374e965d9eda301 (diff)
downloadniri-29b7a41692b9773ac939c2b18fe9dbf6735cfef1.tar.gz
niri-29b7a41692b9773ac939c2b18fe9dbf6735cfef1.tar.bz2
niri-29b7a41692b9773ac939c2b18fe9dbf6735cfef1.zip
Implement is-window-cast-target window rule matcher
Diffstat (limited to 'src/window')
-rw-r--r--src/window/mapped.rs17
-rw-r--r--src/window/mod.rs13
2 files changed, 30 insertions, 0 deletions
diff --git a/src/window/mapped.rs b/src/window/mapped.rs
index b5bf8afb..055f2cc5 100644
--- a/src/window/mapped.rs
+++ b/src/window/mapped.rs
@@ -80,6 +80,9 @@ pub struct Mapped {
/// Whether this window is floating.
is_floating: bool,
+ /// Whether this window is a target of a window cast.
+ is_window_cast_target: bool,
+
/// Whether this window should ignore opacity set through window rules.
ignore_opacity_window_rule: bool,
@@ -188,6 +191,7 @@ impl Mapped {
is_focused: false,
is_active_in_column: true,
is_floating: false,
+ is_window_cast_target: false,
ignore_opacity_window_rule: false,
block_out_buffer: RefCell::new(SolidColorBuffer::new((0., 0.), [0., 0., 0., 1.])),
animate_next_configure: false,
@@ -260,6 +264,10 @@ impl Mapped {
self.is_floating
}
+ pub fn is_window_cast_target(&self) -> bool {
+ self.is_window_cast_target
+ }
+
pub fn toggle_ignore_opacity_window_rule(&mut self) {
self.ignore_opacity_window_rule = !self.ignore_opacity_window_rule;
}
@@ -273,6 +281,15 @@ impl Mapped {
self.need_to_recompute_rules = true;
}
+ pub fn set_is_window_cast_target(&mut self, value: bool) {
+ if self.is_window_cast_target == value {
+ return;
+ }
+
+ self.is_window_cast_target = value;
+ self.need_to_recompute_rules = true;
+ }
+
fn render_snapshot(&self, renderer: &mut GlesRenderer) -> LayoutElementRenderSnapshot {
let _span = tracy_client::span!("Mapped::render_snapshot");
diff --git a/src/window/mod.rs b/src/window/mod.rs
index 10aecbfe..41f2182b 100644
--- a/src/window/mod.rs
+++ b/src/window/mod.rs
@@ -146,6 +146,13 @@ impl<'a> WindowRef<'a> {
WindowRef::Mapped(mapped) => mapped.is_floating(),
}
}
+
+ pub fn is_window_cast_target(self) -> bool {
+ match self {
+ WindowRef::Unmapped(_) => false,
+ WindowRef::Mapped(mapped) => mapped.is_window_cast_target(),
+ }
+ }
}
impl ResolvedWindowRules {
@@ -446,5 +453,11 @@ fn window_matches(window: WindowRef, role: &XdgToplevelSurfaceRoleAttributes, m:
}
}
+ if let Some(is_window_cast_target) = m.is_window_cast_target {
+ if window.is_window_cast_target() != is_window_cast_target {
+ return false;
+ }
+ }
+
true
}