wlt: add command-line options for xkb-repeat settings
authorDavid Herrmann <dh.herrmann@googlemail.com>
Sun, 7 Oct 2012 13:31:53 +0000 (15:31 +0200)
committerDavid Herrmann <dh.herrmann@googlemail.com>
Sun, 7 Oct 2012 13:31:53 +0000 (15:31 +0200)
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 <dh.herrmann@googlemail.com>
src/wlt_main.c
src/wlt_main.h
src/wlt_toolkit.c

index 4c5461d..70bd781 100644 (file)
@@ -253,7 +253,13 @@ static void print_help()
                "\t    --font-name <name>      [monospace]\n"
                "\t                              Font name\n"
                "\t    --font-dpi <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 <msecs> [250]\n"
+               "\t                                 Initial delay for key-repeat in ms\n"
+               "\t    --xkb-repeat-rate <msecs>  [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)
index 601b5e3..e450658 100644 (file)
@@ -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;
index e23fc33..8531244 100644 (file)
@@ -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);
        }
 }