From 6826608961a903dd7b117535bd16e8f83cfb26a0 Mon Sep 17 00:00:00 2001 From: Sung-Jin Park Date: Mon, 30 Nov 2015 14:05:10 -0500 Subject: [PATCH] (1) e_config.c/e_comp_wl.c: add code for making repeat values configurable (2) e.src(s): add keyboard.repeat_delay, keyboard.repeat_rate into e.src files Summary: As of now, the default values of repeat delay/rate are being set in e_comp_wl.c. Those values need to be configurable and will be used in e_comp_wl_init(). The limit of each of the values is defined from -1 to 1000. (maximum 1s). If one of the two is negative, it means default repeat delay/rate are going to be used. (e.g. delay:400, rate:25) Test Plan: N/A Signed-off-by: Sung-Jin Park Reviewers: raster, stefan_schmidt, gwanglim, devilhorns, zmike Subscribers: Jeon, ohduna, cedric Differential Revision: https://phab.enlightenment.org/D3364 --- config/default/e.src | 2 ++ config/mobile/e.src | 2 ++ config/standard/e.src | 2 ++ config/tiling/e.src | 2 ++ src/bin/e_comp_wl.h | 2 ++ src/bin/e_comp_wl_input.c | 13 +++++++++++-- src/bin/e_config.c | 14 ++++++++++++++ src/bin/e_config.h | 10 ++++++++-- 8 files changed, 43 insertions(+), 4 deletions(-) diff --git a/config/default/e.src b/config/default/e.src index db89920ae..b7cb8359b 100644 --- a/config/default/e.src +++ b/config/default/e.src @@ -215,6 +215,8 @@ group "E_Config" struct { value "update.later" uchar: 0; value "xkb.only_label" int: 0; value "xkb.default_model" string: "default"; + value "keyboard.repeat_delay" int: 400; + value "keyboard.repeat_rate" int: 25; value "exe_always_single_instance" uchar: 0; value "use_desktop_window_profile" int: 0; value "powersave.none" double: 0.25; diff --git a/config/mobile/e.src b/config/mobile/e.src index f4e607019..1431dde33 100644 --- a/config/mobile/e.src +++ b/config/mobile/e.src @@ -865,6 +865,8 @@ group "E_Config" struct { } value "xkb.only_label" int: 0; value "xkb.default_model" string: "default"; + value "keyboard.repeat_delay" int: 400; + value "keyboard.repeat_rate" int: 25; value "exe_always_single_instance" uchar: 1; value "use_desktop_window_profile" int: 0; } diff --git a/config/standard/e.src b/config/standard/e.src index 585d3f09a..b41057cc6 100644 --- a/config/standard/e.src +++ b/config/standard/e.src @@ -1106,6 +1106,8 @@ group "E_Config" struct { } value "xkb.only_label" int: 0; value "xkb.default_model" string: "default"; + value "keyboard.repeat_delay" int: 400; + value "keyboard.repeat_rate" int: 25; value "exe_always_single_instance" uchar: 0; value "use_desktop_window_profile" int: 0; } diff --git a/config/tiling/e.src b/config/tiling/e.src index 8bde334ad..afeac1fb3 100644 --- a/config/tiling/e.src +++ b/config/tiling/e.src @@ -1128,6 +1128,8 @@ group "E_Config" struct { } value "xkb.only_label" int: 0; value "xkb.default_model" string: "default"; + value "keyboard.repeat_delay" int: 400; + value "keyboard.repeat_rate" int: 25; value "exe_always_single_instance" uchar: 0; value "use_desktop_window_profile" int: 0; } diff --git a/src/bin/e_comp_wl.h b/src/bin/e_comp_wl.h index 7142f4d46..dc268dc09 100644 --- a/src/bin/e_comp_wl.h +++ b/src/bin/e_comp_wl.h @@ -155,6 +155,8 @@ struct _E_Comp_Wl_Data struct wl_array keys; struct wl_resource *focus; int mod_changed; + int repeat_delay; + int repeat_rate; } kbd; struct diff --git a/src/bin/e_comp_wl_input.c b/src/bin/e_comp_wl_input.c index 27934481c..d27d72acd 100644 --- a/src/bin/e_comp_wl_input.c +++ b/src/bin/e_comp_wl_input.c @@ -181,9 +181,9 @@ _e_comp_wl_input_cb_keyboard_get(struct wl_client *client, struct wl_resource *r e_comp->wl_comp_data, _e_comp_wl_input_cb_keyboard_unbind); - /* FIXME: These values should be configurable */ + /* send current repeat_info */ if (wl_resource_get_version(res) >= WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION) - wl_keyboard_send_repeat_info(res, 25, 400); + wl_keyboard_send_repeat_info(res, e_comp_wl->kbd.repeat_rate, e_comp_wl->kbd.repeat_delay); /* send current keymap */ wl_keyboard_send_keymap(res, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, @@ -419,6 +419,15 @@ e_comp_wl_input_init(void) e_comp_wl->xkb.fd = -1; + /* get default keyboard repeat rate/delay from configuration */ + e_comp_wl->kbd.repeat_delay = e_config->keyboard.repeat_delay; + e_comp_wl->kbd.repeat_rate = e_config->keyboard.repeat_rate; + + /* check for valid repeat_delay and repeat_rate value */ + /* if invalid, set the default value of repeat delay and rate value */ + if (e_comp_wl->kbd.repeat_delay < 0) e_comp_wl->kbd.repeat_delay = 400; + if (e_comp_wl->kbd.repeat_rate < 0) e_comp_wl->kbd.repeat_rate = 25; + /* create the global resource for input seat */ e_comp_wl->seat.global = wl_global_create(e_comp_wl->wl.disp, &wl_seat_interface, 4, diff --git a/src/bin/e_config.c b/src/bin/e_config.c index b8043b34d..80501aaf9 100644 --- a/src/bin/e_config.c +++ b/src/bin/e_config.c @@ -733,6 +733,9 @@ _e_config_edd_init(Eina_Bool old) E_CONFIG_VAL(D, T, xkb.dont_touch_my_damn_keyboard, UCHAR); E_CONFIG_VAL(D, T, xkb.default_model, STR); + E_CONFIG_VAL(D, T, keyboard.repeat_delay, INT); + E_CONFIG_VAL(D, T, keyboard.repeat_rate, INT); + if (old) { E_CONFIG_SUB(D, T, xkb.current_layout, _e_config_xkb_option_edd); @@ -1326,6 +1329,14 @@ e_config_load(void) free(ecc); } } + CONFIG_VERSION_CHECK(19) + { + CONFIG_VERSION_UPDATE_INFO(19); + + /* set (400, 25) as the default values of repeat delay, rate */ + e_config->keyboard.repeat_delay = 400; + e_config->keyboard.repeat_rate = 25; + } } if (!e_config->remember_internal_fm_windows) e_config->remember_internal_fm_windows = !!(e_config->remember_internal_windows & E_REMEMBER_INTERNAL_FM_WINS); @@ -1504,6 +1515,9 @@ e_config_load(void) E_CONFIG_LIMIT(e_config->backlight.dim, 0.05, 1.0); E_CONFIG_LIMIT(e_config->backlight.idle_dim, 0, 1); + E_CONFIG_LIMIT(e_config->keyboard.repeat_delay, -1, 1000); // 1 second + E_CONFIG_LIMIT(e_config->keyboard.repeat_rate, -1, 1000); // 1 second + if (!e_config->icon_theme) e_config->icon_theme = eina_stringshare_add("hicolor"); // FDO default diff --git a/src/bin/e_config.h b/src/bin/e_config.h index 7fe67c41c..2874ac7c2 100644 --- a/src/bin/e_config.h +++ b/src/bin/e_config.h @@ -47,7 +47,7 @@ typedef enum /* increment this whenever a new set of config values are added but the users * config doesn't need to be wiped - simply new values need to be put in */ -#define E_CONFIG_FILE_GENERATION 18 +#define E_CONFIG_FILE_GENERATION 19 #define E_CONFIG_FILE_VERSION ((E_CONFIG_FILE_EPOCH * 1000000) + E_CONFIG_FILE_GENERATION) #define E_CONFIG_BINDINGS_VERSION 0 // DO NOT INCREMENT UNLESS YOU WANT TO WIPE ALL BINDINGS!!!!! @@ -428,7 +428,13 @@ struct _E_Config const char *selected_layout; // whatever teh current layout that the user has selected is const char *desklock_layout; } xkb; - + + struct + { + int repeat_delay;//delay in milliseconds since key down until repeating starts + int repeat_rate;//the rate of repeating keys in characters per second + } keyboard; + Eina_List *menu_applications; unsigned char exe_always_single_instance; // GUI int use_desktop_window_profile; // GUI