1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-23 13:21:38 +03:00

gui: fix initial pixel geometry on hidpi displays

refs: #1387
This commit is contained in:
Wez Furlong 2021-12-10 09:20:41 -07:00
parent f905ec8100
commit 7b402678e4
3 changed files with 19 additions and 0 deletions

View File

@ -27,6 +27,7 @@ As features stabilize some brief notes about them will accumulate here.
* Improved conformance of CUP, HVP, SLRM, STBM escape sequences by support empty first parameter. Thanks to [@ninjalj](https://github.com/ninjalj)! [#1377](https://github.com/wez/wezterm/pull/1377)
* tab bar didn't correctly handle double-wide cells and could truncate at edges when using `format-tab-title` [#1371](https://github.com/wez/wezterm/issues/1371)
* `wezterm cli --no-auto-start` was not respected
* Pixel geometry configured on the PTY in new windows could be incorrect on HiDPI displays until the window was resized [#1387](https://github.com/wez/wezterm/issues/1387)
### 20211205-192649-672c1cc1

View File

@ -550,6 +550,23 @@ impl TermWindow {
pixel_height: (render_metrics.cell_size.height as usize * physical_rows) as u16,
};
if terminal_size != size {
// DPI is different from the default assumed DPI when the mux
// created the pty. We need to inform the kernel of the revised
// pixel geometry now
log::trace!(
"Initial geometry was {:?} but dpi-adjusted geometry \
is {:?}; update the kernel pixel geometry for the ptys!",
terminal_size,
size
);
if let Some(window) = mux.get_window(mux_window_id) {
for tab in window.iter() {
tab.resize(size);
}
};
}
let h_context = DimensionContext {
dpi: dpi as f32,
pixel_max: terminal_size.pixel_width as f32,

View File

@ -470,6 +470,7 @@ impl XConnection {
log::trace!("xsettings are {:?}", xsettings);
let default_dpi = RefCell::new(compute_default_dpi(&xrm, &xsettings));
log::trace!("computed initial dpi: {:?}", default_dpi);
xcb_imdkit::ImeClient::set_logger(|msg| log::debug!("Ime: {}", msg));
let ime = unsafe {