diff --git a/src/bin/e_dnd.c b/src/bin/e_dnd.c index b72442a03..8e3e5b17e 100644 --- a/src/bin/e_dnd.c +++ b/src/bin/e_dnd.c @@ -618,11 +618,13 @@ _e_drag_win_show(E_Drop_Handler *h) switch (h->obj->type) { case E_GADCON_TYPE: - e_shelf_toggle(e_gadcon_shelf_get((E_Gadcon *)(h->obj)), 1); - break; + /* FIXME: this is wrong - it ASSUMES the holder is a shelf */ +// e_shelf_toggle(e_gadcon_shelf_get((E_Gadcon *)(h->obj)), 1); + break; case E_GADCON_CLIENT_TYPE: - e_shelf_toggle(e_gadcon_shelf_get(((E_Gadcon_Client *)(h->obj))->gadcon), 1); - break; + /* FIXME: this is wrong - it ASSUMES the holder is a shelf */ +// e_shelf_toggle(e_gadcon_shelf_get(((E_Gadcon_Client *)(h->obj))->gadcon), 1); + break; /* FIXME: add more types as needed */ default: break; diff --git a/src/bin/e_scrollframe.c b/src/bin/e_scrollframe.c index de9f5653e..44e38db98 100644 --- a/src/bin/e_scrollframe.c +++ b/src/bin/e_scrollframe.c @@ -30,10 +30,12 @@ struct _E_Smart_Data } history[20]; double anim_start; Ecore_Animator *momentum_animator; + Evas_Coord locked_x, locked_y; unsigned char now : 1; unsigned char dragged : 1; unsigned char dir_x : 1; unsigned char dir_y : 1; + unsigned char locked : 1; } down; struct { @@ -63,6 +65,7 @@ static void _e_smart_pan_changed_hook(void *data, Evas_Object *obj, void *event_ 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 int _e_smart_momentum_animator(void *data); 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); @@ -435,6 +438,7 @@ _e_smart_event_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_inf } if (ev->button == 1) { + printf("down @ %3.3f\n", ecore_time_get()); sd->down.now = 1; sd->down.dragged = 0; sd->down.dir_x = 0; @@ -444,6 +448,7 @@ _e_smart_event_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_inf e_scrollframe_child_pos_get(sd->smart_obj, &x, &y); sd->down.sx = x; sd->down.sy = y; + sd->down.locked = 0; 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; @@ -453,7 +458,7 @@ _e_smart_event_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_inf } static int -_e_cb_momentum_animator(void *data) +_e_smart_momentum_animator(void *data) { E_Smart_Data *sd; double t, dt, p; @@ -494,7 +499,7 @@ _e_smart_event_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info) { if (ev->button == 1) { - + printf("up @ %3.3f\n", ecore_time_get()); x = ev->canvas.x - sd->down.x; y = ev->canvas.y - sd->down.y; if (sd->down.dragged) @@ -529,7 +534,7 @@ _e_smart_event_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info) (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.momentum_animator = ecore_animator_add(_e_smart_momentum_animator, sd); sd->down.dx = ((double)dx / at); sd->down.dy = ((double)dy / at); sd->down.anim_start = t; @@ -565,7 +570,9 @@ _e_smart_event_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_inf sd->down.history[0].y = ev->cur.canvas.y; x = ev->cur.canvas.x - sd->down.x; + if (x < 0) x = -x; y = ev->cur.canvas.y - sd->down.y; + if (y < 0) y = -y; if ((sd->one_dir_at_a_time) && (!sd->down.dir_x) && (!sd->down.dir_y)) { @@ -598,8 +605,15 @@ _e_smart_event_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_inf y = sd->down.sy - (ev->cur.canvas.y - sd->down.y); if ((sd->down.dir_x) || (sd->down.dir_y)) { - if (sd->down.dir_x) y = sd->down.sy; - else x = sd->down.sx; + if (!sd->down.locked) + { + printf("lock dir to x%iy%i\n", sd->down.dir_x, sd->down.dir_y); + sd->down.locked_x = x; + sd->down.locked_y = y; + sd->down.locked = 1; + } + if (sd->down.dir_x) y = sd->down.locked_y; + else x = sd->down.locked_x; } e_scrollframe_child_pos_set(sd->smart_obj, x, y); } diff --git a/src/bin/e_slidecore.c b/src/bin/e_slidecore.c index 6de6bb55d..9a1ad351b 100644 --- a/src/bin/e_slidecore.c +++ b/src/bin/e_slidecore.c @@ -10,9 +10,9 @@ typedef struct _E_Smart_Data E_Smart_Data; typedef struct _E_Smart_Item E_Smart_Item; struct _E_Smart_Data -{ +{ Evas_Coord x, y, w, h; - + Evas_Object *smart_obj; Evas_Object *event_obj; Evas_Object *o1, *o2; @@ -20,7 +20,7 @@ struct _E_Smart_Data Evas_Coord dist, pos; int p1, p2, pn; unsigned char down : 1; -}; +}; struct _E_Smart_Item { @@ -70,7 +70,7 @@ EAPI void e_slidecore_item_add(Evas_Object *obj, const char *label, const char *icon, void (*func) (void *data), void *data) { E_Smart_Item *it; - + API_ENTRY return; it = calloc(1, sizeof(E_Smart_Item)); if (!it) return; @@ -133,10 +133,10 @@ _e_smart_reconfigure(E_Smart_Data *sd) Evas_Coord dp, pos; int p1, p2, at, pl1, pl2, n; int r, g, b, a; - + evas_object_move(sd->event_obj, sd->x, sd->y); evas_object_resize(sd->event_obj, sd->w, sd->h); - + pos = sd->pos; n = evas_list_count(sd->items); while (pos < 0) pos += (sd->dist * n); @@ -144,7 +144,7 @@ _e_smart_reconfigure(E_Smart_Data *sd) p2 = (pos + sd->dist) / sd->dist; dp = pos - (p1 * sd->dist); at = (dp * 255) / (sd->dist - 1); - + while ((p1 < 0) || (p2 < 0)) { p1 += n; @@ -155,7 +155,7 @@ _e_smart_reconfigure(E_Smart_Data *sd) if ((sd->p1 != p1) || (sd->p2 != p2) || (sd->pn != n)) { E_Smart_Item *it1, *it2; - + /* FIXME: delete old o1, o2, create new o1, o2 */ sd->pn = n; if (n > 0) @@ -172,7 +172,7 @@ _e_smart_reconfigure(E_Smart_Data *sd) it2 = evas_list_nth(sd->items, pl2); if (it1 && it2) { - sd->o1 = e_util_icon_theme_icon_add(it1->icon, "512x512", + sd->o1 = e_util_icon_theme_icon_add(it1->icon, "512x512", evas_object_evas_get(sd->smart_obj)); if (sd->o1) { @@ -184,7 +184,7 @@ _e_smart_reconfigure(E_Smart_Data *sd) evas_object_clip_set(sd->o1, evas_object_clip_get(sd->smart_obj)); evas_object_show(sd->o1); } - sd->o2 = e_util_icon_theme_icon_add(it2->icon, "512x512", + sd->o2 = e_util_icon_theme_icon_add(it2->icon, "512x512", evas_object_evas_get(sd->smart_obj)); if (sd->o2) { @@ -196,7 +196,7 @@ _e_smart_reconfigure(E_Smart_Data *sd) evas_object_clip_set(sd->o2, evas_object_clip_get(sd->smart_obj)); evas_object_show(sd->o2); } - if (a < 128) + if (at < 128) { if (it1->func) it1->func(it1->data); } @@ -208,12 +208,12 @@ _e_smart_reconfigure(E_Smart_Data *sd) } } evas_object_color_get(sd->smart_obj, &r, &g, &b, &a); - + evas_object_move(sd->o1, sd->x - sd->dist + dp, sd->y); // printf("SZ: %ix%i\n", sd->w + sd->dist + sd->dist, sd->h); evas_object_resize(sd->o1, sd->w + sd->dist + sd->dist, sd->h); evas_object_color_set(sd->o1, r, g, b, a); - + evas_object_move(sd->o2, sd->x - sd->dist - sd->dist + dp, sd->y); evas_object_resize(sd->o2, sd->w + sd->dist + sd->dist, sd->h); evas_object_color_set(sd->o2, (r * at) / 255, (g * at) / 255, (b * at) / 255, (a * at) / 255); @@ -224,24 +224,24 @@ _e_smart_add(Evas_Object *obj) { E_Smart_Data *sd; Evas_Object *o; - + sd = calloc(1, sizeof(E_Smart_Data)); if (!sd) return; evas_object_smart_data_set(obj, sd); - + sd->smart_obj = obj; sd->x = 0; sd->y = 0; sd->w = 0; sd->h = 0; - + evas_object_propagate_events_set(obj, 0); sd->dist = 48; sd->pos = 0; sd->p1 = -1; sd->p2 = -1; - + o = evas_object_rectangle_add(evas_object_evas_get(obj)); sd->event_obj = o; evas_object_color_set(o, 0, 0, 0, 0); @@ -256,7 +256,19 @@ static void _e_smart_del(Evas_Object *obj) { INTERNAL_ENTRY; + while (sd->items) + { + E_Smart_Item *it; + + it = sd->items->data; + sd->items = evas_list_remove_list(sd->items, sd->items); + if (it->label) evas_stringshare_del(it->label); + if (it->icon) evas_stringshare_del(it->icon); + free(it); + } evas_object_del(sd->event_obj); + if (sd->o1) evas_object_del(sd->o1); + if (sd->o2) evas_object_del(sd->o2); free(sd); } @@ -314,7 +326,7 @@ _e_smart_clip_unset(Evas_Object *obj) { INTERNAL_ENTRY; evas_object_clip_unset(sd->event_obj); -} +} /* never need to touch this */ @@ -328,7 +340,7 @@ _e_smart_init(void) SMART_NAME, EVAS_SMART_CLASS_VERSION, _e_smart_add, - _e_smart_del, + _e_smart_del, _e_smart_move, _e_smart_resize, _e_smart_show, diff --git a/src/bin/e_slidesel.c b/src/bin/e_slidesel.c index 841ae562d..a773c8ada 100644 --- a/src/bin/e_slidesel.c +++ b/src/bin/e_slidesel.c @@ -183,7 +183,7 @@ _e_smart_event_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_inf d1 = ev->cur.canvas.x - sd->down_x; d2 = ev->cur.canvas.y - sd->down_y; d = (d1 * d1) + (d2 * d2); - if (d > (16 * 16)) + if (d > (64 * 64)) { edje_object_signal_emit(sd->edje_obj, "e,state,slide,hint,off", "e"); sd->down_cancel = 1; diff --git a/src/modules/battery/e_mod_main.c b/src/modules/battery/e_mod_main.c index e041aa829..71465fd8b 100644 --- a/src/modules/battery/e_mod_main.c +++ b/src/modules/battery/e_mod_main.c @@ -251,10 +251,10 @@ _battery_cb_check(void *data) #else if (battery_config->battery_check_mode == 0) { - if (ecore_file_is_dir("/proc/acpi")) /* <= 2.6.24 */ - battery_config->battery_check_mode = CHECK_ACPI; - else if (ecore_file_is_dir("/sys/class/power_supply")) /* >= 2.6.24 */ + if (ecore_file_is_dir("/sys/class/power_supply")) /* >= 2.6.24 */ battery_config->battery_check_mode = CHECK_SYS_ACPI; + else if (ecore_file_is_dir("/proc/acpi")) /* <= 2.6.24 */ + battery_config->battery_check_mode = CHECK_ACPI; else if (ecore_file_exists("/proc/apm")) battery_config->battery_check_mode = CHECK_APM; else if (ecore_file_is_dir("/proc/pmu")) @@ -418,7 +418,7 @@ _battery_linux_sys_acpi_check(void) int rate = 1; int level = 0; - if (name && strncmp("BAT",name,3)) continue; + if (name && strncasecmp("BAT", name, 3)) continue; /* present */ snprintf(buf, sizeof(buf), "/sys/class/power_supply/%s/present", name);