diff options
author | Tuomas Siipola <siiptuo@kapsi.fi> | 2017-05-06 08:45:23 -0700 |
---|---|---|
committer | Joe Wilm <jwilm@users.noreply.github.com> | 2017-05-06 12:53:54 -0700 |
commit | 9316771f64842533181cfb04a27aa9ae809cc435 (patch) | |
tree | 364cf490246fba9d86bc02ce67aeda43a1610f48 /src/display.rs | |
parent | 149fbaef09a56613c72855bc60355c7848256500 (diff) | |
download | alacritty-9316771f64842533181cfb04a27aa9ae809cc435.tar.gz alacritty-9316771f64842533181cfb04a27aa9ae809cc435.zip |
Add window padding option
Padding can be configured by using the `padding` field in the config
file, like so:
padding:
x: 2
y: 2
which would result in a 2px padding within each side of the window.
Diffstat (limited to 'src/display.rs')
-rw-r--r-- | src/display.rs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/display.rs b/src/display.rs index c2636e7e..73bb0fce 100644 --- a/src/display.rs +++ b/src/display.rs @@ -149,7 +149,7 @@ impl Display { let rasterizer = font::Rasterizer::new(dpi.x(), dpi.y(), dpr, config.use_thin_strokes())?; // Create renderer - let mut renderer = QuadRenderer::new(size)?; + let mut renderer = QuadRenderer::new(&config, size)?; // Initialize glyph cache let glyph_cache = { @@ -182,15 +182,21 @@ impl Display { let size = Size { width: Pixels(width), height: Pixels(height) }; info!("set_inner_size: {}", size); - window.set_inner_size(size); - renderer.resize(*size.width as _, *size.height as _); + let viewport_size = Size { + width: Pixels(width + 2 * config.padding().x as u32), + height: Pixels(width + 2 * config.padding().y as u32), + }; + window.set_inner_size(&viewport_size); + renderer.resize(viewport_size.width.0 as _, viewport_size.height.0 as _); info!("Cell Size: ({} x {})", cell_width, cell_height); let size_info = SizeInfo { - width: *size.width as f32, - height: *size.height as f32, + width: viewport_size.width.0 as f32, + height: viewport_size.height.0 as f32, cell_width: cell_width as f32, - cell_height: cell_height as f32 + cell_height: cell_height as f32, + padding_x: config.padding().x.floor(), + padding_y: config.padding().y.floor(), }; // Channel for resize events |