1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-30 06:03:39 +03:00

wayland: set minimum increment size to 1x1 cells

This commit is contained in:
Jeffrey Knockel 2024-01-24 19:19:54 -05:00 committed by Wez Furlong
parent b0193850be
commit 4546133d35

View File

@ -23,6 +23,7 @@ use raw_window_handle::{
use smithay_client_toolkit as toolkit;
use std::any::Any;
use std::cell::RefCell;
use std::cmp::max;
use std::convert::TryInto;
use std::io::Read;
use std::os::unix::io::AsRawFd;
@ -669,8 +670,16 @@ impl WaylandWindowInner {
if self.window_state.can_resize() {
if let Some(incr) = self.resize_increments {
let desired_pixel_width = pixel_width - (pixel_width % incr.x as i32);
let desired_pixel_height = pixel_height - (pixel_height % incr.y as i32);
let min_width = incr.base_width + incr.x;
let min_height = incr.base_height + incr.y;
let desired_pixel_width = max(
pixel_width - (pixel_width % incr.x as i32),
min_width as i32,
);
let desired_pixel_height = max(
pixel_height - (pixel_height % incr.y as i32),
min_height as i32,
);
w = self.pixels_to_surface(desired_pixel_width) as u32;
h = self.pixels_to_surface(desired_pixel_height) as u32;
pixel_width = self.surface_to_pixels(w.try_into().unwrap());