diff options
author | Aaron Hill <aa1ronham@gmail.com> | 2017-05-29 12:51:49 -0400 |
---|---|---|
committer | Joe Wilm <jwilm@users.noreply.github.com> | 2017-05-29 09:51:49 -0700 |
commit | 0321f3dcfb576763625a74392332e627ad5ece1b (patch) | |
tree | 1452c8d90e838173fea99a764665d0f494b36b40 /src/input.rs | |
parent | 81116fb8a4f91f28b5751827e7bcda22f6fcbaf0 (diff) | |
download | alacritty-0321f3dcfb576763625a74392332e627ad5ece1b.tar.gz alacritty-0321f3dcfb576763625a74392332e627ad5ece1b.zip |
Implement FocusIn/FocusOut reports (#589)
Implements sending FocusIn/FocusOut events, as defined at
http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-FocusIn_FocusOut
Diffstat (limited to 'src/input.rs')
-rw-r--r-- | src/input.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/input.rs b/src/input.rs index 47374e47..f3efdf14 100644 --- a/src/input.rs +++ b/src/input.rs @@ -381,6 +381,19 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> { } } + pub fn on_focus_change(&mut self, is_focused: bool) { + if self.ctx.terminal_mode().contains(mode::FOCUS_IN_OUT) { + let chr = if is_focused { + "I" + } else { + "O" + }; + + let msg = format!("\x1b[{}", chr); + self.ctx.write_to_pty(msg.into_bytes()); + } + } + pub fn mouse_input(&mut self, state: ElementState, button: MouseButton) { if let MouseButton::Left = button { let state = mem::replace(&mut self.ctx.mouse_mut().left_button_state, state); |