aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2017-12-20 20:12:32 +0100
committerRobert Günzler <r@gnzler.io>2017-12-20 20:12:32 +0100
commitdbc6970aaa453dee9bcc4958036878529977af7f (patch)
treed8f8720d6eba4d986ce6ba64206941824e35a228
parentbcd97679ce40b4d7a114301f674ae8e7a076c511 (diff)
downloadalacritty-dbc6970aaa453dee9bcc4958036878529977af7f.tar.gz
alacritty-dbc6970aaa453dee9bcc4958036878529977af7f.zip
Add new window section to config
Move/rename borderless into window_config as decorations
-rw-r--r--src/config.rs36
-rw-r--r--src/display.rs2
-rw-r--r--src/window.rs6
3 files changed, 33 insertions, 11 deletions
diff --git a/src/config.rs b/src/config.rs
index a22c1653..69f32179 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -209,6 +209,25 @@ impl Default for Alpha {
}
}
+#[derive(Debug, Deserialize)]
+pub struct WindowConfig {
+ decorations: bool,
+}
+
+impl WindowConfig {
+ pub fn decorations(&self) -> bool {
+ self.decorations
+ }
+}
+
+impl Default for WindowConfig {
+ fn default() -> Self {
+ WindowConfig{
+ decorations: true,
+ }
+ }
+}
+
/// Top-level config type
#[derive(Debug, Deserialize)]
pub struct Config {
@@ -247,9 +266,9 @@ pub struct Config {
#[serde(default)]
background_opacity: Alpha,
- /// Should draw window without borders
+ /// Window configuration
#[serde(default)]
- borderless: bool,
+ window: WindowConfig,
/// Keybindings
#[serde(default="default_key_bindings")]
@@ -341,7 +360,7 @@ impl Default for Config {
cursor_style: Default::default(),
live_config_reload: true,
padding: default_padding(),
- borderless: false,
+ window: Default::default(),
}
}
}
@@ -1110,11 +1129,6 @@ impl Config {
self.background_opacity
}
- #[inline]
- pub fn borderless(&self) -> bool {
- self.borderless
- }
-
pub fn key_bindings(&self) -> &[KeyBinding] {
&self.key_bindings[..]
}
@@ -1152,6 +1166,12 @@ impl Config {
self.dimensions
}
+ /// Get window config
+ #[inline]
+ pub fn window(&self) -> &WindowConfig {
+ &self.window
+ }
+
/// Get visual bell config
#[inline]
pub fn visual_bell(&self) -> &VisualBellConfig {
diff --git a/src/display.rs b/src/display.rs
index f0d2a3d0..bfd62c32 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -137,7 +137,7 @@ impl Display {
let render_timer = config.render_timer();
// Create the window where Alacritty will be displayed
- let mut window = Window::new(&options.title, config.borderless())?;
+ let mut window = Window::new(&options.title, config.window())?;
// get window properties for initializing the other subsystems
let mut viewport_size = window.inner_size_pixels()
diff --git a/src/window.rs b/src/window.rs
index 5dfcdcd6..60048774 100644
--- a/src/window.rs
+++ b/src/window.rs
@@ -19,6 +19,8 @@ use gl;
use glutin::{self, EventsLoop, WindowBuilder, Event, MouseCursor, CursorState, ControlFlow, ContextBuilder};
use glutin::GlContext;
+use config::WindowConfig;
+
/// Window errors
#[derive(Debug)]
pub enum Error {
@@ -184,7 +186,7 @@ impl Window {
/// This creates a window and fully initializes a window.
pub fn new(
title: &str,
- borderless: bool
+ window_config: &WindowConfig,
) -> Result<Window> {
let event_loop = EventsLoop::new();
@@ -192,7 +194,7 @@ impl Window {
let window = WindowBuilder::new()
.with_title(title)
.with_transparency(true)
- .with_decorations(!borderless);
+ .with_decorations(window_config.decorations());
let context = ContextBuilder::new()
.with_vsync(true);
let window = ::glutin::GlWindow::new(window, context, &event_loop)?;