summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-07-07 19:35:48 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-07-07 19:35:48 +0900
commita5611570a4601bc5940c198ab9f9cea1e09e6394 (patch)
tree1328e02c6c4754ed8b43dbfc641efeec486b50a1
parentcd037452812ce63351f6f4c0b9c3c7dd3ffb0eaf (diff)
downloadelementary-a5611570a4601bc5940c198ab9f9cea1e09e6394.tar.gz
elm - scroller - set hold flag on wheel events if used for that dir
@fix this should fix the clash between wheel and scroller ... somewhat
-rw-r--r--src/lib/elm_interface_scrollable.c42
-rw-r--r--src/lib/elm_interface_scrollable.h4
2 files changed, 44 insertions, 2 deletions
diff --git a/src/lib/elm_interface_scrollable.c b/src/lib/elm_interface_scrollable.c
index 4536fe186..972400348 100644
--- a/src/lib/elm_interface_scrollable.c
+++ b/src/lib/elm_interface_scrollable.c
@@ -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
diff --git a/src/lib/elm_interface_scrollable.h b/src/lib/elm_interface_scrollable.h
index f58ab9f6b..748a9caee 100644
--- a/src/lib/elm_interface_scrollable.h
+++ b/src/lib/elm_interface_scrollable.h
@@ -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;