From 7e4e25fcd257d77b8356c67f3756fb78516067ba Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Sun, 7 Oct 2012 15:31:53 +0200 Subject: [PATCH] wlt: add command-line options for xkb-repeat settings You can now use --xkb-repeat-rate/delay to configure the Xkb key-repeat settings instead of using the default 25/250. Signed-off-by: David Herrmann --- src/wlt_main.c | 11 ++++++++++- src/wlt_main.h | 5 +++++ src/wlt_toolkit.c | 5 +++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/wlt_main.c b/src/wlt_main.c index 4c5461d..70bd781 100644 --- a/src/wlt_main.c +++ b/src/wlt_main.c @@ -253,7 +253,13 @@ static void print_help() "\t --font-name [monospace]\n" "\t Font name\n" "\t --font-dpi [96]\n" - "\t Force DPI value for all fonts\n", + "\t Force DPI value for all fonts\n" + "\n" + "Input Options:\n" + "\t --xkb-repeat-delay [250]\n" + "\t Initial delay for key-repeat in ms\n" + "\t --xkb-repeat-rate [25]\n" + "\t Delay between two key-repeats in ms\n", "wlterm"); /* * 80 char line: @@ -382,6 +388,9 @@ struct conf_option options[] = { CONF_OPTION_UINT(0, "font-size", NULL, &wlt_conf.font_size, 12), CONF_OPTION_STRING(0, "font-name", NULL, &wlt_conf.font_name, "monospace"), CONF_OPTION_UINT(0, "font-dpi", NULL, &wlt_conf.font_ppi, 96), + + CONF_OPTION_UINT(0, "xkb-repeat-delay", NULL, &wlt_conf.xkb_repeat_delay, 250), + CONF_OPTION_UINT(0, "xkb-repeat-rate", NULL, &wlt_conf.xkb_repeat_rate, 25), }; int main(int argc, char **argv) diff --git a/src/wlt_main.h b/src/wlt_main.h index 601b5e3..e450658 100644 --- a/src/wlt_main.h +++ b/src/wlt_main.h @@ -84,6 +84,11 @@ struct wlt_conf_t { char *font_name; /* font ppi (overrides per monitor PPI) */ unsigned int font_ppi; + + /* xkb key repeat delay */ + unsigned int xkb_repeat_delay; + /* xkb key repeat rate */ + unsigned int xkb_repeat_rate; }; extern struct wlt_conf_t wlt_conf; diff --git a/src/wlt_toolkit.c b/src/wlt_toolkit.c index e23fc33..8531244 100644 --- a/src/wlt_toolkit.c +++ b/src/wlt_toolkit.c @@ -43,6 +43,7 @@ #include "shl_hook.h" #include "shl_misc.h" #include "tsm_vte.h" +#include "wlt_main.h" #include "wlt_toolkit.h" #define LOG_SUBSYSTEM "wlt_toolkit" @@ -678,9 +679,9 @@ static void keyboard_key(void *data, struct wl_keyboard *keyboard, } else if (state == WL_KEYBOARD_KEY_STATE_PRESSED) { disp->repeat_sym = sym; spec.it_interval.tv_sec = 0; - spec.it_interval.tv_nsec = 25 * 1000000; + spec.it_interval.tv_nsec = wlt_conf.xkb_repeat_rate * 1000000; spec.it_value.tv_sec = 0; - spec.it_value.tv_nsec = 250 * 1000000; + spec.it_value.tv_nsec = wlt_conf.xkb_repeat_delay * 1000000; ev_timer_update(disp->repeat_timer, &spec); } } -- 2.7.4