From 7cb49681e76ec84bc89a2e67943bec258f11e553 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sun, 7 Feb 2021 11:11:58 +0100 Subject: [PATCH 1/2] ime: enter(): remove assertion on surface kind being TERM_SURF_GRID The main surface is the *only* IME capable surface we have. If the compositor is sending an ime::enter event for another surface, it is a compositor bug, not a foot bug. --- ime.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ime.c b/ime.c index 63e8cb9f..ad283455 100644 --- a/ime.c +++ b/ime.c @@ -25,11 +25,7 @@ enter(void *data, struct zwp_text_input_v3 *zwp_text_input_v3, LOG_DBG("enter: seat=%s", seat->name); /* The main grid is the *only* input-receiving surface we have */ - /* TODO: can we receive text_input::enter() _before_ keyboard_enter()? */ - struct terminal UNUSED *term = seat->kbd_focus; - xassert(term != NULL); - xassert(term_surface_kind(term, surface) == TERM_SURF_GRID); - + xassert(seat->kbd_focus != NULL); ime_enable(seat); } From cb60ddd0905f5fb92007037e3b10f8336da0e769 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sun, 7 Feb 2021 11:14:07 +0100 Subject: [PATCH 2/2] vt: remove xassert(), that cannot be optimized out, from action_print() action_print() is in the hot path, and having if-statement here *does* have an impact on performance. Much more so when that if-statement involves a functional call to wcwidth(). Closes #330 --- vt.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/vt.c b/vt.c index d1a83da2..d94420da 100644 --- a/vt.c +++ b/vt.c @@ -238,8 +238,6 @@ action_print(struct terminal *term, uint8_t c) L'│', L'≤', L'≥', L'π', L'≠', L'£', L'·', /* x - ~ */ }; - xassert(wcwidth(c) == 1); - if (unlikely(term->charsets.set[term->charsets.selected] == CHARSET_GRAPHIC) && c >= 0x60 && c <= 0x7e) {