mirror of
https://github.com/alacritty/alacritty.git
synced 2024-11-18 13:55:23 -05:00
Add window.resize_increments
config option
Given how bugged the resize increments are on X11, it's better to disable it by default.
This commit is contained in:
parent
1a6359ed47
commit
ae90338bb6
5 changed files with 18 additions and 3 deletions
|
@ -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 fractional scaling on Wayland with wp-fractional-scale protocol
|
||||||
- Support for running on GLES context
|
- Support for running on GLES context
|
||||||
- Touchscreen input for click/scroll/select/zoom
|
- Touchscreen input for click/scroll/select/zoom
|
||||||
|
- `window.resize_increments` config option, disabled by default
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,11 @@
|
||||||
# auto pick-up. Set this to `None` to use the default theme variant.
|
# auto pick-up. Set this to `None` to use the default theme variant.
|
||||||
#decorations_theme_variant: None
|
#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):
|
# Make `Option` key behave as `Alt` (macOS only):
|
||||||
# - OnlyLeft
|
# - OnlyLeft
|
||||||
# - OnlyRight
|
# - OnlyRight
|
||||||
|
|
|
@ -53,6 +53,9 @@ pub struct WindowConfig {
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
pub option_as_alt: OptionAsAlt,
|
pub option_as_alt: OptionAsAlt,
|
||||||
|
|
||||||
|
/// Resize increments.
|
||||||
|
pub resize_increments: bool,
|
||||||
|
|
||||||
/// Pixel padding.
|
/// Pixel padding.
|
||||||
padding: Delta<u8>,
|
padding: Delta<u8>,
|
||||||
|
|
||||||
|
@ -74,6 +77,7 @@ impl Default for WindowConfig {
|
||||||
opacity: Default::default(),
|
opacity: Default::default(),
|
||||||
padding: Default::default(),
|
padding: Default::default(),
|
||||||
dimensions: Default::default(),
|
dimensions: Default::default(),
|
||||||
|
resize_increments: Default::default(),
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
option_as_alt: Default::default(),
|
option_as_alt: Default::default(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -470,7 +470,9 @@ impl Display {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set resize increments for the newly created window.
|
// Set resize increments for the newly created window.
|
||||||
|
if config.window.resize_increments {
|
||||||
window.set_resize_increments(PhysicalSize::new(cell_width, cell_height));
|
window.set_resize_increments(PhysicalSize::new(cell_width, cell_height));
|
||||||
|
}
|
||||||
|
|
||||||
window.set_visible(true);
|
window.set_visible(true);
|
||||||
|
|
||||||
|
@ -646,7 +648,9 @@ impl Display {
|
||||||
new_size.reserve_lines(message_bar_lines + search_lines);
|
new_size.reserve_lines(message_bar_lines + search_lines);
|
||||||
|
|
||||||
// Update resize increments.
|
// Update resize increments.
|
||||||
|
if config.window.resize_increments {
|
||||||
self.window.set_resize_increments(PhysicalSize::new(cell_width, cell_height));
|
self.window.set_resize_increments(PhysicalSize::new(cell_width, cell_height));
|
||||||
|
}
|
||||||
|
|
||||||
// Resize PTY.
|
// Resize PTY.
|
||||||
pty_resize_handle.on_resize(new_size.into());
|
pty_resize_handle.on_resize(new_size.into());
|
||||||
|
|
|
@ -312,10 +312,11 @@ impl WindowContext {
|
||||||
self.display.pending_update.set_font(font);
|
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;
|
let window_config = &old_config.window;
|
||||||
if window_config.padding(1.) != self.config.window.padding(1.)
|
if window_config.padding(1.) != self.config.window.padding(1.)
|
||||||
|| window_config.dynamic_padding != self.config.window.dynamic_padding
|
|| window_config.dynamic_padding != self.config.window.dynamic_padding
|
||||||
|
|| window_config.resize_increments != self.config.window.resize_increments
|
||||||
{
|
{
|
||||||
self.display.pending_update.dirty = true;
|
self.display.pending_update.dirty = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue