From 7d8974f930f915dbe0da2608984af88cc628b216 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sat, 11 Jul 2020 09:06:20 +0200 Subject: [PATCH] term: remove term_has_kbd_focus(), use term->kbd_focus instead --- terminal.c | 22 +++++----------------- terminal.h | 1 - 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/terminal.c b/terminal.c index 64d4d643..1a0d9406 100644 --- a/terminal.c +++ b/terminal.c @@ -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; diff --git a/terminal.h b/terminal.h index c56f9531..0e2aa8bf 100644 --- a/terminal.h +++ b/terminal.h @@ -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(