diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-07-11 07:06:20 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-07-11 07:06:20 +0000 |
| commit | 7d8974f930f915dbe0da2608984af88cc628b216 (patch) | |
| tree | 73ed93163aefdbc80d6f15978c2737a8bde4481e | |
| parent | term: cache kbd-focused state, just like we cache visual focus state (diff) | |
term: remove term_has_kbd_focus(), use term->kbd_focus instead
| -rw-r--r-- | terminal.c | 22 | ||||
| -rw-r--r-- | terminal.h | 1 |
2 files changed, 5 insertions, 18 deletions
@@ -1717,7 +1717,7 @@ void term_cursor_blink_enable(struct terminal *term) { term->cursor_blink.state = CURSOR_BLINK_ON; - term->cursor_blink.active = term_has_kbd_focus(term) + term->cursor_blink.active = term->kbd_focus ? cursor_blink_start_timer(term) : true; } @@ -1734,7 +1734,7 @@ term_cursor_blink_restart(struct terminal *term) { if (term->cursor_blink.active) { term->cursor_blink.state = CURSOR_BLINK_ON; - term->cursor_blink.active = term_has_kbd_focus(term) + term->cursor_blink.active = term->kbd_focus ? cursor_blink_start_timer(term) : true; } } @@ -1957,18 +1957,6 @@ term_visual_focus_out(struct terminal *term) cursor_refresh(term); } -bool -term_has_kbd_focus(struct terminal *term) -{ - tll_foreach(term->wl->seats, it) { - if (it->item.kbd_focus == term) - return true; - } - - return false; -} -#endif - void term_kbd_focus_in(struct terminal *term) { @@ -2108,7 +2096,7 @@ term_mouse_down(struct terminal *term, int button, int row, int col, return; - bool has_focus = term_has_kbd_focus(term); + bool has_focus = term->kbd_focus; bool shift = has_focus ? _shift : false; bool alt = has_focus ? _alt : false; bool ctrl = has_focus ? _ctrl : false; @@ -2150,7 +2138,7 @@ term_mouse_up(struct terminal *term, int button, int row, int col, if (encoded == -1) return; - bool has_focus = term_has_kbd_focus(term); + bool has_focus = term->kbd_focus; bool shift = has_focus ? _shift : false; bool alt = has_focus ? _alt : false; bool ctrl = has_focus ? _ctrl : false; @@ -2192,7 +2180,7 @@ term_mouse_motion(struct terminal *term, int button, int row, int col, } else encoded = 3; /* "released" */ - bool has_focus = term_has_kbd_focus(term); + bool has_focus = term->kbd_focus; bool shift = has_focus ? _shift : false; bool alt = has_focus ? _alt : false; bool ctrl = has_focus ? _ctrl : false; @@ -518,7 +518,6 @@ void term_restore_cursor(struct terminal *term, const struct cursor *cursor); void term_visual_focus_in(struct terminal *term); void term_visual_focus_out(struct terminal *term); -bool term_has_kbd_focus(struct terminal *term); void term_kbd_focus_in(struct terminal *term); void term_kbd_focus_out(struct terminal *term); void term_mouse_down( |
