diff options
author | Kirill Chibisov <contact@kchibisov.com> | 2023-02-05 11:41:23 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-05 11:41:23 +0300 |
commit | f409f743724207e7a2a4c008ce74ea505ae6bbcf (patch) | |
tree | 34d5a135883dbadf4a9d802554122df841c80a59 | |
parent | 8a838710e37665f5bdeb8c01d2f1d3e6fec976a6 (diff) | |
download | alacritty-f409f743724207e7a2a4c008ce74ea505ae6bbcf.tar.gz alacritty-f409f743724207e7a2a4c008ce74ea505ae6bbcf.zip |
Resize the window by cell dimensions
This should resize window by cell dimensions granularity instead of
using pixels.
Fixes #388.
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | alacritty/src/display/mod.rs | 6 | ||||
-rw-r--r-- | alacritty/src/display/window.rs | 4 |
3 files changed, 11 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index df8c61d6..e3ffe341 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - `window.decorations_theme_variant` could now control theme on macOS and Windows - The IME purpose is now set to `Terminal` which could help with OSK - `window.decorations_theme_variant` is now using `Dark`, `Light`, and `None` values +- Resize increments are now set on macOS and X11 to resize by cell sizes ### Fixed diff --git a/alacritty/src/display/mod.rs b/alacritty/src/display/mod.rs index 605ac3f2..243167b2 100644 --- a/alacritty/src/display/mod.rs +++ b/alacritty/src/display/mod.rs @@ -469,6 +469,9 @@ impl Display { renderer.finish(); } + // Set resize increments for the newly created window. + window.set_resize_increments(PhysicalSize::new(cell_width, cell_height)); + window.set_visible(true); #[allow(clippy::single_match)] @@ -642,6 +645,9 @@ impl Display { let search_lines = usize::from(search_active); new_size.reserve_lines(message_bar_lines + search_lines); + // Update resize increments. + self.window.set_resize_increments(PhysicalSize::new(cell_width, cell_height)); + // Resize PTY. pty_resize_handle.on_resize(new_size.into()); diff --git a/alacritty/src/display/window.rs b/alacritty/src/display/window.rs index 1aee00e4..962f93a1 100644 --- a/alacritty/src/display/window.rs +++ b/alacritty/src/display/window.rs @@ -353,6 +353,10 @@ impl Window { self.window.set_minimized(minimized); } + pub fn set_resize_increments(&self, increments: PhysicalSize<f32>) { + self.window.set_resize_increments(Some(increments)); + } + /// Toggle the window's fullscreen state. pub fn toggle_fullscreen(&self) { self.set_fullscreen(self.window.fullscreen().is_none()); |