yakov pushed a commit to branch master. http://git.enlightenment.org/tools/erigo.git/commit/?id=9b8c769abf0f4d31f5c52313228aa9f920cd87df
commit 9b8c769abf0f4d31f5c52313228aa9f920cd87df Author: Yakov Goldberg <yako...@samsung.com> Date: Wed Jan 20 17:47:36 2016 +0200 Clean up calls to set selected widget Widget can be selected by clicking widget itself or an item in objtree. These actions should be implemented in one common call. --- src/bin/gui/editor.c | 20 +++++--------------- src/bin/gui/objtree.c | 1 + 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/bin/gui/editor.c b/src/bin/gui/editor.c index 19b70c7..e6006c0 100644 --- a/src/bin/gui/editor.c +++ b/src/bin/gui/editor.c @@ -491,6 +491,7 @@ _editor_wdg_selected_set(const Gui_Widget *wdg) Eo *obj = session_eo_get(gui_context_editor_session_get(ctx), wdg); /* Set focus */ eo_do(obj, evas_obj_focus_set(EINA_TRUE)); + objtree_item_selected_set(wdg); } } @@ -610,7 +611,6 @@ _mouse_down_main(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *de eo_do(wdg_eo, evas_obj_focus_set(EINA_TRUE)); } _editor_wdg_selected_set(wdg); - objtree_item_selected_set(wdg); /* Start dragging only if mouse down on not dummy or main wdg. */ if ((wdg != wdg_main) && (!eid_is_dummy(wdg_eid_get(wdg)))) @@ -1079,7 +1079,6 @@ _frame_mouse_down(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *d eo_do(obj, wdg = eo_key_data_get("winwdg")); _editor_wdg_selected_set(wdg); - objtree_item_selected_set(wdg); if (IS_MAIN(wdg)) { @@ -2206,7 +2205,6 @@ end: if (new_wdg) { _editor_wdg_selected_set(new_wdg); - objtree_item_selected_set(new_wdg); } context_memento_finalize(ctx); @@ -2976,7 +2974,6 @@ _dragdone_post_cb(Eina_Bool accept, const Eo *wdg_eo, const Gui_Widget *drag_sta eo_do(g->main_win->toolbar_undo_it, elm_wdg_item_disabled_set(context_can_undo(ctx) ? EINA_FALSE : EINA_TRUE)); _editor_wdg_selected_set(drag_wdg); - objtree_item_selected_set(drag_wdg); _dragged_wdg = NULL; } @@ -3349,8 +3346,9 @@ _editor_ctx_call(const Gui_Context *ctx) } const Gui_Widget *wdg = _editor_wdg_selected_get(); - objtree_item_selected_set(wdg); - proplayout_build(wdg); + /* Need to set widget to NULL in order to force updating selected item in objtree. */ + _editor_wdg_selected_set(NULL); + _editor_wdg_selected_set(wdg); return EINA_TRUE; } @@ -3628,9 +3626,7 @@ _prop_update_from_propview(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Descr * in order to update layout. */ if (reload_win) { - proplayout_build(NULL); _editor_wdg_selected_set(wdg); - objtree_item_selected_set(wdg); } #if 0 else @@ -3847,7 +3843,7 @@ _field_update_from_itemview(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Desc wdg_parent_set(w, wdg_name_get(wdg_main_wdg_get(wdg))); } } - objtree_item_selected_set(wdg); + _editor_wdg_selected_set(wdg); } /* Create memento and unref prev item*/ memento_command_add(wdg_eid_get(wdg), MEMENTO_ITEM_CONTAINER_ITEM, (void *) wit, new_wit); @@ -4054,13 +4050,11 @@ _content_del_from_propview(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Descr const Gui_Widget *parent_win = wdg_main_wdg_get(param_wdg); /* Do it to update list. */ wdg_parent_set(param_wdg, wdg_name_get(parent_win)); - objtree_item_selected_set(wdg); memento_command_add(name_id, MEMENTO_WIDGET_PARENT, wdg_eid_get(wdg), wdg_eid_get(parent_win)); memento_focused_widget_add(wdg_eid_get(wdg)); /* Reload window when unpacking something. */ _editor_wdg_selected_set(wdg); - objtree_item_selected_set(wdg); context_memento_finalize(ctx); } @@ -4222,7 +4216,6 @@ _content_change_from_propview(void *data EINA_UNUSED, Eo *obj, const Eo_Event_De wdg_obj_container_item_add((Gui_Widget *) wdg, ci, pfd->it_data->idx); _editor_wdg_selected_set(wdg); - objtree_item_selected_set(wdg); } if (!strcmp(container_class_name, DB_DEF_CONTAINER_CLASS)) @@ -4250,7 +4243,6 @@ _content_change_from_propview(void *data EINA_UNUSED, Eo *obj, const Eo_Event_De * Check ToDo. */ _wdg_parent_win_reload(wdg); _editor_wdg_selected_set(wdg); - objtree_item_selected_set(wdg); } } } @@ -4401,7 +4393,6 @@ _switch_to_context(Gui_Context *ctx) Gui_Widget *wdg = gui_context_data_get(ctx, SELECTED_WDG); _editor_wdg_selected_set(wdg); - objtree_item_selected_set(wdg); } static void @@ -4889,7 +4880,6 @@ _context_changed_cb(void *data EINA_UNUSED, Memento *mem, Eina_Bool dir EINA_UNU if (update_from_undo_redo) { _editor_wdg_selected_set(focused_wdg); - objtree_item_selected_set(focused_wdg); update_from_undo_redo = EINA_FALSE; proplayout_view_switch(propview_type); } diff --git a/src/bin/gui/objtree.c b/src/bin/gui/objtree.c index c49a93f..9fde056 100644 --- a/src/bin/gui/objtree.c +++ b/src/bin/gui/objtree.c @@ -297,6 +297,7 @@ objtree_item_selected_set(const Gui_Widget *wdg) _filter = NULL; item = _item_realize(wdg_eid_get(wdg), EINA_TRUE); if (!item) return; + if (elm_genlist_item_selected_get(item)) return; elm_genlist_item_bring_in(item, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE); elm_genlist_item_selected_set(item, EINA_TRUE); } --