diff options
author | Robert Günzler <r@gnzler.io> | 2017-12-17 08:23:49 +0100 |
---|---|---|
committer | Robert Günzler <r@gnzler.io> | 2017-12-17 08:23:49 +0100 |
commit | 46a1ee72267c0979e980607098ce4ef00a3db1ac (patch) | |
tree | dd4acf4432709d3cb2a13a713cc169c21a9014b2 | |
parent | 6a1bed0a71ff6a963d9b4535a1ac01727d3ae435 (diff) | |
download | alacritty-46a1ee72267c0979e980607098ce4ef00a3db1ac.tar.gz alacritty-46a1ee72267c0979e980607098ce4ef00a3db1ac.zip |
Add 'borderless' option
Until winit gives us more capabilities in regard to window decorations
this implements a simple switch that renders the window without any
title bar or border
-rw-r--r-- | src/config.rs | 10 | ||||
-rw-r--r-- | src/display.rs | 2 | ||||
-rw-r--r-- | src/window.rs | 6 |
3 files changed, 15 insertions, 3 deletions
diff --git a/src/config.rs b/src/config.rs index 48fcda7a..a22c1653 100644 --- a/src/config.rs +++ b/src/config.rs @@ -247,6 +247,10 @@ pub struct Config { #[serde(default)] background_opacity: Alpha, + /// Should draw window without borders + #[serde(default)] + borderless: bool, + /// Keybindings #[serde(default="default_key_bindings")] key_bindings: Vec<KeyBinding>, @@ -337,6 +341,7 @@ impl Default for Config { cursor_style: Default::default(), live_config_reload: true, padding: default_padding(), + borderless: false, } } } @@ -1105,6 +1110,11 @@ impl Config { self.background_opacity } + #[inline] + pub fn borderless(&self) -> bool { + self.borderless + } + pub fn key_bindings(&self) -> &[KeyBinding] { &self.key_bindings[..] } diff --git a/src/display.rs b/src/display.rs index 14c5a66d..f0d2a3d0 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)?; + let mut window = Window::new(&options.title, config.borderless())?; // 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 486bd590..5dfcdcd6 100644 --- a/src/window.rs +++ b/src/window.rs @@ -183,14 +183,16 @@ impl Window { /// /// This creates a window and fully initializes a window. pub fn new( - title: &str + title: &str, + borderless: bool ) -> Result<Window> { let event_loop = EventsLoop::new(); Window::platform_window_init(); let window = WindowBuilder::new() .with_title(title) - .with_transparency(true); + .with_transparency(true) + .with_decorations(!borderless); let context = ContextBuilder::new() .with_vsync(true); let window = ::glutin::GlWindow::new(window, context, &event_loop)?; |