aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaehyun Cho <jae_hyun.cho@samsung.com>2019-06-24 21:25:58 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2019-06-25 13:49:51 +0900
commit699a1c2e705d1dccd8b8cfee1834a9280de929c5 (patch)
treef8f24fb0da06244fa08c275f057dd23e1f2232e5
parenteolian_mono: support eo access modifiers (diff)
downloadefl-devs/jaehyun/efl_clickable_test3.tar.gz
efl_ui_clickable: fix not to be clicked if pointer is processeddevs/jaehyun/efl_clickable_test3
-rw-r--r--src/bin/elementary/test_ui_active_view.c7
-rw-r--r--src/lib/elementary/efl_ui_active_view_view_manager_scroll.c10
-rw-r--r--src/lib/elementary/efl_ui_clickable_util.c19
3 files changed, 34 insertions, 2 deletions
diff --git a/src/bin/elementary/test_ui_active_view.c b/src/bin/elementary/test_ui_active_view.c
index 38a79ea831..b417d9b7fc 100644
--- a/src/bin/elementary/test_ui_active_view.c
+++ b/src/bin/elementary/test_ui_active_view.c
@@ -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;
diff --git a/src/lib/elementary/efl_ui_active_view_view_manager_scroll.c b/src/lib/elementary/efl_ui_active_view_view_manager_scroll.c
index 6918703cf1..30df266c89 100644
--- a/src/lib/elementary/efl_ui_active_view_view_manager_scroll.c
+++ b/src/lib/elementary/efl_ui_active_view_view_manager_scroll.c
@@ -20,6 +20,7 @@ typedef struct {
Eina_Bool active;
int from;
Eina_Position2D mouse_start;
+ Eina_Bool moved;
} mouse_move;
Eina_Bool animation;
} Efl_Ui_Active_View_View_Manager_Scroll_Data;
@@ -105,6 +106,7 @@ _mouse_down_cb(void *data,
pd->mouse_move.active = EINA_TRUE;
pd->mouse_move.from = efl_ui_active_view_active_index_get(pd->container);
pd->mouse_move.mouse_start = efl_input_pointer_position_get(ev);
+ pd->mouse_move.moved = EINA_FALSE;
}
static void
@@ -123,6 +125,8 @@ _mouse_move_cb(void *data,
pos = efl_input_pointer_position_get(ev);
pos_y_diff = pd->mouse_move.mouse_start.x - pos.x;
+ pd->mouse_move.moved = EINA_TRUE;
+
pd->transition.active = EINA_TRUE;
pd->transition.from = pd->mouse_move.from;
pd->transition.progress = (double)pos_y_diff / (double)pd->page_size.w;
@@ -144,6 +148,12 @@ _mouse_up_cb(void *data,
if (efl_input_event_flags_get(ev) & EFL_INPUT_FLAGS_PROCESSED) return;
if (!pd->mouse_move.active) return;
+ //Set input processed not to cause clicked event to content button.
+ if (pd->mouse_move.moved && !efl_input_processed_get(ev))
+ efl_input_processed_set(ev, EINA_TRUE);
+
+ pd->mouse_move.moved = EINA_FALSE;
+
double absolut_current_position = (double)pd->transition.from + pd->transition.progress;
int result = round(absolut_current_position);
diff --git a/src/lib/elementary/efl_ui_clickable_util.c b/src/lib/elementary/efl_ui_clickable_util.c
index b11e0c50e2..d8ed3f66ed 100644
--- a/src/lib/elementary/efl_ui_clickable_util.c
+++ b/src/lib/elementary/efl_ui_clickable_util.c
@@ -38,9 +38,24 @@ _on_mouse_out(void *data,
efl_ui_clickable_button_state_reset(data, 1);
}
+static void
+_theme_unpress_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_UP, _theme_unpress_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);
}