forked from enlightenment/efl
ctxpopup, player, slideshow, spinner, toolbar, video: internal refactoring of smart event routines.
Now most of smart events codes look consistent.
This commit is contained in:
parent
efe7cec4f5
commit
88a8c46af3
|
@ -138,39 +138,30 @@ _elm_ctxpopup_smart_event(Eo *obj, void *_pd, va_list *list)
|
|||
return;
|
||||
}
|
||||
|
||||
if (((!strcmp(ev->key, "Left")) ||
|
||||
(!strcmp(ev->key, "KP_Left")) ||
|
||||
(!strcmp(ev->key, "Right")) ||
|
||||
(!strcmp(ev->key, "KP_Right")) ||
|
||||
(!strcmp(ev->key, "Up")) ||
|
||||
(!strcmp(ev->key, "KP_Up")) ||
|
||||
(!strcmp(ev->key, "Down")) ||
|
||||
(!strcmp(ev->key, "KP_Down"))) && (!ev->string))
|
||||
if (sd->box)
|
||||
{
|
||||
if (sd->box)
|
||||
{
|
||||
if ((!strcmp(ev->key, "Left")) ||
|
||||
(!strcmp(ev->key, "KP_Left")))
|
||||
elm_widget_focus_cycle(sd->box, ELM_FOCUS_LEFT);
|
||||
else if ((!strcmp(ev->key, "Right")) ||
|
||||
(!strcmp(ev->key, "KP_Right")))
|
||||
elm_widget_focus_cycle(sd->box, ELM_FOCUS_RIGHT);
|
||||
else if ((!strcmp(ev->key, "Up")) ||
|
||||
(!strcmp(ev->key, "KP_Up")))
|
||||
elm_widget_focus_cycle(sd->box, ELM_FOCUS_UP);
|
||||
else if ((!strcmp(ev->key, "Down")) ||
|
||||
(!strcmp(ev->key, "KP_Down")))
|
||||
elm_widget_focus_cycle(sd->box, ELM_FOCUS_DOWN);
|
||||
if ((!strcmp(ev->key, "Left")) ||
|
||||
((!strcmp(ev->key, "KP_Left")) && (!ev->string)))
|
||||
elm_widget_focus_cycle(sd->box, ELM_FOCUS_LEFT);
|
||||
else if ((!strcmp(ev->key, "Right")) ||
|
||||
((!strcmp(ev->key, "KP_Right")) && (!ev->string)))
|
||||
elm_widget_focus_cycle(sd->box, ELM_FOCUS_RIGHT);
|
||||
else if ((!strcmp(ev->key, "Up")) ||
|
||||
((!strcmp(ev->key, "KP_Up")) && (!ev->string)))
|
||||
elm_widget_focus_cycle(sd->box, ELM_FOCUS_UP);
|
||||
else if ((!strcmp(ev->key, "Down")) ||
|
||||
((!strcmp(ev->key, "KP_Down")) && (!ev->string)))
|
||||
elm_widget_focus_cycle(sd->box, ELM_FOCUS_DOWN);
|
||||
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
return;
|
||||
}
|
||||
goto success;
|
||||
}
|
||||
|
||||
if (strcmp(ev->key, "Escape")) return;
|
||||
if (!strcmp(ev->key, "Escape"))
|
||||
evas_object_hide(obj);
|
||||
else
|
||||
return;
|
||||
|
||||
evas_object_hide(obj);
|
||||
success:
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
}
|
||||
|
|
|
@ -86,12 +86,10 @@ _elm_player_smart_event(Eo *obj, void *_pd, va_list *list)
|
|||
elm_video_play_position_set(sd->video, current);
|
||||
}
|
||||
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
return;
|
||||
goto success;
|
||||
}
|
||||
if ((!strcmp(ev->key, "Right")) ||
|
||||
((!strcmp(ev->key, "KP_Right")) && (!ev->string)))
|
||||
else if ((!strcmp(ev->key, "Right")) ||
|
||||
((!strcmp(ev->key, "KP_Right")) && (!ev->string)))
|
||||
{
|
||||
double current, last;
|
||||
|
||||
|
@ -105,20 +103,23 @@ _elm_player_smart_event(Eo *obj, void *_pd, va_list *list)
|
|||
elm_video_play_position_set(sd->video, current);
|
||||
}
|
||||
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
return;
|
||||
goto success;
|
||||
}
|
||||
if (!strcmp(ev->key, "space"))
|
||||
else if (!strcmp(ev->key, "space"))
|
||||
{
|
||||
if (elm_video_is_playing_get(sd->video))
|
||||
elm_video_pause(sd->video);
|
||||
else
|
||||
elm_video_play(sd->video);
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
return;
|
||||
|
||||
goto success;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
success:
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -46,25 +46,17 @@ _elm_slideshow_smart_event(Eo *obj, void *_pd, va_list *list)
|
|||
((!strcmp(ev->key, "KP_Left")) && (!ev->string)))
|
||||
{
|
||||
elm_slideshow_previous(obj);
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
return;
|
||||
goto success;
|
||||
}
|
||||
|
||||
if ((!strcmp(ev->key, "Right")) ||
|
||||
else if ((!strcmp(ev->key, "Right")) ||
|
||||
((!strcmp(ev->key, "KP_Right")) && (!ev->string)))
|
||||
{
|
||||
elm_slideshow_next(obj);
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
return;
|
||||
goto success;
|
||||
}
|
||||
|
||||
if ((!strcmp(ev->key, "Return")) ||
|
||||
(!strcmp(ev->key, "KP_Enter")) ||
|
||||
(!strcmp(ev->key, "space")))
|
||||
else if ((!strcmp(ev->key, "Return")) ||
|
||||
(!strcmp(ev->key, "KP_Enter")) ||
|
||||
(!strcmp(ev->key, "space")))
|
||||
{
|
||||
if (sd->timeout)
|
||||
{
|
||||
|
@ -73,13 +65,14 @@ _elm_slideshow_smart_event(Eo *obj, void *_pd, va_list *list)
|
|||
else
|
||||
elm_slideshow_timeout_set(obj, sd->timeout);
|
||||
}
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
return;
|
||||
goto success;
|
||||
}
|
||||
|
||||
if (ret) *ret = EINA_FALSE;
|
||||
return;
|
||||
|
||||
success:
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -455,9 +455,8 @@ _elm_spinner_smart_event(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
|
|||
{
|
||||
_val_dec_start(obj);
|
||||
elm_layout_signal_emit(obj, "elm,left,anim,activate", "elm");
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
return;
|
||||
|
||||
goto success;
|
||||
}
|
||||
else if (
|
||||
( (!strcmp(ev->key, "Right") ||
|
||||
|
@ -471,9 +470,8 @@ _elm_spinner_smart_event(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
|
|||
{
|
||||
_val_inc_start(obj);
|
||||
elm_layout_signal_emit(obj, "elm,right,anim,activate", "elm");
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
return;
|
||||
|
||||
goto success;
|
||||
}
|
||||
}
|
||||
else if (type == EVAS_CALLBACK_KEY_UP)
|
||||
|
@ -490,11 +488,14 @@ _elm_spinner_smart_event(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
|
|||
_val_dec_stop(obj);
|
||||
else return;
|
||||
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
return;
|
||||
goto success;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
success:
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -666,13 +666,12 @@ _elm_toolbar_smart_event(Eo *obj, void *_pd, va_list *list)
|
|||
if (!sd->items) return;
|
||||
|
||||
if ((!strcmp(ev->key, "Return")) ||
|
||||
((!strcmp(ev->key, "KP_Enter")) && !ev->string))
|
||||
((!strcmp(ev->key, "KP_Enter")) && !ev->string))
|
||||
{
|
||||
if (sd->highlighted_item)
|
||||
_item_select(sd->highlighted_item);
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
return;
|
||||
|
||||
goto success;
|
||||
}
|
||||
else if ((!strcmp(ev->key, "Left")) ||
|
||||
((!strcmp(ev->key, "KP_Left")) && !ev->string))
|
||||
|
@ -680,10 +679,7 @@ _elm_toolbar_smart_event(Eo *obj, void *_pd, va_list *list)
|
|||
if (!sd->vertical)
|
||||
it = _highlight_next_item_get(obj, sd->bx, EINA_TRUE);
|
||||
else
|
||||
{
|
||||
if (ret) *ret = EINA_FALSE;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if ((!strcmp(ev->key, "Right")) ||
|
||||
((!strcmp(ev->key, "KP_Right")) && !ev->string))
|
||||
|
@ -691,10 +687,7 @@ _elm_toolbar_smart_event(Eo *obj, void *_pd, va_list *list)
|
|||
if (!sd->vertical)
|
||||
it = _highlight_next_item_get(obj, sd->bx, EINA_FALSE);
|
||||
else
|
||||
{
|
||||
if (ret) *ret = EINA_FALSE;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if ((!strcmp(ev->key, "Up")) ||
|
||||
((!strcmp(ev->key, "KP_Up")) && !ev->string))
|
||||
|
@ -702,10 +695,7 @@ _elm_toolbar_smart_event(Eo *obj, void *_pd, va_list *list)
|
|||
if (sd->vertical)
|
||||
it = _highlight_next_item_get(obj, sd->bx, EINA_TRUE);
|
||||
else
|
||||
{
|
||||
if (ret) *ret = EINA_FALSE;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if ((!strcmp(ev->key, "Down")) ||
|
||||
((!strcmp(ev->key, "KP_Down")) && !ev->string))
|
||||
|
@ -713,17 +703,11 @@ _elm_toolbar_smart_event(Eo *obj, void *_pd, va_list *list)
|
|||
if (sd->vertical)
|
||||
it = _highlight_next_item_get(obj, sd->bx, EINA_FALSE);
|
||||
else
|
||||
{
|
||||
if (ret) *ret = EINA_FALSE;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!it)
|
||||
{
|
||||
if (ret) *ret = EINA_FALSE;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
|
||||
if (sd->highlighted_item)
|
||||
edje_object_signal_emit(VIEW(sd->highlighted_item), "elm,highlight,off", "elm");
|
||||
|
@ -734,6 +718,7 @@ _elm_toolbar_smart_event(Eo *obj, void *_pd, va_list *list)
|
|||
sd->highlighted_item, ELM_TOOLBAR_ITEM_SCROLLTO_IN, &x, &y, &w, &h))
|
||||
eo_do(obj, elm_scrollable_interface_region_bring_in(x, y, w, h));
|
||||
|
||||
success:
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
}
|
||||
|
|
|
@ -55,14 +55,10 @@ _elm_video_smart_event(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
|
|||
elm_video_play_position_set(obj, current);
|
||||
}
|
||||
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
return;
|
||||
goto success;
|
||||
}
|
||||
|
||||
if ((!strcmp(ev->key, "Right")) ||
|
||||
((!strcmp(ev->key, "KP_Right")) && (!ev->string)))
|
||||
else if ((!strcmp(ev->key, "Right")) ||
|
||||
((!strcmp(ev->key, "KP_Right")) && (!ev->string)))
|
||||
{
|
||||
double current, last;
|
||||
|
||||
|
@ -76,25 +72,24 @@ _elm_video_smart_event(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
|
|||
elm_video_play_position_set(obj, current);
|
||||
}
|
||||
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
return;
|
||||
goto success;
|
||||
}
|
||||
|
||||
if (!strcmp(ev->key, "space"))
|
||||
else if (!strcmp(ev->key, "space"))
|
||||
{
|
||||
if (elm_video_is_playing_get(obj))
|
||||
elm_video_pause(obj);
|
||||
else
|
||||
elm_video_play(obj);
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
return;
|
||||
goto success;
|
||||
}
|
||||
|
||||
INF("keyname: '%s' not handled", ev->key);
|
||||
return;
|
||||
|
||||
success:
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in New Issue