bu5hm4n pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=d01885ec8b6fd039acc206e82d1bd805420e6eb9

commit d01885ec8b6fd039acc206e82d1bd805420e6eb9
Author: Mike Blumenkrantz <zm...@samsung.com>
Date:   Wed Jul 24 13:16:58 2019 -0400

    elm_test: add keybinds to rapidly flip between tests
    
    when not using --test-win-only, allow opening new tests forward and
    backward with alt+. and alt+,
    
    Reviewed-by: Marcel Hollerbach <m...@marcel-hollerbach.de>
    Differential Revision: https://phab.enlightenment.org/D9406
---
 src/bin/elementary/test.c | 33 +++++++++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c
index 3222fad2c9..8856c7cab1 100644
--- a/src/bin/elementary/test.c
+++ b/src/bin/elementary/test.c
@@ -405,7 +405,7 @@ static void _list_udpate(void);
 
 static Evas_Object *win, *tbx, *entry; // TODO: refactoring
 static void *tt;
-static Eina_List *tests;
+static Eina_List *tests, *cur_test;;
 static Eina_Bool hide_legacy = EINA_FALSE;
 static Eina_Bool hide_beta = EINA_FALSE;
 
@@ -643,6 +643,32 @@ _space_removed_string_get(const char *name)
    return ret;
 }
 
+static Eina_Bool
+_my_win_key_up(void *d EINA_UNUSED, int type EINA_UNUSED, Ecore_Event_Key *ev)
+{
+   struct elm_test *t;
+
+   if (eina_streq(ev->key, "comma") && (ev->modifiers & 
ECORE_EVENT_MODIFIER_ALT))
+     {
+        if (cur_test)
+          cur_test = eina_list_prev(cur_test);
+        if (!cur_test)
+          cur_test = eina_list_last(tests);
+        t = eina_list_data_get(cur_test);
+        t->cb(NULL, NULL, NULL);
+     }
+   else if (eina_streq(ev->key, "period") && (ev->modifiers & 
ECORE_EVENT_MODIFIER_ALT))
+     {
+        if (cur_test)
+          cur_test = eina_list_next(cur_test);
+        if (!cur_test)
+          cur_test = tests;
+        t = eina_list_data_get(cur_test);
+        t->cb(NULL, NULL, NULL);
+     }
+   return ECORE_CALLBACK_RENEW;
+}
+
 static void
 my_win_main(const char *autorun, Eina_Bool test_win_only)
 {
@@ -1300,7 +1326,10 @@ add_tests:
      }
 
    if (tests)
-     _menu_create(NULL);
+     {
+        _menu_create(NULL);
+        ecore_event_handler_add(ECORE_EVENT_KEY_UP, 
(Ecore_Event_Handler_Cb)_my_win_key_up, NULL);
+     }
 
    /* bring in autorun frame */
    if (autorun)

-- 


Reply via email to