efl_ui_clickable: fix not to be clicked if pointer is processed

If pointer is processed by a container in its POINTER_MOVE event
callback, then clickable calls efl_ui_clickable_button_state_reset not
to be clicked by efl_ui_clickable_unpress.

e.g. Efl.Ui.Active_View.View_Manager_Scroll sets pointer processed in
POINTER_MOVE event callback not to click button during scrolling.

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D9204
This commit is contained in:
Jaehyun Cho 2019-06-28 10:35:19 +00:00 committed by Marcel Hollerbach
parent 7c23ba7c93
commit b7801edbe4
3 changed files with 28 additions and 2 deletions

View File

@ -58,6 +58,12 @@ typedef struct _Size_Params
#define PAGE_NUM 3
static void
page_clicked_cb(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
{
printf("Button Page is clicked!\n");
}
static Eo *
view_add(View_Type p, Eo *parent)
{
@ -95,6 +101,7 @@ view_add(View_Type p, Eo *parent)
case BUTTON:
page = efl_add(EFL_UI_BUTTON_CLASS, parent,
efl_text_set(efl_added, "Button Page"));
efl_event_callback_add(page, EFL_UI_EVENT_CLICKED, page_clicked_cb, NULL);
efl_gfx_hint_fill_set(page, EINA_TRUE, EINA_TRUE);
break;

View File

@ -38,9 +38,24 @@ _on_mouse_out(void *data,
efl_ui_clickable_button_state_reset(data, 1);
}
static void
_theme_move_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Efl_Input_Pointer *pointer = ev->info;
if (efl_input_processed_get(pointer))
efl_ui_clickable_button_state_reset(data, 1);
}
EFL_CALLBACKS_ARRAY_DEFINE(bind_to_theme_callbacks,
{EFL_EVENT_POINTER_MOVE, _theme_move_cb},
)
EOLIAN static void
_efl_ui_clickable_util_bind_to_theme(Efl_Canvas_Layout *object, Efl_Ui_Clickable *clickable)
{
efl_event_callback_array_add(object, bind_to_theme_callbacks(), clickable);
efl_layout_signal_callback_add(object, "efl,action,press", "*", clickable, _on_press_cb, NULL);
efl_layout_signal_callback_add(object, "efl,action,unpress", "*", clickable, _on_unpress_cb, NULL);
efl_layout_signal_callback_add(object, "efl,action,mouse_out", "*", clickable, _on_mouse_out, NULL);
@ -84,7 +99,7 @@ _unpress_cb(void *data, const Efl_Event *ev EINA_UNUSED)
}
}
EFL_CALLBACKS_ARRAY_DEFINE(bind_to_theme_callbacks,
EFL_CALLBACKS_ARRAY_DEFINE(bind_to_object_callbacks,
{EFL_EVENT_POINTER_DOWN, _press_cb},
{EFL_EVENT_POINTER_UP, _unpress_cb},
)
@ -92,7 +107,7 @@ EFL_CALLBACKS_ARRAY_DEFINE(bind_to_theme_callbacks,
EOLIAN static void
_efl_ui_clickable_util_bind_to_object(Efl_Input_Interface *object, Efl_Ui_Clickable *clickable)
{
efl_event_callback_array_add(object, bind_to_theme_callbacks(), clickable);
efl_event_callback_array_add(object, bind_to_object_callbacks(), clickable);
}

View File

@ -127,6 +127,10 @@ _mouse_move_cb(void *data,
pos = efl_input_pointer_position_get(ev);
pos_y_diff = pd->mouse_move.mouse_start.x - pos.x;
//Set input processed not to cause clicked event to content button.
if (!efl_input_processed_get(ev))
efl_input_processed_set(ev, EINA_TRUE);
pd->transition.active = EINA_TRUE;
pd->transition.progress = (double)pos_y_diff / (double)pd->page_size.w;