Commit eb61bb2f authored by Matt Keeler's avatar Matt Keeler Committed by Peter van der meulen

Use/Mutate the DPR within the ActionContext for handling Resize

parent 0192f52d
......@@ -36,7 +36,8 @@ pub trait Notify {
pub struct ActionContext<'a, N: 'a> {
pub notifier: &'a mut N,
pub terminal: &'a mut Term,
pub size_info: &'a SizeInfo,
pub selection: &'a mut Option<Selection>,
pub size_info: &'a mut SizeInfo,
pub mouse: &'a mut Mouse,
pub received_count: &'a mut usize,
pub suppress_chars: &'a mut bool,
......@@ -299,7 +300,6 @@ impl<N: Notify> Processor<N> {
resize_tx: &mpsc::Sender<PhysicalSize>,
hide_cursor: &mut bool,
window_is_focused: &mut bool,
dpr: &mut f64,
) {
match event {
// Pass on device events
......@@ -332,7 +332,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(processor.ctx.size_info.dpr)).expect("send new size");
processor.ctx.terminal.dirty = true;
},
KeyboardInput { input, .. } => {
......@@ -387,7 +387,7 @@ impl<N: Notify> Processor<N> {
processor.ctx.write_to_pty(path.into_bytes());
},
HiDpiFactorChanged(new_dpr) => {
*dpr = new_dpr;
processor.ctx.size_info.dpr = new_dpr;
processor.ctx.terminal.dirty = true;
},
_ => (),
......@@ -440,7 +440,8 @@ impl<N: Notify> Processor<N> {
terminal: &mut terminal,
notifier: &mut self.notifier,
mouse: &mut self.mouse,
size_info: &self.size_info,
size_info: &mut self.size_info,
selection_modified: false,
received_count: &mut self.received_count,
suppress_chars: &mut self.suppress_chars,
last_modifiers: &mut self.last_modifiers,
......@@ -457,8 +458,7 @@ impl<N: Notify> Processor<N> {
};
let mut window_is_focused = window.is_focused;
let mut dpr = window.hidpi_factor();
// Scope needed to that hide_cursor isn't borrowed after the scope
// ends.
{
......@@ -474,7 +474,6 @@ impl<N: Notify> Processor<N> {
resize_tx,
hide_cursor,
&mut window_is_focused,
&mut dpr,
);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment