intf scroll: handle wheel logic in post event cb.

Summary:
@Fix

Resolves: T2216

Reviewers: seoz, raster, JackDanielZ, Hermet

Reviewed By: Hermet

Subscribers: cedric, eagleeye, SanghyeonLee, seoz, sachin.dev

Maniphest Tasks: T2216

Differential Revision: https://phab.enlightenment.org/D2393

Conflicts:

	src/lib/elm_interface_scrollable.c
This commit is contained in:
Amitesh Singh 2015-08-07 17:27:30 +09:00 committed by ChunEon Park
parent 23d5820468
commit 248b6beeee
2 changed files with 47 additions and 27 deletions

View File

@ -1858,46 +1858,29 @@ _elm_scroll_wanted_region_set(Evas_Object *obj)
eo_do(obj, elm_interface_scrollable_content_region_set(wx, sid->wy, ww, wh)); eo_do(obj, elm_interface_scrollable_content_region_set(wx, sid->wy, ww, wh));
} }
static void
_elm_scroll_wheel_event_cb(void *data, static Eina_Bool
Evas *e EINA_UNUSED, _scroll_wheel_post_event_cb(void *data, Evas *e EINA_UNUSED)
Evas_Object *obj EINA_UNUSED,
void *event_info)
{ {
Elm_Scrollable_Smart_Interface_Data *sid; Elm_Scrollable_Smart_Interface_Data *sid = data;
Evas_Event_Mouse_Wheel *ev; Evas_Event_Mouse_Wheel *ev = sid->event_info;
Evas_Coord x = 0, y = 0, vw = 0, vh = 0, cw = 0, ch = 0; Evas_Coord x = 0, y = 0, vw = 0, vh = 0, cw = 0, ch = 0;
int direction = 0;
int pagenumber_h = 0, pagenumber_v = 0; int pagenumber_h = 0, pagenumber_v = 0;
int mx = 0, my = 0, minx = 0, miny = 0; int mx = 0, my = 0, minx = 0, miny = 0;
Evas_Coord pwx, pwy; Evas_Coord pwx, pwy;
double t; double t;
int direction;
sid = data;
ev = event_info;
direction = ev->direction; direction = ev->direction;
if (direction)
{
if (sid->block & ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL) return;
}
else
{
if (sid->block & ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL) return;
}
pwx = sid->wx; pwx = sid->wx;
pwy = sid->wy; pwy = sid->wy;
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
if ((evas_key_modifier_is_set(ev->modifiers, "Control")) || if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
(evas_key_modifier_is_set(ev->modifiers, "Alt")) ||
(evas_key_modifier_is_set(ev->modifiers, "Meta")) ||
(evas_key_modifier_is_set(ev->modifiers, "Hyper")) ||
(evas_key_modifier_is_set(ev->modifiers, "Super")))
return;
else if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
direction = !direction; direction = !direction;
eo_do(sid->obj, elm_interface_scrollable_content_pos_get(&x, &y)); eo_do(sid->obj, elm_interface_scrollable_content_pos_get(&x, &y));
if (sid->scrollto.x.animator) x = sid->scrollto.x.end; if (sid->scrollto.x.animator) x = sid->scrollto.x.end;
if (sid->scrollto.y.animator) y = sid->scrollto.y.end; if (sid->scrollto.y.animator) y = sid->scrollto.y.end;
@ -2012,6 +1995,42 @@ _elm_scroll_wheel_event_cb(void *data,
else sid->down.last_hold_y_wheel = EINA_FALSE; else sid->down.last_hold_y_wheel = EINA_FALSE;
sid->down.last_time_y_wheel = t; sid->down.last_time_y_wheel = t;
} }
return EINA_TRUE;
}
static void
_elm_scroll_wheel_event_cb(void *data,
Evas *e,
Evas_Object *obj EINA_UNUSED,
void *event_info)
{
Elm_Scrollable_Smart_Interface_Data *sid;
Evas_Event_Mouse_Wheel *ev;
int direction;
sid = data;
ev = event_info;
sid->event_info = event_info;
direction = ev->direction;
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
if ((evas_key_modifier_is_set(ev->modifiers, "Control")) ||
(evas_key_modifier_is_set(ev->modifiers, "Alt")) ||
(evas_key_modifier_is_set(ev->modifiers, "Meta")) ||
(evas_key_modifier_is_set(ev->modifiers, "Hyper")) ||
(evas_key_modifier_is_set(ev->modifiers, "Super")))
return;
if (direction)
{
if (sid->block & ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL) return;
}
else
{
if (sid->block & ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL) return;
}
evas_post_event_callback_push(e, _scroll_wheel_post_event_cb, sid);
} }
static Eina_Bool static Eina_Bool

View File

@ -193,6 +193,7 @@ struct _Elm_Scrollable_Smart_Interface_Data
unsigned char size_adjust_recurse; unsigned char size_adjust_recurse;
unsigned char size_count; unsigned char size_count;
void *event_info;
Eina_Bool size_adjust_recurse_abort : 1; Eina_Bool size_adjust_recurse_abort : 1;
Eina_Bool momentum_animator_disabled : 1; Eina_Bool momentum_animator_disabled : 1;