From dd4fa1244b3ef24e4b9abf1b9b46068f557354d3 Mon Sep 17 00:00:00 2001 From: Hannes Janetzek Date: Tue, 18 May 2010 15:12:32 +0000 Subject: [PATCH] - fix segv with complete input - plugin can now set item selected by item change event - better slide dir parameter - fix comparison with unitialized values, thanks valgrind SVN revision: 48981 --- src/modules/everything-apps/e_mod_main.c | 12 +++++++++--- src/modules/everything-files/e_mod_main.c | 7 ++++--- src/modules/everything-windows/e_mod_main.c | 17 ++++++++--------- src/modules/everything/evry.c | 7 ++++--- src/modules/everything/evry_plug_view_thumb.c | 11 +++++++---- 5 files changed, 32 insertions(+), 22 deletions(-) diff --git a/src/modules/everything-apps/e_mod_main.c b/src/modules/everything-apps/e_mod_main.c index 4e13bc345..058a022d4 100644 --- a/src/modules/everything-apps/e_mod_main.c +++ b/src/modules/everything-apps/e_mod_main.c @@ -258,8 +258,13 @@ _icon_get(Evry_Item *it, Evas *e) Evas_Object *o = NULL; if (app->desktop) - o = e_util_desktop_icon_add(app->desktop, 128, e); + { + o = evry->icon_theme_get(app->desktop->icon, e); + if (!o) + o = e_util_desktop_icon_add(app->desktop, 128, e); + } + if (!o) o = evry->icon_theme_get("system-run", e); @@ -271,6 +276,7 @@ _item_free(Evry_Item *item) { GET_APP(app, item); + if (app->desktop) efreet_desktop_free(app->desktop); if (app->file) @@ -426,8 +432,8 @@ _add_desktop_list(Plugin *p, Eina_List *apps, const char *input) exec = ecore_file_file_get(desktop->exec); if (exec && (end = strchr(exec, '%'))) { - strncpy(buf, exec, end - exec - 1); - buf[end - exec] = 0; + strncpy(buf, exec, (end - exec) - 1); + buf[(end - exec)-1] = '\0'; m1 = evry->fuzzy_match(buf, input); } else diff --git a/src/modules/everything-files/e_mod_main.c b/src/modules/everything-files/e_mod_main.c index 874af2709..092e99b46 100644 --- a/src/modules/everything-files/e_mod_main.c +++ b/src/modules/everything-files/e_mod_main.c @@ -146,9 +146,10 @@ static void _item_free(Evry_Item *it) { GET_FILE(file, it); - if (file->url) eina_stringshare_del(file->url); - if (file->path) eina_stringshare_del(file->path); - if (file->mime) eina_stringshare_del(file->mime); + + IF_RELEASE(file->url); + IF_RELEASE(file->path); + IF_RELEASE(file->mime); E_FREE(file); } diff --git a/src/modules/everything-windows/e_mod_main.c b/src/modules/everything-windows/e_mod_main.c index 4b9b84535..399da6ddb 100644 --- a/src/modules/everything-windows/e_mod_main.c +++ b/src/modules/everything-windows/e_mod_main.c @@ -15,7 +15,7 @@ static const Evry_API *evry = NULL; static Evry_Module *evry_module = NULL; -static Evry_Plugin *p1; +static Evry_Plugin *_plug; static Eina_List *handlers = NULL; static Eina_Hash *border_hash = NULL; static Eina_List *_actions = NULL; @@ -348,7 +348,6 @@ _act_border(Evry_Action *act) static int _plugins_init(const Evry_API *_api) { - Evry_Plugin *p; Evry_Action *act; if (evry_module->active) @@ -359,12 +358,12 @@ _plugins_init(const Evry_API *_api) if (!evry->api_version_check(EVRY_API_VERSION)) return EINA_FALSE; - p1 = EVRY_PLUGIN_NEW(Evry_Plugin, N_("Windows"), NULL, EVRY_TYPE_BORDER, - _begin, _cleanup, _fetch, NULL); - - p1->transient = EINA_TRUE; - evry->plugin_register(p1, EVRY_PLUGIN_SUBJECT, 2); - + _plug = EVRY_PLUGIN_NEW(Evry_Plugin, N_("Windows"), + "preferences-system-windows", + EVRY_TYPE_BORDER, + _begin, _cleanup, _fetch, NULL); + _plug->transient = EINA_TRUE; + evry->plugin_register(_plug, EVRY_PLUGIN_SUBJECT, 2); act = EVRY_ACTION_NEW(_("Switch to Window"), EVRY_TYPE_BORDER, 0, "go-next", @@ -412,7 +411,7 @@ _plugins_shutdown(void) if (!evry_module->active) return; - EVRY_PLUGIN_FREE(p1); + EVRY_PLUGIN_FREE(_plug); EINA_LIST_FREE(_actions, act) evry->action_free(act); diff --git a/src/modules/everything/evry.c b/src/modules/everything/evry.c index 46be2eed5..699c3b4d7 100644 --- a/src/modules/everything/evry.c +++ b/src/modules/everything/evry.c @@ -1661,6 +1661,8 @@ _evry_input_complete(Evry_State *s) char *input = NULL; Evry_Item *it = s->cur_item; + if (!it) return 0; + evry_item_ref(it); s->item_auto_selected = EINA_FALSE; @@ -1694,6 +1696,8 @@ _evry_cheat_history(Evry_State *s, int promote, int delete) Eina_List *l, *ll; Evry_Item *it = s->cur_item; + if (!it) return 0; + if (!(ht = evry_history_types_get(it->type))) return 1; @@ -1861,9 +1865,6 @@ _evry_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event) else if ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) && (!strcmp(ev->key, "Delete") || !strcmp(ev->key, "Insert"))) { - if (!s->cur_item) - goto end; - int delete = (!strcmp(ev->key, "Delete") && (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT)); int promote = (!strcmp(ev->key, "Insert")); diff --git a/src/modules/everything/evry_plug_view_thumb.c b/src/modules/everything/evry_plug_view_thumb.c index 805fd1d3c..b2b22a5b2 100644 --- a/src/modules/everything/evry_plug_view_thumb.c +++ b/src/modules/everything/evry_plug_view_thumb.c @@ -1486,7 +1486,10 @@ _cb_item_changed(void *data, int type, void *event) if (ev->changed_selection) { if (it->item->selected) - _pan_item_select(v->span, it, 1); + { + evry_item_select(v->state, ev->item); + _pan_item_select(v->span, it, 1); + } } if (!it->visible) @@ -1551,7 +1554,7 @@ _view_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info) diff_x = abs(ev->cur.canvas.x - sd->mouse_x); diff_y = abs(ev->cur.canvas.y - sd->mouse_y); - if (diff_y > (diff_x + 10) * 2) + if (diff_y > 10 + (diff_x/2)) goto end; if ((sd->cur_item != sd->it_down) && (diff_x > 10)) @@ -1563,14 +1566,14 @@ _view_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info) if ((sd->mouse_button == 1) && (sd->cur_item == sd->it_down)) { - if (ev->cur.canvas.x - sd->mouse_x > 150) + if (ev->cur.canvas.x - sd->mouse_x > 100) { sd->it_down = NULL; sd->mouse_x = 0; sd->mouse_y = 0; evry_browse_back(NULL); } - else if (sd->mouse_x - ev->cur.canvas.x > 150) + else if (sd->mouse_x - ev->cur.canvas.x > 100) { sd->it_down = NULL; sd->mouse_x = 0;