diff options
author | Kirill Chibisov <contact@kchibisov.com> | 2023-02-18 23:12:05 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-18 23:12:05 +0300 |
commit | c682a357ec78f13d2e6222c83abfa9071d8a18f3 (patch) | |
tree | cef7896d86400b1d13ae562b95d9babe00981c33 | |
parent | bfa3c4a09d656013ae1590571c4d69a96bcbb90c (diff) | |
download | alacritty-c682a357ec78f13d2e6222c83abfa9071d8a18f3.tar.gz alacritty-c682a357ec78f13d2e6222c83abfa9071d8a18f3.zip |
Add `window.resize_increments` config option
Given how bugged the resize increments are on X11, it's better to
disable it by default.
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | alacritty.yml | 5 | ||||
-rw-r--r-- | alacritty/src/config/window.rs | 4 | ||||
-rw-r--r-- | alacritty/src/display/mod.rs | 8 | ||||
-rw-r--r-- | alacritty/src/window_context.rs | 3 |
5 files changed, 18 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 701d9631..4b82d1c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Support for fractional scaling on Wayland with wp-fractional-scale protocol - Support for running on GLES context - Touchscreen input for click/scroll/select/zoom +- `window.resize_increments` config option, disabled by default ### Changed diff --git a/alacritty.yml b/alacritty.yml index d92b1f76..76047d2a 100644 --- a/alacritty.yml +++ b/alacritty.yml @@ -101,6 +101,11 @@ # auto pick-up. Set this to `None` to use the default theme variant. #decorations_theme_variant: None + # Resize increments + # + # Prefer resizing window by discrete steps equal to cell dimensions. + #resize_increments: false + # Make `Option` key behave as `Alt` (macOS only): # - OnlyLeft # - OnlyRight diff --git a/alacritty/src/config/window.rs b/alacritty/src/config/window.rs index 476172d1..98bc18b6 100644 --- a/alacritty/src/config/window.rs +++ b/alacritty/src/config/window.rs @@ -53,6 +53,9 @@ pub struct WindowConfig { #[cfg(target_os = "macos")] pub option_as_alt: OptionAsAlt, + /// Resize increments. + pub resize_increments: bool, + /// Pixel padding. padding: Delta<u8>, @@ -74,6 +77,7 @@ impl Default for WindowConfig { opacity: Default::default(), padding: Default::default(), dimensions: Default::default(), + resize_increments: Default::default(), #[cfg(target_os = "macos")] option_as_alt: Default::default(), } diff --git a/alacritty/src/display/mod.rs b/alacritty/src/display/mod.rs index 79b8f528..f1757ae6 100644 --- a/alacritty/src/display/mod.rs +++ b/alacritty/src/display/mod.rs @@ -470,7 +470,9 @@ impl Display { } // Set resize increments for the newly created window. - window.set_resize_increments(PhysicalSize::new(cell_width, cell_height)); + if config.window.resize_increments { + window.set_resize_increments(PhysicalSize::new(cell_width, cell_height)); + } window.set_visible(true); @@ -646,7 +648,9 @@ impl Display { new_size.reserve_lines(message_bar_lines + search_lines); // Update resize increments. - self.window.set_resize_increments(PhysicalSize::new(cell_width, cell_height)); + if config.window.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/window_context.rs b/alacritty/src/window_context.rs index 7c2754e0..885d71a4 100644 --- a/alacritty/src/window_context.rs +++ b/alacritty/src/window_context.rs @@ -312,10 +312,11 @@ impl WindowContext { self.display.pending_update.set_font(font); } - // Update display if padding options were changed. + // Update display if either padding options or resize increments were changed. let window_config = &old_config.window; if window_config.padding(1.) != self.config.window.padding(1.) || window_config.dynamic_padding != self.config.window.dynamic_padding + || window_config.resize_increments != self.config.window.resize_increments { self.display.pending_update.dirty = true; } |