forked from enlightenment/enlightenment
thumbscroll. the ability to scroll any widget (anything scrolled by the
scrollfram smart/widget) using your "finger" anywhere in the view. not useful for desktops. useful for small screen devices - openmoko/n800 etc. are perfect targets. just click and drag with your finger, release. drag fast and releas and you get momentum and it continues for a bit while it slows down. configurable via a new config module. SVN revision: 33564
This commit is contained in:
parent
3210647b5e
commit
b92a1a6e24
|
@ -360,6 +360,8 @@ src/modules/conf_paths/Makefile
|
|||
src/modules/conf_paths/module.desktop
|
||||
src/modules/conf_mime/Makefile
|
||||
src/modules/conf_mime/module.desktop
|
||||
src/modules/conf_interaction/Makefile
|
||||
src/modules/conf_interaction/module.desktop
|
||||
src/preload/Makefile
|
||||
data/Makefile
|
||||
data/fonts/Makefile
|
||||
|
|
|
@ -576,6 +576,11 @@ e_config_init(void)
|
|||
|
||||
E_CONFIG_VAL(D, T, ping_clients_interval, INT);
|
||||
E_CONFIG_VAL(D, T, cache_flush_poll_interval, INT);
|
||||
|
||||
E_CONFIG_VAL(D, T, thumbscroll_enable, INT);
|
||||
E_CONFIG_VAL(D, T, thumbscroll_threshhold, INT);
|
||||
E_CONFIG_VAL(D, T, thumbscroll_momentum_threshhold, DOUBLE);
|
||||
E_CONFIG_VAL(D, T, thumbscroll_friction, DOUBLE);
|
||||
|
||||
e_config = e_config_domain_load("e", _e_config_edd);
|
||||
if (e_config)
|
||||
|
@ -811,6 +816,7 @@ e_config_init(void)
|
|||
CFG_MODULE("conf_winlist", 1, 1);
|
||||
CFG_MODULE("conf_engine", 1, 1);
|
||||
CFG_MODULE("fileman", 1, 1);
|
||||
CFG_MODULE("conf_interaction", 1, 1);
|
||||
}
|
||||
#if 0
|
||||
{
|
||||
|
@ -1482,6 +1488,13 @@ e_config_init(void)
|
|||
e_config->cache_flush_poll_interval = 512;
|
||||
IFCFGEND;
|
||||
|
||||
IFCFG(0x0124);
|
||||
e_config->thumbscroll_enable = 0;
|
||||
e_config->thumbscroll_threshhold = 8;
|
||||
e_config->thumbscroll_momentum_threshhold = 100.0;
|
||||
e_config->thumbscroll_friction = 1.0;
|
||||
IFCFGEND;
|
||||
|
||||
e_config->config_version = E_CONFIG_FILE_VERSION;
|
||||
|
||||
#if 0 /* example of new config */
|
||||
|
|
|
@ -33,7 +33,7 @@ typedef struct _E_Event_Config_Icon_Theme E_Event_Config_Icon_Theme;
|
|||
/* increment this whenever a new set of config values are added but the users
|
||||
* config doesn't need to be wiped - simply new values need to be put in
|
||||
*/
|
||||
#define E_CONFIG_FILE_GENERATION 0x0123
|
||||
#define E_CONFIG_FILE_GENERATION 0x0124
|
||||
#define E_CONFIG_FILE_VERSION ((E_CONFIG_FILE_EPOCH << 16) | E_CONFIG_FILE_GENERATION)
|
||||
|
||||
#define E_EVAS_ENGINE_DEFAULT 0
|
||||
|
@ -280,6 +280,11 @@ struct _E_Config
|
|||
|
||||
int ping_clients_interval;
|
||||
int cache_flush_poll_interval; // GUI
|
||||
|
||||
int thumbscroll_enable;
|
||||
int thumbscroll_threshhold;
|
||||
double thumbscroll_momentum_threshhold;
|
||||
double thumbscroll_friction;
|
||||
};
|
||||
|
||||
struct _E_Config_Module
|
||||
|
|
|
@ -5082,9 +5082,11 @@ _e_fm2_cb_icon_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|||
|
||||
ic = data;
|
||||
ev = event_info;
|
||||
|
||||
if ((ev->button == 1) && (!ic->drag.dnd))
|
||||
{
|
||||
_e_fm2_mouse_1_handler(ic, 1, ev->modifiers);
|
||||
if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
|
||||
_e_fm2_mouse_1_handler(ic, 1, ev->modifiers);
|
||||
ic->drag.start = 0;
|
||||
ic->drag.dnd = 0;
|
||||
ic->drag.src = 0;
|
||||
|
@ -5143,6 +5145,7 @@ _e_fm2_cb_icon_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_inf
|
|||
E_Fm2_Icon_Info *ici;
|
||||
|
||||
ic = data;
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
|
||||
ev = event_info;
|
||||
if ((ic->drag.start) && (ic->sd->eobj))
|
||||
{
|
||||
|
@ -5538,12 +5541,15 @@ _e_fm2_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|||
}
|
||||
if (sel_change)
|
||||
evas_object_smart_callback_call(sd->obj, "selection_change", NULL);
|
||||
|
||||
if (!sd->config->selection.single)
|
||||
|
||||
if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
|
||||
{
|
||||
sd->selrect.ox = ev->canvas.x;
|
||||
sd->selrect.oy = ev->canvas.y;
|
||||
sd->selecting = 1;
|
||||
if (!sd->config->selection.single)
|
||||
{
|
||||
sd->selrect.ox = ev->canvas.x;
|
||||
sd->selrect.oy = ev->canvas.y;
|
||||
sd->selecting = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ev->button == 3)
|
||||
|
@ -5577,6 +5583,17 @@ _e_fm2_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|||
|
||||
sd = data;
|
||||
ev = event_info;
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
|
||||
{
|
||||
if (sd->selecting)
|
||||
{
|
||||
sd->selecting = 0;
|
||||
sd->selrect.ox = 0;
|
||||
sd->selrect.oy = 0;
|
||||
evas_object_hide(sd->sel_rect);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!sd->selecting) return;
|
||||
|
||||
if (ev->cur.canvas.x < sd->selrect.ox)
|
||||
|
|
|
@ -17,6 +17,7 @@ struct _E_Smart_Data
|
|||
int selected;
|
||||
unsigned char selector : 1;
|
||||
unsigned char multi_select : 1;
|
||||
unsigned char on_hold : 1;
|
||||
};
|
||||
|
||||
static void _e_smart_init (void);
|
||||
|
@ -44,7 +45,7 @@ e_ilist_add(Evas *evas)
|
|||
}
|
||||
|
||||
EAPI void
|
||||
e_ilist_append(Evas_Object *obj, Evas_Object *icon, const char *label, int header, void (*func) (void *data, void *data2), void (*func_hilight) (void *data, void *data2), void *data, void *data2)
|
||||
e_ilist_append(Evas_Object *obj, Evas_Object *icon, const char *label, int header, void (*func) (void *data, void *data2), void (*func_hilight) (void *data, void *data2), void *data, void *data2)
|
||||
{
|
||||
E_Ilist_Item *si;
|
||||
Evas_Coord mw = 0, mh = 0;
|
||||
|
@ -390,7 +391,10 @@ e_ilist_selected_set(Evas_Object *obj, int n)
|
|||
edje_object_signal_emit(si->o_base, "e,state,selected", "e");
|
||||
if (si->func_hilight) si->func_hilight(si->data, si->data2);
|
||||
if (sd->selector) return;
|
||||
if (si->func) si->func(si->data, si->data2);
|
||||
if (!sd->on_hold)
|
||||
{
|
||||
if (si->func) si->func(si->data, si->data2);
|
||||
}
|
||||
}
|
||||
|
||||
EAPI int
|
||||
|
@ -666,7 +670,10 @@ e_ilist_multi_select(Evas_Object *obj, int n)
|
|||
si->selected = 0;
|
||||
if (si->func_hilight) si->func_hilight(si->data, si->data2);
|
||||
if (sd->selector) return;
|
||||
if (si->func) si->func(si->data, si->data2);
|
||||
if (!sd->on_hold)
|
||||
{
|
||||
if (si->func) si->func(si->data, si->data2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
si->selected = 1;
|
||||
|
@ -674,7 +681,10 @@ e_ilist_multi_select(Evas_Object *obj, int n)
|
|||
edje_object_signal_emit(si->o_base, "e,state,selected", "e");
|
||||
if (si->func_hilight) si->func_hilight(si->data, si->data2);
|
||||
if (sd->selector) return;
|
||||
if (si->func) si->func(si->data, si->data2);
|
||||
if (!sd->on_hold)
|
||||
{
|
||||
if (si->func) si->func(si->data, si->data2);
|
||||
}
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
@ -841,6 +851,9 @@ _e_smart_event_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_
|
|||
si = data;
|
||||
sd = si->sd;
|
||||
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) sd->on_hold = 1;
|
||||
else sd->on_hold = 0;
|
||||
|
||||
if (si->header) return;
|
||||
if (!sd->items) return;
|
||||
for (i = 0, l = sd->items; l; l = l->next, i++)
|
||||
|
@ -876,12 +889,20 @@ _e_smart_event_mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_in
|
|||
ev = event_info;
|
||||
si = data;
|
||||
sd = si->sd;
|
||||
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) sd->on_hold = 1;
|
||||
else sd->on_hold = 0;
|
||||
|
||||
if (si->header) return;
|
||||
if (!sd->items) return;
|
||||
if (!sd->selector) return;
|
||||
si = evas_list_nth(sd->items, sd->selected);
|
||||
if (!si) return;
|
||||
if (sd->on_hold)
|
||||
{
|
||||
sd->on_hold = 0;
|
||||
return;
|
||||
}
|
||||
if (si->func) si->func(si->data, si->data2);
|
||||
}
|
||||
|
||||
|
@ -896,6 +917,10 @@ _e_smart_event_key_down(void *data, Evas *evas, Evas_Object *obj, void *event_in
|
|||
sd = data;
|
||||
ev = event_info;
|
||||
ns = sd->selected;
|
||||
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) sd->on_hold = 1;
|
||||
else sd->on_hold = 0;
|
||||
|
||||
if ((!strcmp(ev->keyname, "Up")) || (!strcmp(ev->keyname, "KP_Up")))
|
||||
{
|
||||
n = ns;
|
||||
|
@ -1004,10 +1029,14 @@ _e_smart_event_key_down(void *data, Evas *evas, Evas_Object *obj, void *event_in
|
|||
(!strcmp(ev->keyname, "KP_Enter")) ||
|
||||
(!strcmp(ev->keyname, "space")))
|
||||
{
|
||||
si = evas_list_nth(sd->items, sd->selected);
|
||||
if (si)
|
||||
if (!sd->on_hold)
|
||||
{
|
||||
if (si->func) si->func(si->data, si->data2);
|
||||
si = evas_list_nth(sd->items, sd->selected);
|
||||
if (si)
|
||||
{
|
||||
if (si->func) si->func(si->data, si->data2);
|
||||
}
|
||||
}
|
||||
}
|
||||
sd->on_hold = 0;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,20 @@ struct _E_Smart_Data
|
|||
Evas_Object *event_obj;
|
||||
|
||||
E_Scrollframe_Policy hbar_flags, vbar_flags;
|
||||
|
||||
struct {
|
||||
unsigned char now : 1;
|
||||
unsigned char dragged : 1;
|
||||
Evas_Coord x, y;
|
||||
Evas_Coord sx, sy;
|
||||
Evas_Coord dx, dy;
|
||||
struct {
|
||||
Evas_Coord x, y;
|
||||
double timestamp;
|
||||
} history[20];
|
||||
double anim_start;
|
||||
Ecore_Animator *momentum_animator;
|
||||
} down;
|
||||
|
||||
struct {
|
||||
Evas_Coord w, h;
|
||||
|
@ -34,6 +48,7 @@ struct _E_Smart_Data
|
|||
void (*child_size_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
|
||||
} pan_func;
|
||||
|
||||
|
||||
unsigned char hbar_visible : 1;
|
||||
unsigned char vbar_visible : 1;
|
||||
unsigned char extern_pan : 1;
|
||||
|
@ -44,6 +59,9 @@ static void _e_smart_child_del_hook(void *data, Evas *e, Evas_Object *obj, void
|
|||
static void _e_smart_pan_changed_hook(void *data, Evas_Object *obj, void *event_info);
|
||||
static void _e_smart_pan_pan_changed_hook(void *data, Evas_Object *obj, void *event_info);
|
||||
static void _e_smart_event_wheel(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||
static void _e_smart_event_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||
static void _e_smart_event_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||
static void _e_smart_event_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||
static void _e_smart_event_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||
static void _e_smart_edje_drag_v(void *data, Evas_Object *obj, const char *emission, const char *source);
|
||||
static void _e_smart_edje_drag_h(void *data, Evas_Object *obj, const char *emission, const char *source);
|
||||
|
@ -382,6 +400,168 @@ _e_smart_event_wheel(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|||
e_scrollframe_child_pos_set(sd->smart_obj, x, y);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_smart_event_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Evas_Event_Mouse_Down *ev;
|
||||
E_Smart_Data *sd;
|
||||
Evas_Coord x = 0, y = 0;
|
||||
|
||||
sd = data;
|
||||
ev = event_info;
|
||||
if (e_config->thumbscroll_enable)
|
||||
{
|
||||
if (sd->down.momentum_animator)
|
||||
{
|
||||
ecore_animator_del(sd->down.momentum_animator);
|
||||
sd->down.momentum_animator = NULL;
|
||||
}
|
||||
if (ev->button == 1)
|
||||
{
|
||||
sd->down.now = 1;
|
||||
sd->down.dragged = 0;
|
||||
sd->down.x = ev->canvas.x;
|
||||
sd->down.y = ev->canvas.y;
|
||||
e_scrollframe_child_pos_get(sd->smart_obj, &x, &y);
|
||||
sd->down.sx = x;
|
||||
sd->down.sy = y;
|
||||
memset(&(sd->down.history[0]), 0, sizeof(sd->down.history[0]) * 20);
|
||||
sd->down.history[0].timestamp = ecore_time_get();
|
||||
sd->down.history[0].x = ev->canvas.x;
|
||||
sd->down.history[0].y = ev->canvas.y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
_e_cb_momentum_animator(void *data)
|
||||
{
|
||||
E_Smart_Data *sd;
|
||||
double t, dt, p;
|
||||
Evas_Coord x, y, dx, dy;
|
||||
|
||||
sd = data;
|
||||
t = ecore_time_get();
|
||||
dt = t - sd->down.anim_start;
|
||||
if (dt >= 0.0)
|
||||
{
|
||||
dt = dt / e_config->thumbscroll_friction;
|
||||
if (dt > 1.0) dt = 1.0;
|
||||
p = 1.0 - ((1.0 - dt) * (1.0 - dt) * (1.0 - dt));
|
||||
dx = (sd->down.dx * e_config->thumbscroll_friction * p);
|
||||
dy = (sd->down.dy * e_config->thumbscroll_friction * p);
|
||||
x = sd->down.sx - dx;
|
||||
y = sd->down.sy - dy;
|
||||
e_scrollframe_child_pos_set(sd->smart_obj, x, y);
|
||||
if (dt >= 1.0)
|
||||
{
|
||||
sd->down.momentum_animator = NULL;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_smart_event_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Evas_Event_Mouse_Down *ev;
|
||||
E_Smart_Data *sd;
|
||||
Evas_Coord x = 0, y = 0;
|
||||
|
||||
sd = data;
|
||||
ev = event_info;
|
||||
if (e_config->thumbscroll_enable)
|
||||
{
|
||||
if (ev->button == 1)
|
||||
{
|
||||
|
||||
x = ev->canvas.x - sd->down.x;
|
||||
y = ev->canvas.y - sd->down.y;
|
||||
if (sd->down.dragged)
|
||||
{
|
||||
double t, at, dt;
|
||||
int i;
|
||||
Evas_Coord ax, ay, dx, dy, vel;
|
||||
|
||||
t = ecore_time_get();
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
ax = ev->canvas.x;
|
||||
ay = ev->canvas.y;
|
||||
at = 0.0;
|
||||
for (i = 0; i < 20; i++)
|
||||
{
|
||||
dt = t - sd->down.history[i].timestamp;
|
||||
if (dt > 0.2) break;
|
||||
at += dt;
|
||||
ax += sd->down.history[i].x;
|
||||
ay += sd->down.history[i].y;
|
||||
}
|
||||
ax /= (i + 1);
|
||||
ay /= (i + 1);
|
||||
at /= (i + 1);
|
||||
at *= 4.0;
|
||||
dx = ev->canvas.x - ax;
|
||||
dy = ev->canvas.y - ay;
|
||||
if (at > 0)
|
||||
{
|
||||
vel = sqrt((dx * dx) + (dy * dy)) / at;
|
||||
if ((e_config->thumbscroll_friction > 0.0) &&
|
||||
(vel > e_config->thumbscroll_momentum_threshhold))
|
||||
{
|
||||
if (!sd->down.momentum_animator)
|
||||
sd->down.momentum_animator = ecore_animator_add(_e_cb_momentum_animator, sd);
|
||||
sd->down.dx = ((double)dx / at);
|
||||
sd->down.dy = ((double)dy / at);
|
||||
sd->down.anim_start = t;
|
||||
e_scrollframe_child_pos_get(sd->smart_obj, &x, &y);
|
||||
sd->down.sx = x;
|
||||
sd->down.sy = y;
|
||||
}
|
||||
}
|
||||
}
|
||||
sd->down.dragged = 0;
|
||||
sd->down.now = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_e_smart_event_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Evas_Event_Mouse_Move *ev;
|
||||
E_Smart_Data *sd;
|
||||
Evas_Coord x = 0, y = 0;
|
||||
|
||||
sd = data;
|
||||
ev = event_info;
|
||||
if (e_config->thumbscroll_enable)
|
||||
{
|
||||
if (sd->down.now)
|
||||
{
|
||||
memmove(&(sd->down.history[1]), &(sd->down.history[0]),
|
||||
sizeof(sd->down.history[0]) * 19);
|
||||
sd->down.history[0].timestamp = ecore_time_get();
|
||||
sd->down.history[0].x = ev->cur.canvas.x;
|
||||
sd->down.history[0].y = ev->cur.canvas.y;
|
||||
|
||||
x = ev->cur.canvas.x - sd->down.x;
|
||||
y = ev->cur.canvas.y - sd->down.y;
|
||||
if ((sd->down.dragged) ||
|
||||
(((x * x) + (y * y)) >
|
||||
(e_config->thumbscroll_threshhold *
|
||||
e_config->thumbscroll_threshhold)))
|
||||
{
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
sd->down.dragged = 1;
|
||||
}
|
||||
x = sd->down.sx - (ev->cur.canvas.x - sd->down.x);
|
||||
y = sd->down.sy - (ev->cur.canvas.y - sd->down.y);
|
||||
e_scrollframe_child_pos_set(sd->smart_obj, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_e_smart_event_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
|
@ -698,6 +878,9 @@ _e_smart_add(Evas_Object *obj)
|
|||
sd->event_obj = o;
|
||||
evas_object_color_set(o, 0, 0, 0, 0);
|
||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_WHEEL, _e_smart_event_wheel, sd);
|
||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _e_smart_event_mouse_down, sd);
|
||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, _e_smart_event_mouse_up, sd);
|
||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, _e_smart_event_mouse_move, sd);
|
||||
evas_object_smart_member_add(o, obj);
|
||||
evas_object_repeat_events_set(o, 1);
|
||||
|
||||
|
@ -717,6 +900,7 @@ _e_smart_del(Evas_Object *obj)
|
|||
if (!sd->extern_pan) evas_object_del(sd->pan_obj);
|
||||
evas_object_del(sd->edje_obj);
|
||||
evas_object_del(sd->event_obj);
|
||||
if (sd->down.momentum_animator) ecore_animator_del(sd->down.momentum_animator);
|
||||
free(sd);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,8 @@ struct _E_Smart_Data
|
|||
Evas_Object *box_obj;
|
||||
Evas_List *items;
|
||||
int selected;
|
||||
unsigned char selector:1;
|
||||
unsigned char selector : 1;
|
||||
unsigned char on_hold : 1;
|
||||
};
|
||||
|
||||
struct _E_Smart_Item
|
||||
|
@ -121,8 +122,11 @@ e_tlist_selected_set(Evas_Object * obj, int n)
|
|||
si->func_hilight(si->data, si->data2);
|
||||
if (!sd->selector)
|
||||
{
|
||||
if (si->func)
|
||||
si->func(si->data, si->data2);
|
||||
if (!sd->on_hold)
|
||||
{
|
||||
if (si->func)
|
||||
si->func(si->data, si->data2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -369,6 +373,10 @@ _e_smart_event_mouse_down(void *data, Evas * e, Evas_Object * obj,
|
|||
|
||||
si = data;
|
||||
ev = event_info;
|
||||
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) si->sd->on_hold = 1;
|
||||
else si->sd->on_hold = 0;
|
||||
|
||||
for (i = 0, l = si->sd->items; l; l = l->next, i++)
|
||||
{
|
||||
if (l->data == si)
|
||||
|
@ -388,15 +396,22 @@ _e_smart_event_mouse_up(void *data, Evas * e, Evas_Object * obj,
|
|||
|
||||
si = data;
|
||||
ev = event_info;
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) si->sd->on_hold = 1;
|
||||
else si->sd->on_hold = 0;
|
||||
|
||||
if (si->sd->selector)
|
||||
{
|
||||
si = evas_list_nth(si->sd->items, si->sd->selected);
|
||||
if (si)
|
||||
{
|
||||
if (si->func)
|
||||
si->func(si->data, si->data2);
|
||||
if (!si->sd->on_hold)
|
||||
{
|
||||
if (si->func)
|
||||
si->func(si->data, si->data2);
|
||||
}
|
||||
}
|
||||
}
|
||||
si->sd->on_hold = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -424,13 +439,16 @@ _e_smart_event_key_down(void *data, Evas * e, Evas_Object * obj,
|
|||
}
|
||||
else if ((!strcmp(ev->keyname, "Return")) || (!strcmp(ev->keyname, "space")))
|
||||
{
|
||||
E_Smart_Item *si;
|
||||
|
||||
si = evas_list_nth(sd->items, sd->selected);
|
||||
if (si)
|
||||
if (!sd->on_hold)
|
||||
{
|
||||
if (si->func)
|
||||
si->func(si->data, si->data2);
|
||||
E_Smart_Item *si;
|
||||
|
||||
si = evas_list_nth(sd->items, sd->selected);
|
||||
if (si)
|
||||
{
|
||||
if (si->func)
|
||||
si->func(si->data, si->data2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,8 @@ conf_performance \
|
|||
conf_winlist \
|
||||
conf_exebuf \
|
||||
conf_paths \
|
||||
conf_mime
|
||||
conf_mime \
|
||||
conf_interaction
|
||||
|
||||
if HAVE_TEMPERATURE
|
||||
SUBDIRS += temperature
|
||||
|
|
|
@ -312,8 +312,8 @@ _battery_cb_check(void *data)
|
|||
e_dialog_button_add(dia, _("OK"), NULL, NULL, NULL);
|
||||
e_win_centered_set(dia->win, 1);
|
||||
e_dialog_show(dia);
|
||||
edje_object_signal_emit(inst->o_battery, "e,action,pulse,start", "e");
|
||||
}
|
||||
edje_object_signal_emit(inst->o_battery, "e,action,pulse,start", "e");
|
||||
}
|
||||
edje_object_part_text_set(inst->o_battery, "e.text.reading", ret->reading);
|
||||
edje_object_part_text_set(inst->o_battery, "e.text.time", ret->time);
|
||||
|
|
|
@ -148,6 +148,7 @@ e_configure_show(E_Container *con)
|
|||
/* Category List */
|
||||
of = e_widget_framelist_add(eco->evas, _("Categories"), 1);
|
||||
eco->cat_list = e_widget_ilist_add(eco->evas, 32, 32, NULL);
|
||||
e_widget_ilist_selector_set(eco->cat_list, 1);
|
||||
/***--- fill ---***/
|
||||
_e_configure_fill_cat_list(eco);
|
||||
e_widget_on_focus_hook_set(eco->cat_list, _e_configure_focus_cb, eco->win);
|
||||
|
@ -182,6 +183,14 @@ e_configure_show(E_Container *con)
|
|||
/* Preselect "Appearance" */
|
||||
e_widget_focus_set(eco->cat_list, 1);
|
||||
e_widget_ilist_selected_set(eco->cat_list, 0);
|
||||
|
||||
if (eco->cats)
|
||||
{
|
||||
E_Configure_Category *cat;
|
||||
|
||||
cat = eco->cats->data;
|
||||
_e_configure_category_cb(cat);
|
||||
}
|
||||
|
||||
_e_configure = eco;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
.deps
|
||||
.libs
|
||||
Makefile
|
||||
Makefile.in
|
||||
*.lo
|
||||
module.la
|
||||
module.desktop
|
|
@ -0,0 +1,31 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
MODULE = conf_interaction
|
||||
|
||||
# data files for the module
|
||||
filesdir = $(libdir)/enlightenment/modules/$(MODULE)
|
||||
files_DATA = \
|
||||
e-module-$(MODULE).edj module.desktop
|
||||
|
||||
EXTRA_DIST = $(files_DATA)
|
||||
|
||||
# the module .so file
|
||||
INCLUDES = -I. \
|
||||
-I$(top_srcdir) \
|
||||
-I$(top_srcdir)/src/modules/$(MODULE) \
|
||||
-I$(top_srcdir)/src/bin \
|
||||
-I$(top_srcdir)/src/lib \
|
||||
-I$(top_srcdir)/src/modules \
|
||||
@e_cflags@
|
||||
pkgdir = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH)
|
||||
pkg_LTLIBRARIES = module.la
|
||||
module_la_SOURCES = e_mod_main.c \
|
||||
e_mod_main.h \
|
||||
e_int_config_interaction.c \
|
||||
e_int_config_interaction.h
|
||||
|
||||
module_la_LIBADD = @e_libs@ @dlopen_libs@
|
||||
module_la_LDFLAGS = -module -avoid-version
|
||||
module_la_DEPENDENCIES = $(top_builddir)/config.h
|
||||
|
||||
uninstall:
|
||||
rm -rf $(DESTDIR)$(libdir)/enlightenment/modules/$(MODULE)
|
Binary file not shown.
|
@ -0,0 +1,146 @@
|
|||
#include "e.h"
|
||||
|
||||
static void *_create_data(E_Config_Dialog *cfd);
|
||||
static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||
|
||||
static void _enabled_cb(void *data, Evas_Object *obj, void *event_info);
|
||||
|
||||
struct _E_Config_Dialog_Data
|
||||
{
|
||||
Evas_Object *l1, *l2, *l3, *sl1, *sl2, *sl3;
|
||||
int thumbscroll_enable;
|
||||
int thumbscroll_threshhold;
|
||||
double thumbscroll_momentum_threshhold;
|
||||
double thumbscroll_friction;
|
||||
};
|
||||
|
||||
EAPI E_Config_Dialog *
|
||||
e_int_config_interaction(E_Container *con, const char *params __UNUSED__)
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
E_Config_Dialog_View *v;
|
||||
|
||||
if (e_config_dialog_find("E", "_config_config_interaction_dialog")) return NULL;
|
||||
v = E_NEW(E_Config_Dialog_View, 1);
|
||||
|
||||
v->create_cfdata = _create_data;
|
||||
v->free_cfdata = _free_data;
|
||||
v->basic.apply_cfdata = _basic_apply_data;
|
||||
v->basic.create_widgets = _basic_create_widgets;
|
||||
v->override_auto_apply = 1;
|
||||
|
||||
cfd = e_config_dialog_new(con,
|
||||
_("Interaction Settings"),
|
||||
"E", "_config_config_interaction_dialog",
|
||||
"enlightenment/configuration", 0, v, NULL);
|
||||
return cfd;
|
||||
}
|
||||
|
||||
static void
|
||||
_fill_data(E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
cfdata->thumbscroll_enable = e_config->thumbscroll_enable;
|
||||
cfdata->thumbscroll_threshhold = e_config->thumbscroll_threshhold;
|
||||
cfdata->thumbscroll_momentum_threshhold = e_config->thumbscroll_momentum_threshhold;
|
||||
cfdata->thumbscroll_friction = e_config->thumbscroll_friction;
|
||||
}
|
||||
|
||||
static void *
|
||||
_create_data(E_Config_Dialog *cfd)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
||||
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
||||
_fill_data(cfdata);
|
||||
return cfdata;
|
||||
}
|
||||
|
||||
static void
|
||||
_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
E_FREE(cfdata);
|
||||
}
|
||||
|
||||
static int
|
||||
_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
e_config->thumbscroll_enable = cfdata->thumbscroll_enable;
|
||||
e_config->thumbscroll_threshhold = cfdata->thumbscroll_threshhold;
|
||||
e_config->thumbscroll_momentum_threshhold = cfdata->thumbscroll_momentum_threshhold;
|
||||
e_config->thumbscroll_friction = cfdata->thumbscroll_friction;
|
||||
e_config_save_queue();
|
||||
return 1;
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
Evas_Object *o, *ob;
|
||||
E_Radio_Group *rg;
|
||||
|
||||
o = e_widget_list_add(evas, 0, 0);
|
||||
|
||||
ob = e_widget_check_add(evas, _("Enable Thumbscroll"), &(cfdata->thumbscroll_enable));
|
||||
e_widget_list_object_append(o, ob, 1, 1, 0.5);
|
||||
evas_object_smart_callback_add(ob, "changed", _enabled_cb, cfdata);
|
||||
|
||||
ob = e_widget_label_add(evas, _("Threshhold for a thumb drag"));
|
||||
e_widget_list_object_append(o, ob, 1, 1, 0.5);
|
||||
cfdata->l1 = ob;
|
||||
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f pixels"), 0, 64, 4, 0, NULL, &(cfdata->thumbscroll_threshhold), 200);
|
||||
e_widget_list_object_append(o, ob, 1, 1, 0.5);
|
||||
cfdata->sl1 = ob;
|
||||
|
||||
ob = e_widget_label_add(evas, _("Threshhold for for applying drag momentum"));
|
||||
e_widget_list_object_append(o, ob, 1, 1, 0.5);
|
||||
cfdata->l2 = ob;
|
||||
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f pixels/sec"), 0, 2000, 20, 0, &(cfdata->thumbscroll_momentum_threshhold), NULL, 200);
|
||||
e_widget_list_object_append(o, ob, 1, 1, 0.5);
|
||||
cfdata->sl2 = ob;
|
||||
|
||||
ob = e_widget_label_add(evas, _("Friction slowdown"));
|
||||
e_widget_list_object_append(o, ob, 1, 1, 0.5);
|
||||
cfdata->l3 = ob;
|
||||
ob = e_widget_slider_add(evas, 1, 0, _("%1.2f sec"), 0.00, 5.0, 0.1, 0, &(cfdata->thumbscroll_friction), NULL, 200);
|
||||
e_widget_list_object_append(o, ob, 1, 1, 0.5);
|
||||
cfdata->sl3 = ob;
|
||||
|
||||
if (!e_config->thumbscroll_enable)
|
||||
{
|
||||
e_widget_disabled_set(cfdata->l1, 1);
|
||||
e_widget_disabled_set(cfdata->sl1, 1);
|
||||
e_widget_disabled_set(cfdata->l2, 1);
|
||||
e_widget_disabled_set(cfdata->sl2, 1);
|
||||
e_widget_disabled_set(cfdata->l3, 1);
|
||||
e_widget_disabled_set(cfdata->sl3, 1);
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
||||
static void
|
||||
_enabled_cb(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
||||
cfdata = data;
|
||||
if (!cfdata->thumbscroll_enable)
|
||||
{
|
||||
e_widget_disabled_set(cfdata->l1, 1);
|
||||
e_widget_disabled_set(cfdata->sl1, 1);
|
||||
e_widget_disabled_set(cfdata->l2, 1);
|
||||
e_widget_disabled_set(cfdata->sl2, 1);
|
||||
e_widget_disabled_set(cfdata->l3, 1);
|
||||
e_widget_disabled_set(cfdata->sl3, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
e_widget_disabled_set(cfdata->l1, 0);
|
||||
e_widget_disabled_set(cfdata->sl1, 0);
|
||||
e_widget_disabled_set(cfdata->l2, 0);
|
||||
e_widget_disabled_set(cfdata->sl2, 0);
|
||||
e_widget_disabled_set(cfdata->l3, 0);
|
||||
e_widget_disabled_set(cfdata->sl3, 0);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
#ifdef E_TYPEDEFS
|
||||
#else
|
||||
#ifndef E_INT_CONFIG_INTERACTION_H
|
||||
#define E_INT_CONFIG_INTERACTION_H
|
||||
|
||||
EAPI E_Config_Dialog *e_int_config_interaction(E_Container *con, const char *params __UNUSED__);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||
*/
|
||||
#include "e.h"
|
||||
#include "e_mod_main.h"
|
||||
|
||||
/***************************************************************************/
|
||||
/**/
|
||||
/* actual module specifics */
|
||||
|
||||
static E_Module *conf_module = NULL;
|
||||
|
||||
/**/
|
||||
/***************************************************************************/
|
||||
|
||||
/***************************************************************************/
|
||||
/**/
|
||||
|
||||
/**/
|
||||
/***************************************************************************/
|
||||
|
||||
/***************************************************************************/
|
||||
/**/
|
||||
/* module setup */
|
||||
EAPI E_Module_Api e_modapi =
|
||||
{
|
||||
E_MODULE_API_VERSION,
|
||||
"Configuration - Interaction"
|
||||
};
|
||||
|
||||
EAPI void *
|
||||
e_modapi_init(E_Module *m)
|
||||
{
|
||||
e_configure_registry_category_add("advanced", 80, _("Advanced"), NULL, "enlightenment/advanced");
|
||||
e_configure_registry_item_add("advanced/interaction", 11, _("Interaction"), NULL, "enlightenment/configuration", e_int_config_interaction);
|
||||
conf_module = m;
|
||||
e_module_delayed_set(m, 1);
|
||||
return m;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_modapi_shutdown(E_Module *m)
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
while ((cfd = e_config_dialog_get("E", "_config_config_interaction_dialog"))) e_object_del(E_OBJECT(cfd));
|
||||
e_configure_registry_item_del("advanced/interaction");
|
||||
e_configure_registry_category_del("advanced");
|
||||
conf_module = NULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_modapi_save(E_Module *m)
|
||||
{
|
||||
return 1;
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||
*/
|
||||
#ifndef E_MOD_MAIN_H
|
||||
#define E_MOD_MAIN_H
|
||||
|
||||
#define E_TYPEDEFS 1
|
||||
#include "e_int_config_interaction.h"
|
||||
|
||||
#undef E_TYPEDEFS
|
||||
#include "e_int_config_interaction.h"
|
||||
|
||||
EAPI extern E_Module_Api e_modapi;
|
||||
|
||||
EAPI void *e_modapi_init (E_Module *m);
|
||||
EAPI int e_modapi_shutdown (E_Module *m);
|
||||
EAPI int e_modapi_save (E_Module *m);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,24 @@
|
|||
[Desktop Entry]
|
||||
Type=Link
|
||||
Name=Configuration - Interaction
|
||||
Name[de]=
|
||||
Name[es]=
|
||||
Name[fr]=
|
||||
Name[it]=
|
||||
Name[ja]=
|
||||
Name[pt]=
|
||||
Name[pt_BR]=
|
||||
Name[zh_CN]=
|
||||
Name[zh_TW]=
|
||||
Icon=e-module-conf_interaction
|
||||
Comment=<hilight>E17 Configuration Applet</hilight><br><br>Configure default user interaction settings.
|
||||
Comment[de]=
|
||||
Comment[es]=
|
||||
Comment[fr]=
|
||||
Comment[it]=
|
||||
Comment[ja]=
|
||||
Comment[pt]=
|
||||
Comment[pt_BR]=
|
||||
Comment[zh_CN]=
|
||||
Comment[zh_TW]=
|
||||
X-Enlightenment-ModuleType=config
|
Loading…
Reference in New Issue