Elm_Smart_Scroller_Policy hbar_flags, vbar_flags;
- struct {
+ struct
+ {
Evas_Coord x, y;
Evas_Coord sx, sy;
Evas_Coord dx, dy;
Evas_Coord bx0, by0;
Evas_Coord b0x, b0y;
Evas_Coord b2x, b2y;
- struct {
+ struct
+ {
Evas_Coord x, y;
double timestamp, localtimestamp;
- } history[60];
- struct {
- double tadd, dxsum, dysum;
- double est_timestamp_diff;
- } hist;
- double anim_start;
- double anim_start2;
- double anim_start3;
- double onhold_vx, onhold_vy, onhold_tlast, onhold_vxe, onhold_vye;
- double extra_time;
- Evas_Coord hold_x, hold_y;
- Ecore_Animator *hold_animator;
- Ecore_Animator *onhold_animator;
- Ecore_Animator *momentum_animator;
- Ecore_Animator *bounce_x_animator;
- Ecore_Animator *bounce_y_animator;
- Evas_Coord locked_x, locked_y;
- int hdir, vdir;
- Eina_Bool now : 1;
- Eina_Bool cancelled : 1;
- Eina_Bool hold : 1;
- Eina_Bool hold_parent : 1;
- Eina_Bool want_dragged : 1;
- Eina_Bool dragged : 1;
- Eina_Bool dragged_began : 1;
- Eina_Bool dir_x : 1;
- Eina_Bool dir_y : 1;
- Eina_Bool locked : 1;
- Eina_Bool bounce_x_hold : 1;
- Eina_Bool bounce_y_hold : 1;
- Eina_Bool scroll : 1;
- Eina_Bool want_reset : 1;
- } down;
-
- struct {
- Evas_Coord w, h;
- Eina_Bool resized : 1;
- } child;
- struct {
- Evas_Coord x, y;
- } step, page;
-
- struct {
- void (*set) (Evas_Object *obj, Evas_Coord x, Evas_Coord y);
- void (*get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
- void (*max_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
- void (*min_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
- void (*child_size_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
- void (*gravity_set) (Evas_Object *obj, double x, double y);
- void (*gravity_get) (Evas_Object *obj, double *x, double *y);
- } pan_func;
-
- struct {
- struct {
- Evas_Coord start, end;
- double t_start, t_end;
- Ecore_Animator *animator;
- } x, y;
- } scrollto;
+ } history[60];
+ struct
+ {
+ double tadd, dxsum, dysum;
+ double est_timestamp_diff;
+ } hist;
+ double anim_start;
+ double anim_start2;
+ double anim_start3;
+ double onhold_vx, onhold_vy, onhold_tlast, onhold_vxe, onhold_vye;
+ double extra_time;
+ Evas_Coord hold_x, hold_y;
+ Ecore_Animator *hold_animator;
+ Ecore_Animator *onhold_animator;
+ Ecore_Animator *momentum_animator;
+ Ecore_Animator *bounce_x_animator;
+ Ecore_Animator *bounce_y_animator;
+ Evas_Coord locked_x, locked_y;
+ int hdir, vdir;
+ Eina_Bool now : 1;
+ Eina_Bool cancelled : 1;
+ Eina_Bool hold : 1;
+ Eina_Bool hold_parent : 1;
+ Eina_Bool want_dragged : 1;
+ Eina_Bool dragged : 1;
+ Eina_Bool dragged_began : 1;
+ Eina_Bool dir_x : 1;
+ Eina_Bool dir_y : 1;
+ Eina_Bool locked : 1;
+ Eina_Bool bounce_x_hold : 1;
+ Eina_Bool bounce_y_hold : 1;
+ Eina_Bool scroll : 1;
+ Eina_Bool want_reset : 1;
+ } down;
+
+ struct
+ {
+ Evas_Coord w, h;
+ Eina_Bool resized : 1;
+ } child;
+ struct
+ {
+ Evas_Coord x, y;
+ } step, page;
+
+ struct
+ {
+ void (*set) (Evas_Object *obj, Evas_Coord x, Evas_Coord y);
+ void (*get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
+ void (*max_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
+ void (*min_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
+ void (*child_size_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
+ void (*gravity_set) (Evas_Object *obj, double x, double y);
+ void (*gravity_get) (Evas_Object *obj, double *x, double *y);
+ } pan_func;
+
+ struct
+ {
+ struct
+ {
+ Evas_Coord start, end;
+ double t_start, t_end;
+ Ecore_Animator *animator;
+ } x, y;
+ } scrollto;
double pagerel_h, pagerel_v;
Evas_Coord pagesize_h, pagesize_v;
Eina_Bool bounce_animator_disabled :1;
Eina_Bool is_mirrored : 1;
Eina_Bool wheel_disabled : 1;
- Eina_Bool event_propagation :1;
};
/* local subsystem functions */
}
void
-elm_smart_scroller_propagate_events_set(Evas_Object *obj, Eina_Bool propagation)
-{
- API_ENTRY return;
- sd->event_propagation = propagation;
-
- evas_object_propagate_events_set(sd->edje_obj, propagation);
-}
-
-Eina_Bool
-elm_smart_scroller_propagate_events_get(Evas_Object *obj)
-{
- API_ENTRY return EINA_FALSE;
- return sd->event_propagation;
-}
-
-void
elm_smart_scroller_object_theme_set(Evas_Object *parent, Evas_Object *obj, const char *clas, const char *group, const char *style)
{
API_ENTRY return;
Evas_Event_Mouse_Wheel *ev;
Smart_Data *sd;
Evas_Coord x = 0, y = 0;
+ int direction = 0;
sd = data;
ev = 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, "Shift")) ||
(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 = 1;
elm_smart_scroller_child_pos_get(sd->smart_obj, &x, &y);
if ((sd->down.bounce_x_animator) || (sd->down.bounce_y_animator) ||
(sd->scrollto.x.animator) || (sd->scrollto.y.animator))
if (sd->child.resized)
_elm_smart_scroller_wanted_region_set(sd->smart_obj);
}
- if (!ev->direction)
+ if (!direction)
y += ev->z * sd->step.y;
- else if (ev->direction == 1)
+ else if (direction == 1)
x += ev->z * sd->step.x;
if ((!sd->hold) && (!sd->freeze))
sd->down.dragged_began = EINA_FALSE;
sd->down.hold_parent = EINA_FALSE;
sd->down.cancelled = EINA_FALSE;
- if(sd->hold || sd->freeze)
+ if (sd->hold || sd->freeze)
sd->down.want_reset = EINA_TRUE;
else
sd->down.want_reset = EINA_FALSE;
fx = sd->down.hold_x;
fy = sd->down.hold_y;
- if ((!sd->hold) && (!sd->freeze) && (_elm_config->scroll_smooth_time_interval > 0.0))
- {
- int i, count = 0; //count for the real event number we have to deal with
- int queue_size = 10; //for event queue size
- int src_index = 0, dst_index = 0;
- int xsum = 0, ysum=0;
- Evas_Coord x=0, y=0;
-
- struct {
- Evas_Coord x, y;
- double t;
- } pos[queue_size];
-
- double tdiff, tnow;
- double time_interval=_elm_config->scroll_smooth_time_interval;
- // FIXME: assume server and client have the same "timezone"
- // (0 timepoint) for now. this needs to be figured out in advance
- // though.
- tdiff = sd->down.hist.est_timestamp_diff;
- tnow = ecore_time_get() - tdiff;
-
- for(i = 0; i < queue_size; i++)
- {
- x = sd->down.history[i].x;
- y = sd->down.history[i].y;
-
- //if there is no history value , we don't deal with it
- //if there is better wat to know existance of history value , I will modify this code to it
- if ( (x == 0) && (y == 0) )
- {
- break;
- }
- _down_coord_eval(sd, &x, &y);
-
- pos[i].x = x;
- pos[i].y = y;
- pos[i].t = tnow - sd->down.history[i].timestamp;
- }
- count = --i;
-
- // we only deal with smooth scroll there is enough history
- for(i = 0; i < queue_size; i++)
- {
- if (src_index > count) break;
- if (i == 0)
- {
- xsum = pos[i].x;
- ysum = pos[i].y;
- dst_index++;
- continue;
- }
- while ((pos[src_index].t < time_interval *i) &&
- (src_index <= count))
- {
- src_index++;
- }
- if (src_index <= count)
- {
- xsum += pos[src_index].x;
- ysum += pos[src_index].y;
- dst_index++;
- }
- }
- fx = xsum / dst_index;
- fy = ysum / dst_index;
- }
-
elm_smart_scroller_child_pos_get(sd->smart_obj, &ox, &oy);
if (sd->down.dir_x)
{
((sd->down.dy > 0) && (sd->down.pdy > 0)) ||
((sd->down.dy < 0) && (sd->down.pdy < 0)))
{
- double t = ecore_loop_time_get();
- double dt = t - sd->down.anim_start;
+ double tt = ecore_loop_time_get();
+ double dtt = tt - sd->down.anim_start;
- if (dt < 0.0) dt = 0.0;
- else if (dt > _elm_config->thumbscroll_friction)
- dt = _elm_config->thumbscroll_friction;
- sd->down.extra_time = _elm_config->thumbscroll_friction - dt;
+ if (dtt < 0.0) dtt = 0.0;
+ else if (dtt > _elm_config->thumbscroll_friction)
+ dtt = _elm_config->thumbscroll_friction;
+ sd->down.extra_time = _elm_config->thumbscroll_friction - dtt;
}
else
sd->down.extra_time = 0.0;
{
int dodir = 0;
- if (sd->scrollto.x.animator)
+ if ((sd->scrollto.x.animator) && (!sd->hold) && (!sd->freeze))
{
Evas_Coord px;
ecore_animator_del(sd->scrollto.x.animator);
sd->down.x = sd->down.history[0].x;
}
- if (sd->scrollto.y.animator)
+ if ((sd->scrollto.y.animator) && (!sd->hold) && (!sd->freeze))
{
Evas_Coord py;
ecore_animator_del(sd->scrollto.y.animator);
y = sd->down.sy - (ev->cur.canvas.y - sd->down.y);
else
y = sd->down.sy;
- if(sd->down.want_reset)
+ if (sd->down.want_reset)
{
sd->down.x = ev->cur.canvas.x;
sd->down.y = ev->cur.canvas.y;
sd->pan_func.max_get = _elm_smart_pan_max_get;
sd->pan_func.min_get = _elm_smart_pan_min_get;
sd->pan_func.child_size_get = _elm_smart_pan_child_size_get;
+ sd->pan_func.gravity_set = _elm_smart_pan_gravity_set;
+ sd->pan_func.gravity_get = _elm_smart_pan_gravity_get;
_smart_scrollbar_reset(sd);
}