mainview: clicking on tabs or filename will focus the editor entry.

Remove focus from tab item as it was stopping us from focussing the
editor entry. This change keeps track of cursors upon item change
and will focus (if possible) the entry. In essence, less clicks!
Clicking tabs or a file in the file panel has the same result.
This commit is contained in:
Al Poole 2017-09-01 18:49:38 +01:00
parent fb6bd4a322
commit 2731c4bb75
1 changed files with 20 additions and 7 deletions

View File

@ -271,14 +271,16 @@ _promote(void *data, Evas_Object *obj EINA_UNUSED,
panel = edi_mainview_panel_for_item_get((Edi_Mainview_Item *)data);
if (panel && panel->current)
{
editor = (Edi_Editor *)evas_object_data_get(panel->current->view, "editor");
if (editor)
elm_object_focus_set(editor->entry, EINA_FALSE);
}
edi_mainview_panel_focus(panel);
editor = (Edi_Editor *)evas_object_data_get(panel->current->view, "editor");
if (editor)
elm_object_focus_set(editor->entry, EINA_FALSE);
edi_mainview_panel_item_select(panel, (Edi_Mainview_Item *)data);
editor = (Edi_Editor *)evas_object_data_get(panel->current->view, "editor");
if (editor)
elm_object_focus_set(editor->entry, EINA_TRUE);
}
static void
@ -335,6 +337,7 @@ _edi_mainview_panel_item_tab_add(Edi_Mainview_Panel *panel, Edi_Path_Options *op
tab = elm_button_add(panel->tabs);
evas_object_size_hint_weight_set(tab, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(tab, 0.0, EVAS_HINT_FILL);
elm_object_focus_allow_set(tab, EINA_FALSE);
elm_layout_theme_set(tab, "multibuttonentry", "btn", "default");
elm_object_part_text_set(tab, "elm.btn.text", basename((char*)options->path));
@ -730,10 +733,12 @@ edi_mainview_panel_open(Edi_Mainview_Panel *panel, Edi_Path_Options *options)
{
Edi_Mainview_Item *it;
Edi_Mainview_Panel *current;
Edi_Editor *editor;
int i;
current = panel;
for (i = 0; i < edi_mainview_panel_count(); i++)
{
panel = edi_mainview_panel_by_index(i);
@ -741,9 +746,17 @@ edi_mainview_panel_open(Edi_Mainview_Panel *panel, Edi_Path_Options *options)
it = _get_item_for_path(panel, options->path);
if (it)
{
edi_mainview_panel_item_select(panel, it);
edi_mainview_panel_focus(panel);
editor = evas_object_data_get(panel->current->view, "editor");
if (editor)
elm_object_focus_set(editor->entry, EINA_FALSE);
edi_mainview_panel_item_select(panel, it);
editor = evas_object_data_get(panel->current->view, "editor");
if (editor)
elm_object_focus_set(editor->entry, EINA_TRUE);
if (options->line)
{
if (options->character > 1)