e17/evry: ensure that there will be only one true popup.

- add timer to delay closing with the same binding that triggers evry 


SVN revision: 81432
This commit is contained in:
Hannes Janetzek 2012-12-20 09:37:37 +00:00
parent 68e80049c7
commit 2e15739b21
2 changed files with 28 additions and 1 deletions

View File

@ -53,6 +53,8 @@ struct _Evry_Window
/* only to be used by creator of win */
void *data;
Ecore_Timer *delay_hide_action;
};
struct _Evry_Selector

View File

@ -68,6 +68,8 @@ static Eina_Bool _evry_cb_key_down(void *data, int type, void *event);
static Eina_Bool _evry_cb_selection_notify(void *data, int type, void *event);
static Eina_Bool _evry_cb_mouse(void *data, int type, void *event);
static Eina_Bool _evry_delay_hide_timer(void *data);
static Eina_List *windows = NULL;
#ifdef CHECK_TIME
@ -161,6 +163,15 @@ evry_show(E_Zone *zone, E_Zone_Edge edge, const char *params, Eina_Bool popup)
E_OBJECT_CHECK_RETURN(zone, 0);
E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, 0);
if (popup)
{
// only one popup please
Eina_List *l;
EINA_LIST_FOREACH(windows, l, win)
if (win->grab)
return NULL;
}
if (!(win = _evry_window_new(zone, edge)))
return NULL;
@ -265,9 +276,20 @@ evry_show(E_Zone *zone, E_Zone_Edge edge, const char *params, Eina_Bool popup)
win->func.hide = &_evry_hide_func;
win->delay_hide_action = ecore_timer_add(0.2, _evry_delay_hide_timer, win);
return win;
}
static Eina_Bool
_evry_delay_hide_timer(void *data)
{
Evry_Window *win = data;
win->delay_hide_action = NULL;
return ECORE_CALLBACK_CANCEL;
}
static void
_evry_hide_func(Evry_Window *win, int finished)
{
@ -344,6 +366,9 @@ evry_hide(Evry_Window *win, int clear)
EINA_LIST_FREE (win->handlers, ev)
ecore_event_handler_del(ev);
if (win->delay_hide_action)
ecore_timer_del(win->delay_hide_action);
if (win->grab)
e_grabinput_release(win->ewin->evas_win,
win->ewin->evas_win);
@ -1951,7 +1976,7 @@ _evry_cb_key_down(void *data, int type __UNUSED__, void *event)
return ECORE_CALLBACK_PASS_ON;
}
#endif
else if (ev->modifiers)
else if ((ev->modifiers) && (!win->delay_hide_action))
{
Eina_List *l;
E_Config_Binding_Key *binding;