From 2c6a8a3895158aca192712db8eb6d0dfe13a2998 Mon Sep 17 00:00:00 2001 From: MaxVerevkin Date: Fri, 3 Feb 2023 17:47:53 +0200 Subject: fix margins for all directions --- src/config.rs | 2 +- src/state.rs | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/config.rs b/src/config.rs index 33cb4f7..a65269f 100644 --- a/src/config.rs +++ b/src/config.rs @@ -103,7 +103,7 @@ impl Config { } } -#[derive(Deserialize, Debug, Clone, Copy)] +#[derive(Deserialize, Debug, Clone, Copy, PartialEq, Eq)] #[serde(rename_all = "lowercase")] pub enum Position { Top, diff --git a/src/state.rs b/src/state.rs index 5884580..b4123d3 100644 --- a/src/state.rs +++ b/src/state.rs @@ -1,3 +1,4 @@ +use crate::config::Position; use crate::cursor::CursorTheme; use crate::protocol::*; use crate::wm_info_provider::*; @@ -178,8 +179,11 @@ impl State { layer_surface.set_exclusive_zone( conn, (self.shared_state.config.height) as i32 - + self.shared_state.config.margin_top - + self.shared_state.config.margin_bottom, + + if config.position == Position::Top { + self.shared_state.config.margin_bottom + } else { + self.shared_state.config.margin_top + }, ); // Note: layer_surface is commited when we receive the scale factor of this output -- cgit v1.3.1