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 <dh.herrmann@googlemail.com>
This commit is contained in:
David Herrmann 2012-10-07 15:31:53 +02:00
parent 7f1bff5cc6
commit 7e4e25fcd2
3 changed files with 18 additions and 3 deletions

View 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)

View 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;

View 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);
}
}