elm - scroller - set hold flag on wheel events if used for that dir

@fix

this should fix the clash between wheel and scroller ... somewhat
This commit is contained in:
Carsten Haitzler 2015-07-07 19:35:48 +09:00
parent 59730595e3
commit 37fad8fd65
2 changed files with 44 additions and 2 deletions

View File

@ -1870,13 +1870,24 @@ _elm_scroll_wheel_event_cb(void *data,
int direction = 0;
int pagenumber_h = 0, pagenumber_v = 0;
int mx = 0, my = 0, minx = 0, miny = 0;
Evas_Coord pwx, pwy;
double t;
sid = data;
ev = event_info;
direction = ev->direction;
if (sid->block & ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL)
return;
if (direction)
{
if (sid->block & ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL) return;
}
else
{
if (sid->block & ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL) return;
}
pwx = sid->wx;
pwy = sid->wy;
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
if ((evas_key_modifier_is_set(ev->modifiers, "Control")) ||
@ -1897,6 +1908,8 @@ _elm_scroll_wheel_event_cb(void *data,
if (y < miny) y = miny;
if (y > my) y = my;
t = ecore_loop_time_get();
if ((sid->down.bounce_x_animator) || (sid->down.bounce_y_animator) ||
(sid->scrollto.x.animator) || (sid->scrollto.y.animator))
{
@ -1974,6 +1987,31 @@ _elm_scroll_wheel_event_cb(void *data,
_elm_scroll_scroll_to_y(sid, _elm_config->bring_in_scroll_friction, y);
}
}
if (direction)
{
if ((pwx != sid->wx) ||
(((t - sid->down.last_time_x_wheel) < 0.5) &&
(sid->down.last_hold_x_wheel)))
{
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
sid->down.last_hold_x_wheel = EINA_TRUE;
}
else sid->down.last_hold_x_wheel = EINA_FALSE;
sid->down.last_time_x_wheel = t;
}
else
{
if ((pwy != sid->wy) ||
(((t - sid->down.last_time_y_wheel) < 0.5) &&
(sid->down.last_hold_y_wheel)))
{
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
sid->down.last_hold_y_wheel = EINA_TRUE;
}
else sid->down.last_hold_y_wheel = EINA_FALSE;
sid->down.last_time_y_wheel = t;
}
}
static Eina_Bool

View File

@ -104,6 +104,8 @@ struct _Elm_Scrollable_Smart_Interface_Data
double onhold_vx, onhold_vy, onhold_tlast,
onhold_vxe, onhold_vye;
double extra_time;
double last_time_x_wheel;
double last_time_y_wheel;
Evas_Coord hold_x, hold_y;
Evas_Coord locked_x, locked_y;
@ -116,6 +118,8 @@ struct _Elm_Scrollable_Smart_Interface_Data
Ecore_Animator *bounce_x_animator; /**< an animator to express the bouncing animation on x axis. */
Ecore_Animator *bounce_y_animator; /**< an animator to express the bouncing animation on y axis. */
Eina_Bool last_hold_x_wheel : 1;
Eina_Bool last_hold_y_wheel : 1;
Eina_Bool bounce_x_hold : 1;
Eina_Bool bounce_y_hold : 1;
Eina_Bool dragged_began : 1;