input: add basic support for touchscreen input

Closes #517
This commit is contained in:
CismonX 2023-07-05 00:19:21 +08:00 committed by Daniel Eklöf
parent 4a73828911
commit d2fcb5343f
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
12 changed files with 364 additions and 22 deletions

View file

@ -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 &&