mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-11 04:27:49 -05:00
csi: implement FocusIn/Out events
This commit is contained in:
parent
9929e902a6
commit
7f6a4f4b6b
4 changed files with 29 additions and 0 deletions
8
csi.c
8
csi.c
|
|
@ -672,6 +672,10 @@ csi_dispatch(struct terminal *term, uint8_t final)
|
|||
term->mouse_tracking = MOUSE_MOTION;
|
||||
break;
|
||||
|
||||
case 1004:
|
||||
term->focus_events = true;
|
||||
break;
|
||||
|
||||
case 1005:
|
||||
LOG_WARN("unimplemented: UTF-8 mouse");
|
||||
/* term->mouse_reporting = MOUSE_UTF8; */
|
||||
|
|
@ -751,6 +755,10 @@ csi_dispatch(struct terminal *term, uint8_t final)
|
|||
term->mouse_tracking = MOUSE_NONE;
|
||||
break;
|
||||
|
||||
case 1004:
|
||||
term->focus_events = false;
|
||||
break;
|
||||
|
||||
case 1049:
|
||||
if (term->grid == &term->alt) {
|
||||
term->grid = &term->normal;
|
||||
|
|
|
|||
2
input.c
2
input.c
|
|
@ -65,6 +65,7 @@ keyboard_enter(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial,
|
|||
wl_array_for_each(key, keys)
|
||||
xkb_state_update_key(xkb_state, *key, 1);
|
||||
#endif
|
||||
term_focus_in((struct terminal *)data);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -72,6 +73,7 @@ keyboard_leave(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial,
|
|||
struct wl_surface *surface)
|
||||
{
|
||||
struct terminal *term = data;
|
||||
term_focus_out(term);
|
||||
|
||||
mtx_lock(&term->kbd.repeat.mutex);
|
||||
if (term->kbd.repeat.cmd != REPEAT_EXIT) {
|
||||
|
|
|
|||
16
terminal.c
16
terminal.c
|
|
@ -267,6 +267,22 @@ term_reverse_index(struct terminal *term)
|
|||
term_cursor_up(term, 1);
|
||||
}
|
||||
|
||||
void
|
||||
term_focus_in(struct terminal *term)
|
||||
{
|
||||
if (!term->focus_events)
|
||||
return;
|
||||
vt_to_slave(term, "\033[I", 3);
|
||||
}
|
||||
|
||||
void
|
||||
term_focus_out(struct terminal *term)
|
||||
{
|
||||
if (!term->focus_events)
|
||||
return;
|
||||
vt_to_slave(term, "\033[O", 3);
|
||||
}
|
||||
|
||||
static int
|
||||
linux_mouse_button_to_x(int button)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -216,6 +216,7 @@ struct terminal {
|
|||
bool auto_margin;
|
||||
bool insert_mode;
|
||||
bool bracketed_paste;
|
||||
bool focus_events;
|
||||
enum mouse_tracking mouse_tracking;
|
||||
enum mouse_reporting mouse_reporting;
|
||||
|
||||
|
|
@ -296,6 +297,8 @@ void term_scroll_reverse_partial(
|
|||
void term_linefeed(struct terminal *term);
|
||||
void term_reverse_index(struct terminal *term);
|
||||
|
||||
void term_focus_in(struct terminal *term);
|
||||
void term_focus_out(struct terminal *term);
|
||||
void term_mouse_down(struct terminal *term, int button, int row, int col,
|
||||
bool shift, bool alt, bool ctrl);
|
||||
void term_mouse_up(struct terminal *term, int button, int row, int col,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue