From 25339554b703755af9c1db9cf32f375cba267575 Mon Sep 17 00:00:00 2001 From: Al Poole Date: Thu, 23 Nov 2017 14:51:29 +0000 Subject: [PATCH] edi_filepanel: select on focus. Use a timer for selecting the file browser item. Click tab and click browser file work as before. Clicking the editor will focus in the browser also with an "unnoticable" delay from the timer poll. --- src/bin/edi_filepanel.c | 19 +++++++++++++++++++ src/bin/editor/edi_editor.c | 3 --- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/bin/edi_filepanel.c b/src/bin/edi_filepanel.c index 274f0f0..0c2f9ec 100644 --- a/src/bin/edi_filepanel.c +++ b/src/bin/edi_filepanel.c @@ -1025,6 +1025,23 @@ _filter_key_down_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) elm_genlist_filter_set(tree, (void *)strdup(match)); } +Eina_Bool +_edi_filepanel_select_check(void *data EINA_UNUSED) +{ + Edi_Mainview_Panel *current; + Edi_Mainview_Item *item; + + current = edi_mainview_panel_current_get(); + if (!current) return ECORE_CALLBACK_RENEW; + + item = edi_mainview_item_current_get(current); + if (!item) return ECORE_CALLBACK_RENEW; + + edi_filepanel_select_path(item->path); + + return ECORE_CALLBACK_RENEW; +} + void edi_filepanel_select_path(const char *path) { @@ -1149,6 +1166,8 @@ edi_filepanel_add(Evas_Object *parent, Evas_Object *win, edi_filepanel_scm_status_update(); + ecore_timer_add(0.1, _edi_filepanel_select_check, NULL); + _root_dir = calloc(1, sizeof(Edi_Dir_Data)); _root_dir->path = path; _file_listing_fill(_root_dir, NULL); diff --git a/src/bin/editor/edi_editor.c b/src/bin/editor/edi_editor.c index e8a7d5e..31e56d8 100644 --- a/src/bin/editor/edi_editor.c +++ b/src/bin/editor/edi_editor.c @@ -1203,9 +1203,6 @@ _focused_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUS code = elm_code_widget_code_get(editor->entry); filename = elm_code_file_path_get(code->file); - - edi_filepanel_select_path(filename); - mtime = ecore_file_mod_time(filename); if ((editor->save_time) && (editor->save_time < mtime))