netstar pushed a commit to branch master.

http://git.enlightenment.org/apps/evisum.git/commit/?id=1668a8761d77cadad07fe8c8eaf43a1a37711443

commit 1668a8761d77cadad07fe8c8eaf43a1a37711443
Author: Alastair Poole <nets...@gmail.com>
Date:   Sat Jan 23 08:32:33 2021 +0000

    keypress: Responsiveness?
    
    Add a delay to when "firing" off a change to the search paramaters,
    else it can be a bit intense for the poor machine.
---
 src/bin/ui/ui_process_list.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/bin/ui/ui_process_list.c b/src/bin/ui/ui_process_list.c
index d5a9cde..7e97436 100644
--- a/src/bin/ui/ui_process_list.c
+++ b/src/bin/ui/ui_process_list.c
@@ -49,6 +49,7 @@ typedef struct
    Evas_Object           *search_pop;
    Evas_Object           *search_entry;
    Eina_Bool              search_visible;
+   double                 search_keytime;
 
    Evas_Object           *scroller;
    Evas_Object           *genlist;
@@ -1467,9 +1468,17 @@ _search_empty_cb(void *data)
         elm_object_focus_allow_set(pd->search_entry, 0);
         pd->search_visible = 0;
         pd->search_timer = NULL;
+        pd->skip_wait = 1;
         return EINA_FALSE;
      }
 
+   if (pd->search_keytime &&
+       ((ecore_loop_time_get() - pd->search_keytime) > 0.05))
+     {
+        pd->skip_wait = 1;
+        pd->search_keytime = 0;
+     }
+
    return EINA_TRUE;
 }
 
@@ -1487,7 +1496,6 @@ _search_key_down_cb(void *data, Evas *e, Evas_Object 
*obj, void *event_info)
    Evas_Event_Key_Down *ev;
    const char *text;
    Ui_Data *pd;
-   size_t len;
 
    pd = data;
    ev = event_info;
@@ -1499,14 +1507,13 @@ _search_key_down_cb(void *data, Evas *e, Evas_Object 
*obj, void *event_info)
 
    if (text)
      {
+        pd->search_keytime = ecore_loop_time_get();
         _search_clear(pd);
-        len = strlen(text);
         pd->search_text = strdup(text);
-        pd->search_len = len;
-        if (!len && !pd->search_timer)
-          pd->search_timer = ecore_timer_add(0.5, _search_empty_cb, pd);
+        pd->search_len = strlen(text);
+        if (!pd->search_timer)
+          pd->search_timer = ecore_timer_add(0.05, _search_empty_cb, pd);
      }
-   pd->skip_wait = 1;
 }
 
 static void

-- 


Reply via email to