diff options
Diffstat (limited to 'src/input.rs')
-rw-r--r-- | src/input.rs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/input.rs b/src/input.rs index f2337d6a..cccb3bb4 100644 --- a/src/input.rs +++ b/src/input.rs @@ -69,6 +69,7 @@ pub trait ActionContext { fn change_font_size(&mut self, delta: f32); fn reset_font_size(&mut self); fn scroll(&mut self, scroll: Scroll); + fn hide_window(&mut self); } /// Describes a state and action to take in that state @@ -185,6 +186,9 @@ pub enum Action { /// Run given command Command(String, Vec<String>), + /// Hides the Alacritty window + Hide, + /// Quits Alacritty. Quit, } @@ -240,6 +244,9 @@ impl Action { }, } }, + Action::Hide => { + ctx.hide_window(); + }, Action::Quit => { // FIXME should do a more graceful shutdown ::std::process::exit(0); @@ -570,7 +577,7 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> { return; } - self.process_mouse_bindings(ModifiersState::default(), button); + self.process_mouse_bindings(modifiers, button); } /// Process key input @@ -665,7 +672,7 @@ mod tests { use glutin::{VirtualKeyCode, Event, WindowEvent, ElementState, MouseButton, ModifiersState}; use term::{SizeInfo, Term, TermMode}; - use event::{Mouse, ClickState}; + use event::{Mouse, ClickState, WindowChanges}; use config::{self, Config, ClickHandler}; use index::{Point, Side}; use selection::Selection; @@ -691,6 +698,7 @@ mod tests { pub received_count: usize, pub suppress_chars: bool, pub last_modifiers: ModifiersState, + pub window_changes: &'a mut WindowChanges, } impl <'a>super::ActionContext for ActionContext<'a> { @@ -748,6 +756,8 @@ mod tests { } fn reset_font_size(&mut self) { } + fn hide_window(&mut self) { + } } macro_rules! test_clickstate { @@ -786,6 +796,7 @@ mod tests { received_count: 0, suppress_chars: false, last_modifiers: ModifiersState::default(), + window_changes: &mut WindowChanges::default(), }; let mut processor = Processor { |