raster pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=a5611570a4601bc5940c198ab9f9cea1e09e6394

commit a5611570a4601bc5940c198ab9f9cea1e09e6394
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
Date:   Tue Jul 7 19:35:48 2015 +0900

    elm - scroller - set hold flag on wheel events if used for that dir
    
    @fix
    
    this should fix the clash between wheel and scroller ... somewhat
---
 src/lib/elm_interface_scrollable.c | 42 ++++++++++++++++++++++++++++++++++++--
 src/lib/elm_interface_scrollable.h |  4 ++++
 2 files changed, 44 insertions(+), 2 deletions(-)

diff --git a/src/lib/elm_interface_scrollable.c 
b/src/lib/elm_interface_scrollable.c
index 4536fe1..9724003 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 f58ab9f..748a9ca 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;

-- 


Reply via email to