diff options
author | Josh Leeb-du Toit <josh.leebdutoit@gmail.com> | 2018-07-22 10:38:53 +1000 |
---|---|---|
committer | Christian Duerr <chrisduerr@users.noreply.github.com> | 2018-07-22 00:38:53 +0000 |
commit | dbcb5885adb1f0b23c29838ef8dd837212322409 (patch) | |
tree | 7fb3a64c39efd2693cac49885c9cc49cd9a28ac7 /src/input.rs | |
parent | 0d5edb7a7a7a33369bc2c1e5cc007edbd6fcf15f (diff) | |
download | r-alacritty-dbcb5885adb1f0b23c29838ef8dd837212322409.tar.gz r-alacritty-dbcb5885adb1f0b23c29838ef8dd837212322409.tar.bz2 r-alacritty-dbcb5885adb1f0b23c29838ef8dd837212322409.zip |
Add binding action for hiding the window
Diffstat (limited to 'src/input.rs')
-rw-r--r-- | src/input.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/input.rs b/src/input.rs index bc33094a..52775678 100644 --- a/src/input.rs +++ b/src/input.rs @@ -66,6 +66,7 @@ pub trait ActionContext { fn last_modifiers(&mut self) -> &mut ModifiersState; fn change_font_size(&mut self, delta: f32); fn reset_font_size(&mut self); + fn hide_window(&mut self); } /// Describes a state and action to take in that state @@ -170,6 +171,9 @@ pub enum Action { /// Run given command Command(String, Vec<String>), + /// Hides the Alacritty window + Hide, + /// Quits Alacritty. Quit, } @@ -224,6 +228,9 @@ impl Action { }, } }, + Action::Hide => { + ctx.hide_window(); + }, Action::Quit => { // FIXME should do a more graceful shutdown ::std::process::exit(0); @@ -626,7 +633,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; @@ -651,6 +658,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> { @@ -704,6 +712,8 @@ mod tests { } fn reset_font_size(&mut self) { } + fn hide_window(&mut self) { + } } macro_rules! test_clickstate { @@ -742,6 +752,7 @@ mod tests { received_count: 0, suppress_chars: false, last_modifiers: ModifiersState::default(), + window_changes: &mut WindowChanges::default(), }; let mut processor = Processor { |