diff options
Diffstat (limited to 'src/window/mapped.rs')
| -rw-r--r-- | src/window/mapped.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/window/mapped.rs b/src/window/mapped.rs index 207140c4..71b6c9da 100644 --- a/src/window/mapped.rs +++ b/src/window/mapped.rs @@ -69,6 +69,9 @@ pub struct Mapped { /// Whether this window is floating. is_floating: bool, + /// Whether this window should ignore opacity set through window rules. + ignore_opacity_window_rule: bool, + /// Buffer to draw instead of the window when it should be blocked out. block_out_buffer: RefCell<SolidColorBuffer>, @@ -167,6 +170,7 @@ impl Mapped { is_focused: false, is_active_in_column: true, is_floating: false, + ignore_opacity_window_rule: false, block_out_buffer: RefCell::new(SolidColorBuffer::new((0., 0.), [0., 0., 0., 1.])), animate_next_configure: false, animate_serials: Vec::new(), @@ -192,6 +196,12 @@ impl Mapped { return false; } + // If the opacity window rule no longer makes the window semitransparent, reset the ignore + // flag to reduce surprises down the line. + if !new_rules.opacity.is_some_and(|o| o < 1.) { + self.ignore_opacity_window_rule = false; + } + self.rules = new_rules; true } @@ -228,6 +238,10 @@ impl Mapped { self.is_floating } + pub fn toggle_ignore_opacity_window_rule(&mut self) { + self.ignore_opacity_window_rule = !self.ignore_opacity_window_rule; + } + pub fn set_is_focused(&mut self, is_focused: bool) { if self.is_focused == is_focused { return; @@ -839,6 +853,10 @@ impl LayoutElement for Mapped { .with_pending_state(|state| state.states.contains(xdg_toplevel::State::Fullscreen)) } + fn is_ignoring_opacity_window_rule(&self) -> bool { + self.ignore_opacity_window_rule + } + fn requested_size(&self) -> Option<Size<i32, Logical>> { self.toplevel().with_pending_state(|state| state.size) } |
