From d2fcb5343f57c132abec9a21ad89d1505a32c47c Mon Sep 17 00:00:00 2001 From: CismonX Date: Wed, 5 Jul 2023 00:19:21 +0800 Subject: input: add basic support for touchscreen input Closes #517 --- config.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'config.c') diff --git a/config.c b/config.c index 3d02355f..5297bbdc 100644 --- a/config.c +++ b/config.c @@ -2475,6 +2475,20 @@ parse_section_tweak(struct context *ctx) } } +static bool +parse_section_touch(struct context *ctx) { + struct config *conf = ctx->conf; + const char *key = ctx->key; + + if (strcmp(key, "long-press-delay") == 0) + return value_to_uint32(ctx, 10, &conf->touch.long_press_delay); + + else { + LOG_CONTEXTUAL_ERR("not a valid option: %s", key); + return false; + } +} + static bool parse_key_value(char *kv, const char **section, const char **key, const char **value) { @@ -2554,6 +2568,7 @@ enum section { SECTION_TEXT_BINDINGS, SECTION_ENVIRONMENT, SECTION_TWEAK, + SECTION_TOUCH, SECTION_COUNT, }; @@ -2579,6 +2594,7 @@ static const struct { [SECTION_TEXT_BINDINGS] = {&parse_section_text_bindings, "text-bindings"}, [SECTION_ENVIRONMENT] = {&parse_section_environment, "environment"}, [SECTION_TWEAK] = {&parse_section_tweak, "tweak"}, + [SECTION_TOUCH] = {&parse_section_touch, "touch"}, }; static_assert(ALEN(section_info) == SECTION_COUNT, "section info array size mismatch"); @@ -3026,6 +3042,10 @@ config_load(struct config *conf, const char *conf_path, .sixel = true, }, + .touch = { + .long_press_delay = 400, + }, + .env_vars = tll_init(), #if defined(UTMP_DEFAULT_HELPER_PATH) .utmp_helper_path = ((strlen(UTMP_DEFAULT_HELPER_PATH) > 0 && -- cgit v1.3