mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-05-13 08:26:56 +00:00
Implement focus tracking in kitten infrastructure
This commit is contained in:
parent
ce59ef8c6e
commit
e015ebefab
3 changed files with 11 additions and 2 deletions
|
|
@ -121,6 +121,9 @@ type Loop struct {
|
|||
|
||||
// Called when the terminal's color scheme changes
|
||||
OnColorSchemeChange func(ColorPreference) error
|
||||
|
||||
// Called on focus in/out events
|
||||
OnFocusChange func(bool) error
|
||||
}
|
||||
|
||||
func New(options ...func(self *Loop)) (*Loop, error) {
|
||||
|
|
|
|||
|
|
@ -113,6 +113,12 @@ func (self *Loop) handle_csi(raw []byte) (err error) {
|
|||
return nil
|
||||
}
|
||||
}
|
||||
} else if csi == "I" || csi == "O" {
|
||||
if self.OnFocusChange != nil {
|
||||
return self.OnFocusChange(csi == "I")
|
||||
}
|
||||
return nil
|
||||
|
||||
}
|
||||
ke := KeyEventFromCSI(csi)
|
||||
if ke != nil {
|
||||
|
|
|
|||
|
|
@ -129,9 +129,9 @@ func (self *TerminalStateOptions) SetStateEscapeCodes() string {
|
|||
}
|
||||
sb.WriteString(DECSACE_DEFAULT_REGION_SELECT)
|
||||
reset_modes(&sb,
|
||||
IRM, DECKM, DECSCNM, BRACKETED_PASTE, FOCUS_TRACKING,
|
||||
IRM, DECKM, DECSCNM, BRACKETED_PASTE,
|
||||
MOUSE_BUTTON_TRACKING, MOUSE_MOTION_TRACKING, MOUSE_MOVE_TRACKING, MOUSE_UTF8_MODE, MOUSE_SGR_MODE)
|
||||
set_modes(&sb, DECARM, DECAWM, DECTCEM)
|
||||
set_modes(&sb, DECARM, DECAWM, DECTCEM, FOCUS_TRACKING)
|
||||
if self.in_band_resize_notification {
|
||||
set_modes(&sb, INBAND_RESIZE_NOTIFICATION)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue