forked from enlightenment/efl
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 <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D9406
This commit is contained in:
parent
e1f2b9d235
commit
d01885ec8b
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue