aboutsummaryrefslogtreecommitdiff
path: root/src/window
diff options
context:
space:
mode:
authorTheZoq2 <frans.skarman@protonmail.com>2024-04-22 22:51:52 +0200
committerIvan Molodetskikh <yalterz@gmail.com>2024-05-11 10:42:49 +0400
commit47a8e75fd585e351dd2846a58152a7766403ca11 (patch)
treebf8b53c9befcb935a9a228a09db8649d58ba7751 /src/window
parent6d9cfe28823e88df68f172496c928bd366777ad1 (diff)
downloadniri-47a8e75fd585e351dd2846a58152a7766403ca11.tar.gz
niri-47a8e75fd585e351dd2846a58152a7766403ca11.tar.bz2
niri-47a8e75fd585e351dd2846a58152a7766403ca11.zip
Add is_active_in_column
Add missing ``` Fix tests
Diffstat (limited to 'src/window')
-rw-r--r--src/window/mapped.rs10
-rw-r--r--src/window/mod.rs13
2 files changed, 23 insertions, 0 deletions
diff --git a/src/window/mapped.rs b/src/window/mapped.rs
index 4b31da22..bdb62df8 100644
--- a/src/window/mapped.rs
+++ b/src/window/mapped.rs
@@ -49,6 +49,9 @@ pub struct Mapped {
/// Whether this window has the keyboard focus.
is_focused: bool,
+ /// Whether this window is the active window in its column.
+ pub is_active_in_column: bool,
+
/// Buffer to draw instead of the window when it should be blocked out.
block_out_buffer: RefCell<SolidColorBuffer>,
@@ -102,6 +105,7 @@ impl Mapped {
rules,
need_to_recompute_rules: false,
is_focused: false,
+ is_active_in_column: false,
block_out_buffer: RefCell::new(SolidColorBuffer::new((0, 0), [0., 0., 0., 1.])),
animate_next_configure: false,
animate_serials: Vec::new(),
@@ -458,6 +462,12 @@ impl LayoutElement for Mapped {
self.need_to_recompute_rules |= changed;
}
+ fn set_active_in_column(&mut self, active: bool) {
+ let changed = self.is_active_in_column != active;
+ self.is_active_in_column = active;
+ self.need_to_recompute_rules |= changed;
+ }
+
fn set_bounds(&self, bounds: Size<i32, Logical>) {
self.toplevel().with_pending_state(|state| {
state.bounds = Some(bounds);
diff --git a/src/window/mod.rs b/src/window/mod.rs
index 3af9eebd..4ccbb111 100644
--- a/src/window/mod.rs
+++ b/src/window/mod.rs
@@ -85,6 +85,13 @@ impl<'a> WindowRef<'a> {
WindowRef::Mapped(mapped) => mapped.is_focused(),
}
}
+
+ pub fn is_active_in_column(self) -> bool {
+ match self {
+ WindowRef::Unmapped(_) => false,
+ WindowRef::Mapped(mapped) => mapped.is_active_in_column,
+ }
+ }
}
impl ResolvedWindowRules {
@@ -254,5 +261,11 @@ fn window_matches(window: WindowRef, role: &XdgToplevelSurfaceRoleAttributes, m:
}
}
+ if let Some(is_active_in_column) = m.is_active_in_column {
+ if window.is_active_in_column() != is_active_in_column {
+ return false;
+ }
+ }
+
true
}