From 7928b33ee086a35ea01e874940b1f193244c6f65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20G=C3=BCnzler?= Date: Wed, 20 Dec 2017 20:28:21 +0100 Subject: [PATCH] Move dimensions and padding into window section --- src/config.rs | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/config.rs b/src/config.rs index 69f32179..96d3ee49 100644 --- a/src/config.rs +++ b/src/config.rs @@ -209,8 +209,19 @@ impl Default for Alpha { } } -#[derive(Debug, Deserialize)] +#[derive(Debug, Copy, Clone, Deserialize)] pub struct WindowConfig { + + /// Initial dimensions + #[serde(default)] + dimensions: Dimensions, + + /// Pixel padding + #[serde(default="default_padding")] + padding: Delta, + + /// Draw the window with title bar / borders + #[serde(default)] decorations: bool, } @@ -223,6 +234,8 @@ impl WindowConfig { impl Default for WindowConfig { fn default() -> Self { WindowConfig{ + dimensions: Default::default(), + padding: default_padding(), decorations: true, } } @@ -235,14 +248,6 @@ pub struct Config { #[serde(default)] env: HashMap, - /// Initial dimensions - #[serde(default)] - dimensions: Dimensions, - - /// Pixel padding - #[serde(default="default_padding")] - padding: Delta, - /// Font configuration #[serde(default)] font: Font, @@ -342,7 +347,6 @@ impl Default for Config { fn default() -> Config { Config { draw_bold_text_with_bright_colors: true, - dimensions: Default::default(), font: Default::default(), render_timer: Default::default(), custom_cursor_colors: false, @@ -359,7 +363,6 @@ impl Default for Config { hide_cursor_when_typing: Default::default(), cursor_style: Default::default(), live_config_reload: true, - padding: default_padding(), window: Default::default(), } } @@ -1146,7 +1149,7 @@ impl Config { } pub fn padding(&self) -> &Delta { - &self.padding + &self.window.padding } #[inline] @@ -1163,7 +1166,7 @@ impl Config { /// Get window dimensions #[inline] pub fn dimensions(&self) -> Dimensions { - self.dimensions + self.window.dimensions } /// Get window config