diff options
author | Matt Keeler <mjkeeler7@gmail.com> | 2018-08-09 07:47:56 -0400 |
---|---|---|
committer | Matt Keeler <mjkeeler7@gmail.com> | 2018-08-09 07:47:56 -0400 |
commit | eb084469e4a6ae60b45a5ea834dbf6187d9f96ea (patch) | |
tree | d6410c49c9acf0770a929bac353cfe3134975f22 | |
parent | 2c588f0082fe52087a2cd12ce364dcd417899251 (diff) | |
download | alacritty-eb084469e4a6ae60b45a5ea834dbf6187d9f96ea.tar.gz alacritty-eb084469e4a6ae60b45a5ea834dbf6187d9f96ea.zip |
Handle HiDpiFactorChanged event better to update cached DPR
-rw-r--r-- | src/event.rs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/event.rs b/src/event.rs index c8501a23..80690edd 100644 --- a/src/event.rs +++ b/src/event.rs @@ -286,7 +286,7 @@ impl<N: Notify> Processor<N> { resize_tx: &mpsc::Sender<PhysicalSize>, hide_cursor: &mut bool, window_is_focused: &mut bool, - dpr: f64, + dpr: &mut f64, ) { match event { // Pass on device events @@ -318,7 +318,7 @@ impl<N: Notify> Processor<N> { ::std::process::exit(0); }, Resized(lsize) => { - resize_tx.send(lsize.to_physical(dpr)).expect("send new size"); + resize_tx.send(lsize.to_physical(*dpr)).expect("send new size"); processor.ctx.terminal.dirty = true; }, KeyboardInput { input, .. } => { @@ -376,7 +376,10 @@ impl<N: Notify> Processor<N> { let path: String = path.to_string_lossy().into(); processor.ctx.write_to_pty(path.into_bytes()); }, - HiDpiFactorChanged(_) => processor.ctx.terminal.dirty = true, + HiDpiFactorChanged(new_dpr) => { + *dpr = new_dpr; + processor.ctx.terminal.dirty = true; + }, _ => (), } }, @@ -444,8 +447,8 @@ impl<N: Notify> Processor<N> { }; let mut window_is_focused = window.is_focused; - let dpr = window.hidpi_factor(); - + let mut dpr = window.hidpi_factor(); + // Scope needed to that hide_cursor isn't borrowed after the scope // ends. { @@ -461,7 +464,7 @@ impl<N: Notify> Processor<N> { resize_tx, hide_cursor, &mut window_is_focused, - dpr, + &mut dpr, ); }; |