Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
raphamorim committed Jan 28, 2024
1 parent 483bdaf commit 4ad69ff
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

## Unreleased

- Report focus change https://terminalguide.namepad.de/mode/p1004/.
- Updated wgpu to 0.19.0.
- Removed support to DX11.
- Add basic touch support by @androw [#226](https://github.com/raphamorim/rio/pull/226)
Expand Down
13 changes: 13 additions & 0 deletions frontends/rioterm/src/screen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1352,6 +1352,19 @@ impl Screen {
self.ctx_mut().current_mut().messenger.send_bytes(msg);
}

#[inline]
pub fn on_focus_change(&mut self, is_focused: bool) {
if self.get_mode().contains(Mode::FOCUS_IN_OUT) {
let chr = if is_focused { "I" } else { "O" };

let msg = format!("\x1b[{}", chr);
self.ctx_mut()
.current_mut()
.messenger
.send_bytes(msg.into_bytes());
}
}

#[inline]
pub fn scroll(&mut self, new_scroll_x_px: f64, new_scroll_y_px: f64) {
let width = self.sugarloaf.layout.scaled_sugarwidth as f64;
Expand Down
2 changes: 2 additions & 0 deletions frontends/rioterm/src/sequencer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,8 @@ impl Sequencer {
if has_regained_focus {
route.redraw();
}

route.window.screen.on_focus_change(focused);
}
}

Expand Down

0 comments on commit 4ad69ff

Please sign in to comment.