e_config.c/e_comp_wl.c: add code for making repeat delay/rate values configurable 85/52585/1
authorSung-Jin Park <input.hacker@gmail.com>
Tue, 24 Nov 2015 12:55:57 +0000 (21:55 +0900)
committerSung-Jin Park <input.hacker@gmail.com>
Tue, 24 Nov 2015 12:55:57 +0000 (21:55 +0900)
Change-Id: I23d51b5f9859e1df5f0ef4ea8892c768acabbd03

src/bin/e_comp_wl.h
src/bin/e_comp_wl_input.c
src/bin/e_config.c
src/bin/e_config.h

index e98ee55..3c29fe1 100644 (file)
@@ -181,6 +181,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
index 5f178cd..ba569f3 100644 (file)
@@ -220,6 +220,10 @@ _e_comp_wl_input_cb_keyboard_get(struct wl_client *client, struct wl_resource *r
    wl_resource_set_implementation(res, &_e_keyboard_interface, cdata,
                                   _e_comp_wl_input_cb_keyboard_unbind);
 
+   /* send current repeat_info */
+   if (wl_resource_get_version(res) >= WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION)
+     wl_keyboard_send_repeat_info(res, cdata->kbd.repeat_rate, cdata->kbd.repeat_delay);
+
    /* send current keymap */
    wl_keyboard_send_keymap(res, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1,
                            cdata->xkb.fd, cdata->xkb.size);
@@ -509,6 +513,15 @@ e_comp_wl_input_init(E_Comp_Data *cdata)
 
    cdata->xkb.fd = -1;
 
+   /* get default keyboard repeat rate/delay from configuration */
+   cdata->kbd.repeat_delay = e_config->keyboard.repeat_delay;
+   cdata->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 (cdata->kbd.repeat_delay < 0) cdata->kbd.repeat_delay = 400;
+   if (cdata->kbd.repeat_delay < 0) cdata->kbd.repeat_rate = 25;
+
    /* create the global resource for input seat */
    cdata->seat.global =
      wl_global_create(cdata->wl.disp, &wl_seat_interface, 4,
index d25908a..433fe1c 100644 (file)
@@ -760,6 +760,9 @@ _e_config_edd_init(Eina_Bool old)
    E_CONFIG_VAL(D, T, xkb.default_model, STR);
    E_CONFIG_VAL(D, T, xkb.use_cache, UCHAR);
 
+   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);
@@ -1541,6 +1544,9 @@ e_config_load(void)
    E_CONFIG_LIMIT(e_config->backlight.dim, 0.1, 1.0);
    E_CONFIG_LIMIT(e_config->backlight.idle_dim, 0.1, 1.0);
 
+   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
 
index 4ba8f0e..1f65021 100644 (file)
@@ -439,6 +439,12 @@ struct _E_Config
       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