mirror of
https://github.com/wez/wezterm.git
synced 2024-12-24 13:52:55 +03:00
wayland: fix spurious resize event on focus change
The resize event would be fine except that it happens to trigger the scroll position to reset to the bottom.
This commit is contained in:
parent
ce5e69cb8f
commit
0db15ecaf4
@ -48,7 +48,7 @@ pub enum Operator {
|
||||
MultiplyThenOver(Color),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub struct Dimensions {
|
||||
pub pixel_width: usize,
|
||||
pub pixel_height: usize,
|
||||
|
@ -454,12 +454,16 @@ impl WaylandWindowInner {
|
||||
// Update the window decoration size
|
||||
self.window.as_mut().unwrap().resize(w, h);
|
||||
|
||||
// Store the new pixel dimensions
|
||||
self.dimensions = Dimensions {
|
||||
// Compute the new pixel dimensions
|
||||
let new_dimensions = Dimensions {
|
||||
pixel_width: pixel_width.try_into().unwrap(),
|
||||
pixel_height: pixel_height.try_into().unwrap(),
|
||||
dpi: factor as usize * 96,
|
||||
};
|
||||
// Only trigger a resize if the new dimensions are different;
|
||||
// this makes things more efficient and a little more smooth
|
||||
if new_dimensions != self.dimensions {
|
||||
self.dimensions = new_dimensions;
|
||||
|
||||
self.callbacks.resize(self.dimensions);
|
||||
#[cfg(feature = "opengl")]
|
||||
@ -468,6 +472,7 @@ impl WaylandWindowInner {
|
||||
wegl_surface.resize(pixel_width, pixel_height, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.refresh_frame();
|
||||
self.do_paint().unwrap();
|
||||
|
Loading…
Reference in New Issue
Block a user