mirror of
https://github.com/alacritty/alacritty.git
synced 2024-11-25 14:05:41 -05:00
Fix crash on ScaleFactorChange on Windows
Windows is known to send zero sizes from winit in Risezed and now in ScaleFactorChanged events. They were handled in Resized, but not in ScaleFactorChanged. Fixes #6949.
This commit is contained in:
parent
284f2c49a9
commit
0e6ce4523b
2 changed files with 11 additions and 4 deletions
|
@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Hyperlink preview not being shown when the terminal has exactly 2 lines
|
- Hyperlink preview not being shown when the terminal has exactly 2 lines
|
||||||
|
- Crash on Windows when changing display scale factor
|
||||||
|
|
||||||
## 0.12.1
|
## 0.12.1
|
||||||
|
|
||||||
|
|
|
@ -1179,16 +1179,22 @@ impl input::Processor<EventProxy, ActionContext<'_, Notifier, EventProxy>> {
|
||||||
match event {
|
match event {
|
||||||
WinitEvent::UserEvent(Event { payload, .. }) => match payload {
|
WinitEvent::UserEvent(Event { payload, .. }) => match payload {
|
||||||
EventType::ScaleFactorChanged(scale_factor, (width, height)) => {
|
EventType::ScaleFactorChanged(scale_factor, (width, height)) => {
|
||||||
|
self.ctx.window().scale_factor = scale_factor;
|
||||||
|
|
||||||
let display_update_pending = &mut self.ctx.display.pending_update;
|
let display_update_pending = &mut self.ctx.display.pending_update;
|
||||||
|
|
||||||
// Push current font to update its scale factor.
|
// Push current font to update its scale factor.
|
||||||
let font = self.ctx.config.font.clone();
|
let font = self.ctx.config.font.clone();
|
||||||
display_update_pending.set_font(font.with_size(*self.ctx.font_size));
|
display_update_pending.set_font(font.with_size(*self.ctx.font_size));
|
||||||
|
|
||||||
// Resize to event's dimensions, since no resize event is emitted on Wayland.
|
// Ignore resize events to zero in any dimension, to avoid issues with Winit
|
||||||
display_update_pending.set_dimensions(PhysicalSize::new(width, height));
|
// and the ConPTY. A 0x0 resize will also occur when the window is minimized
|
||||||
|
// on Windows.
|
||||||
self.ctx.window().scale_factor = scale_factor;
|
if width != 0 && height != 0 {
|
||||||
|
// Resize to event's dimensions, since no resize event is emitted on
|
||||||
|
// Wayland.
|
||||||
|
display_update_pending.set_dimensions(PhysicalSize::new(width, height));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
EventType::Frame => {
|
EventType::Frame => {
|
||||||
self.ctx.display.window.has_frame.store(true, Ordering::Relaxed);
|
self.ctx.display.window.has_frame.store(true, Ordering::Relaxed);
|
||||||
|
|
Loading…
Reference in a new issue