mirror of
https://github.com/wez/wezterm.git
synced 2024-11-27 12:23:46 +03:00
gui: try harder to deal with tiling wm resizing + dpi changes
refs: #695
This commit is contained in:
parent
5a9bd14d89
commit
9617c742cf
@ -311,19 +311,6 @@ impl TermWindow {
|
||||
config::wezterm_version(),
|
||||
);
|
||||
self.render_state.replace(gl);
|
||||
/*
|
||||
// Update dimensions: the goal here is to factor in the dpi and font
|
||||
// size adjusted GUI window dimensions and apply those to the dimensions
|
||||
// of the pty in the Mux layer.
|
||||
let dims = self.dimensions.clone();
|
||||
self.apply_dimensions(
|
||||
&dims,
|
||||
Some(resize::RowsAndCols {
|
||||
rows: self.terminal_size.rows as _,
|
||||
cols: self.terminal_size.cols as _,
|
||||
}),
|
||||
);
|
||||
*/
|
||||
}
|
||||
Err(err) => {
|
||||
log::error!("failed to create OpenGLRenderState: {}", err);
|
||||
|
@ -205,8 +205,21 @@ impl super::TermWindow {
|
||||
|
||||
#[allow(clippy::float_cmp)]
|
||||
pub fn scaling_changed(&mut self, dimensions: Dimensions, font_scale: f64, window: &Window) {
|
||||
let scale_changed =
|
||||
dimensions.dpi != self.dimensions.dpi || font_scale != self.fonts.get_font_scale();
|
||||
fn dpi_adjusted(n: usize, dpi: usize) -> f32 {
|
||||
n as f32 / dpi as f32
|
||||
}
|
||||
|
||||
// Distinguish between eg: dpi being detected as double the initial dpi (where
|
||||
// the pixel dimensions don't change), and the dpi change being detected, but
|
||||
// where the window manager also decides to tile/resize the window.
|
||||
// In the latter case, we don't want to preserve the terminal rows/cols.
|
||||
let simple_dpi_change = dimensions.dpi != self.dimensions.dpi
|
||||
&& dpi_adjusted(dimensions.pixel_height, dimensions.dpi)
|
||||
== dpi_adjusted(self.dimensions.pixel_height, self.dimensions.dpi)
|
||||
&& dpi_adjusted(dimensions.pixel_width, dimensions.dpi)
|
||||
== dpi_adjusted(self.dimensions.pixel_width, self.dimensions.dpi);
|
||||
|
||||
let scale_changed = simple_dpi_change || font_scale != self.fonts.get_font_scale();
|
||||
|
||||
let scale_changed_cells = if scale_changed {
|
||||
let cell_dims = self.current_cell_dimensions();
|
||||
|
Loading…
Reference in New Issue
Block a user