From 05ee192b9824231ac7f0cecb6cf5f2bf426c66e0 Mon Sep 17 00:00:00 2001 From: Stephen 'Okra' Houston Date: Fri, 3 Mar 2017 18:08:40 -0600 Subject: [PATCH] Edi: Add double click expand/contract support on the file panel. --- AUTHORS | 7 ++++--- src/bin/edi_filepanel.c | 13 +++++++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/AUTHORS b/AUTHORS index 86b70eb..0c73ef4 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,6 +1,7 @@ -ajwillia.ms (Andy Williams) -wilsonk (Kelly Wilson) -YOhoho (YeongJong Lee) +ajwillia.ms (Andy Williams) +okra (Stephen Houston) +wilsonk (Kelly Wilson) +YOhoho (YeongJong Lee) Windows compatibility thanks to Vincent Torri Icon created by The Rasterman (Carsten Haitzler) diff --git a/src/bin/edi_filepanel.c b/src/bin/edi_filepanel.c index 705cd19..49cf909 100644 --- a/src/bin/edi_filepanel.c +++ b/src/bin/edi_filepanel.c @@ -161,16 +161,21 @@ static void _item_clicked_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info) { - Evas_Event_Mouse_Down *ev; + Evas_Event_Mouse_Up *ev; Elm_Object_Item *it; Edi_Dir_Data *sd; ev = event_info; - if (ev->button != 3) return; - it = elm_genlist_at_xy_item_get(obj, ev->output.x, ev->output.y, NULL); sd = elm_object_item_data_get(it); + if (ev->button == 1 && it) + { + if (ev->flags == EVAS_BUTTON_DOUBLE_CLICK && elm_genlist_item_type_get(it) == ELM_GENLIST_ITEM_TREE) + elm_genlist_item_expanded_set(it, !elm_genlist_item_expanded_get(it)); + } + if (ev->button != 3) return; + if (sd->isdir) return; @@ -614,7 +619,7 @@ edi_filepanel_add(Evas_Object *parent, Evas_Object *win, elm_box_pack_end(box, list); _root_path = eina_stringshare_add(path); - evas_object_event_callback_add(list, EVAS_CALLBACK_MOUSE_DOWN, + evas_object_event_callback_add(list, EVAS_CALLBACK_MOUSE_UP, _item_clicked_cb, NULL); ecore_event_handler_add(EIO_MONITOR_FILE_CREATED, (Ecore_Event_Handler_Cb)_file_listing_updated, _root_path); ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, (Ecore_Event_Handler_Cb)_file_listing_updated, _root_path);