From 66a41a06e78d7363cbbec4486cf420fc5ab4c3e8 Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Tue, 12 Aug 2014 14:58:25 +0200 Subject: [PATCH] compositor: fetch repeat info from weston.ini --- man/weston.ini.man | 11 +++++++++++ src/compositor.c | 5 +++++ src/compositor.h | 3 +++ src/input.c | 9 ++++++--- 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/man/weston.ini.man b/man/weston.ini.man index 667f70a0..3d8eef90 100644 --- a/man/weston.ini.man +++ b/man/weston.ini.man @@ -396,6 +396,17 @@ sets the keymap options (string). See the Options section in .B "xkeyboard-config(7)." .RE .RE +.TP 7 +.BI "repeat-rate=" "40" +sets the rate of repeating keys in characters per second (unsigned integer) +.RE +.RE +.TP 7 +.BI "repeat-delay=" "400" +sets the delay in milliseconds since key down until repeating starts (unsigned +integer) +.RE +.RE .SH "TERMINAL SECTION" Contains settings for the weston terminal application (weston-terminal). It allows to customize the font and shell of the command line interface. diff --git a/src/compositor.c b/src/compositor.c index 4d6a02a4..96e3435f 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -3792,6 +3792,11 @@ weston_compositor_init(struct weston_compositor *ec, if (weston_compositor_xkb_init(ec, &xkb_names) < 0) return -1; + weston_config_section_get_int(s, "repeat-rate", + &ec->kb_repeat_rate, 40); + weston_config_section_get_int(s, "repeat-delay", + &ec->kb_repeat_delay, 400); + text_backend_init(ec); wl_data_device_manager_init(ec->wl_display); diff --git a/src/compositor.h b/src/compositor.h index 102cfa7d..c0fc0a6e 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -649,6 +649,9 @@ struct weston_compositor { /* Raw keyboard processing (no libxkbcommon initialization or handling) */ int use_xkbcommon; + + int32_t kb_repeat_rate; + int32_t kb_repeat_delay; }; struct weston_buffer { diff --git a/src/input.c b/src/input.c index b6cd7dfa..1ab55cea 100644 --- a/src/input.c +++ b/src/input.c @@ -1721,8 +1721,11 @@ seat_get_keyboard(struct wl_client *client, struct wl_resource *resource, wl_resource_set_implementation(cr, &keyboard_interface, seat, unbind_resource); - if (wl_resource_get_version(cr) >= WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION) - wl_keyboard_send_repeat_info(cr, 30, 200); + if (wl_resource_get_version(cr) >= WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION) { + wl_keyboard_send_repeat_info(cr, + seat->compositor->kb_repeat_rate, + seat->compositor->kb_repeat_delay); + } if (seat->compositor->use_xkbcommon) { wl_keyboard_send_keymap(cr, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, @@ -1816,7 +1819,7 @@ bind_seat(struct wl_client *client, void *data, uint32_t version, uint32_t id) enum wl_seat_capability caps = 0; resource = wl_resource_create(client, - &wl_seat_interface, MIN(version, 3), id); + &wl_seat_interface, MIN(version, 4), id); wl_list_insert(&seat->base_resource_list, wl_resource_get_link(resource)); wl_resource_set_implementation(resource, &seat_interface, data, unbind_resource);