forked from enlightenment/efl
From: Kim Shinwoo <kimcinoo.efl@gmail.com>
Subject: [E-devel] [patch][elementary] ctxpopup, focus-chain i'd like to raise an issue about focus chain on the ctxpopup. the focus would go around only in the ctxpopup. (IMHO, raster keep the previous popup patch. so definitely!!) but.. first of all, current ctxpopup does not have focus_next(). even though there is focus_next(), it is not work properly, because the parent of ctxpopup would be a widget which does not take care of sub objects in the focus_next(); such as elm_list. (every widget can be a parent of ctxpopup, if the widget is enough size to display ctxpopup. thus the elm_list can be a parent of ctxpopup also). anyhow, to resolve this issue, the patch uses event() of elm_widget_event_hook_set(). the ctxpopup item is equal to the elm_list item. but the focus chain of elm_list does not work properly. generally, we use 'Tab' key to move focus, but elm_list uses the (up,down) arrow key moreover it is not a focus. if you want to check this patch, it would be better to use ELM_ACCESS_MODE=1. SVN revision: 74650
This commit is contained in:
parent
82b68bd53d
commit
13648c3680
|
@ -190,6 +190,25 @@ _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_focus_next_hook(const Evas_Object *obj,
|
||||||
|
Elm_Focus_Direction dir,
|
||||||
|
Evas_Object **next)
|
||||||
|
{
|
||||||
|
Widget_Data *wd = elm_widget_data_get(obj);
|
||||||
|
|
||||||
|
if (!wd)
|
||||||
|
return EINA_FALSE;
|
||||||
|
|
||||||
|
if (!elm_widget_focus_next_get(wd->box, dir, next))
|
||||||
|
{
|
||||||
|
elm_widget_focused_object_clear(wd->box);
|
||||||
|
elm_widget_focus_next_get(wd->box, dir, next);
|
||||||
|
}
|
||||||
|
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__,
|
_event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__,
|
||||||
Evas_Callback_Type type, void *event_info)
|
Evas_Callback_Type type, void *event_info)
|
||||||
|
@ -203,7 +222,18 @@ _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__,
|
||||||
if (!wd) return EINA_FALSE;
|
if (!wd) return EINA_FALSE;
|
||||||
|
|
||||||
ev = event_info;
|
ev = event_info;
|
||||||
|
|
||||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
|
||||||
|
|
||||||
|
if (!strcmp(ev->keyname, "Tab"))
|
||||||
|
{
|
||||||
|
if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
|
||||||
|
elm_widget_focus_cycle(wd->box, ELM_FOCUS_PREVIOUS);
|
||||||
|
else
|
||||||
|
elm_widget_focus_cycle(wd->box, ELM_FOCUS_NEXT);
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if (strcmp(ev->keyname, "Escape")) return EINA_FALSE;
|
if (strcmp(ev->keyname, "Escape")) return EINA_FALSE;
|
||||||
|
|
||||||
evas_object_hide(obj);
|
evas_object_hide(obj);
|
||||||
|
@ -966,6 +996,7 @@ _ctxpopup_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj,
|
||||||
{
|
{
|
||||||
elm_list_go(wd->list);
|
elm_list_go(wd->list);
|
||||||
wd->visible = EINA_TRUE;
|
wd->visible = EINA_TRUE;
|
||||||
|
elm_object_focus_set(obj, EINA_TRUE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -979,7 +1010,6 @@ _ctxpopup_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj,
|
||||||
edje_object_signal_emit(wd->base, "elm,state,show", "elm");
|
edje_object_signal_emit(wd->base, "elm,state,show", "elm");
|
||||||
|
|
||||||
_sizing_eval(obj);
|
_sizing_eval(obj);
|
||||||
|
|
||||||
elm_object_focus_set(obj, EINA_TRUE);
|
elm_object_focus_set(obj, EINA_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1166,6 +1196,7 @@ elm_ctxpopup_add(Evas_Object *parent)
|
||||||
elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
|
elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
|
||||||
elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
|
elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
|
||||||
elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
|
elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
|
||||||
|
elm_widget_focus_next_hook_set(obj, _focus_next_hook);
|
||||||
|
|
||||||
//Background
|
//Background
|
||||||
wd->bg = edje_object_add(e);
|
wd->bg = edje_object_add(e);
|
||||||
|
|
Loading…
Reference in New Issue