aboutsummaryrefslogtreecommitdiff
path: root/src/window
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-03-19 18:22:25 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2024-03-19 18:29:13 +0400
commitdb49deb7fd2fbe805ceec060aa4dec65009ad7a7 (patch)
treeb8f85d4aee4d366643626e97b7f37fa49d93b75b /src/window
parentc61361de3ca4484387f39b067eadc612908560eb (diff)
downloadniri-db49deb7fd2fbe805ceec060aa4dec65009ad7a7.tar.gz
niri-db49deb7fd2fbe805ceec060aa4dec65009ad7a7.tar.bz2
niri-db49deb7fd2fbe805ceec060aa4dec65009ad7a7.zip
Implement draw-border-with-background window rule
Diffstat (limited to 'src/window')
-rw-r--r--src/window/mapped.rs4
-rw-r--r--src/window/mod.rs27
2 files changed, 29 insertions, 2 deletions
diff --git a/src/window/mapped.rs b/src/window/mapped.rs
index 6afd995e..b5caf8e2 100644
--- a/src/window/mapped.rs
+++ b/src/window/mapped.rs
@@ -184,4 +184,8 @@ impl LayoutElement for Mapped {
fn refresh(&self) {
self.window.refresh();
}
+
+ fn rules(&self) -> &ResolvedWindowRules {
+ &self.rules
+ }
}
diff --git a/src/window/mod.rs b/src/window/mod.rs
index 25b3531f..bb6f2151 100644
--- a/src/window/mod.rs
+++ b/src/window/mod.rs
@@ -13,7 +13,7 @@ pub mod unmapped;
pub use unmapped::{InitialConfigureState, Unmapped};
/// Rules fully resolved for a window.
-#[derive(Debug, Default, PartialEq)]
+#[derive(Debug, PartialEq)]
pub struct ResolvedWindowRules {
/// Default width for this window.
///
@@ -39,13 +39,32 @@ pub struct ResolvedWindowRules {
pub max_width: Option<u16>,
/// Extra bound on the maximum window height.
pub max_height: Option<u16>,
+
+ /// Whether or not to draw the border with a solid background.
+ ///
+ /// `None` means using the SSD heuristic.
+ pub draw_border_with_background: Option<bool>,
}
impl ResolvedWindowRules {
+ pub const fn empty() -> Self {
+ Self {
+ default_width: None,
+ open_on_output: None,
+ open_maximized: None,
+ open_fullscreen: None,
+ min_width: None,
+ min_height: None,
+ max_width: None,
+ max_height: None,
+ draw_border_with_background: None,
+ }
+ }
+
pub fn compute(rules: &[WindowRule], toplevel: &ToplevelSurface) -> Self {
let _span = tracy_client::span!("ResolvedWindowRules::compute");
- let mut resolved = ResolvedWindowRules::default();
+ let mut resolved = ResolvedWindowRules::empty();
with_states(toplevel.wl_surface(), |states| {
let role = states
@@ -100,6 +119,10 @@ impl ResolvedWindowRules {
if let Some(x) = rule.max_height {
resolved.max_height = Some(x);
}
+
+ if let Some(x) = rule.draw_border_with_background {
+ resolved.draw_border_with_background = Some(x);
+ }
}
resolved.open_on_output = open_on_output.map(|x| x.to_owned());