From 4b7d0b8c9eef9ea8a4cb5d2c58df52e14b248087 Mon Sep 17 00:00:00 2001 From: Minchul Lee Date: Thu, 22 Dec 2016 16:27:34 +0900 Subject: [PATCH] entry: clear selection on unfocus for both editable and non-editable entries Change-Id: Ieb050330efd16cc9ba909ba664021f6a4e03bbd9 Signed-off-by: Minchul Lee --- src/lib/elm_entry.c | 84 +++++++++++++++++++++++++++++------------------------ 1 file changed, 46 insertions(+), 38 deletions(-) diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c index 71eb70c..ce78b47 100644 --- a/src/lib/elm_entry.c +++ b/src/lib/elm_entry.c @@ -2219,52 +2219,59 @@ _elm_entry_elm_widget_on_focus(Eo *obj, Elm_Entry_Data *sd, Elm_Object_Item *ite if (top && eo_isa(top, ELM_WIN_CLASS)) top_is_win = EINA_TRUE; - if (!sd->editable) return EINA_FALSE; + //if (!sd->editable) return EINA_FALSE; //TIZEN ONLY (20161222): clear selection for both editable and noneditable if (elm_widget_focus_get(obj)) { - evas_object_focus_set(sd->entry_edje, EINA_TRUE); - edje_object_signal_emit(sd->entry_edje, "elm,action,focus", "elm"); - if (sd->scroll) - edje_object_signal_emit(sd->scr_edje, "elm,action,focus", "elm"); - - if (top && top_is_win && sd->input_panel_enable && !sd->input_panel_show_on_demand && - !edje_object_part_text_imf_context_get(sd->entry_edje, "elm.text")) - elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_ON); - eo_do(obj, eo_event_callback_call(ELM_WIDGET_EVENT_FOCUSED, NULL)); - if (_elm_atspi_enabled()) - elm_interface_atspi_accessible_state_changed_signal_emit(obj, ELM_ATSPI_STATE_FOCUSED, EINA_TRUE); - _return_key_enabled_check(obj); - _validate(obj); + if (sd->editable) //TIZEN ONLY (20161222): clear selection for both editable and noneditable + { + evas_object_focus_set(sd->entry_edje, EINA_TRUE); + edje_object_signal_emit(sd->entry_edje, "elm,action,focus", "elm"); + if (sd->scroll) + edje_object_signal_emit(sd->scr_edje, "elm,action,focus", "elm"); + + if (top && top_is_win && sd->input_panel_enable && !sd->input_panel_show_on_demand && + !edje_object_part_text_imf_context_get(sd->entry_edje, "elm.text")) + elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_ON); + eo_do(obj, eo_event_callback_call(ELM_WIDGET_EVENT_FOCUSED, NULL)); + if (_elm_atspi_enabled()) + elm_interface_atspi_accessible_state_changed_signal_emit(obj, ELM_ATSPI_STATE_FOCUSED, EINA_TRUE); + _return_key_enabled_check(obj); + _validate(obj); + } } else { - // TIZEN ONLY (20160915): hide cbhm - if ((sd->api) && (sd->api->obj_hide_clipboard)) - { - sd->api->obj_hide_clipboard(obj); - } - // - edje_object_signal_emit(sd->entry_edje, "elm,action,unfocus", "elm"); - if (sd->scroll) - edje_object_signal_emit(sd->scr_edje, "elm,action,unfocus", "elm"); - evas_object_focus_set(sd->entry_edje, EINA_FALSE); - if (top && top_is_win && sd->input_panel_enable && - !edje_object_part_text_imf_context_get(sd->entry_edje, "elm.text")) - elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_OFF); - eo_do(obj, eo_event_callback_call(ELM_WIDGET_EVENT_UNFOCUSED, NULL)); - if (_elm_atspi_enabled()) - elm_interface_atspi_accessible_state_changed_signal_emit(obj, ELM_ATSPI_STATE_FOCUSED, EINA_FALSE); - // TIZEN ONLY (20150201): Add cursor handler - if (sd->cursor_handler_shown) + if (sd->editable) //TIZEN ONLY (20161222): clear selection for both editable and noneditable { - evas_object_hide(sd->cursor_handler); - sd->cursor_handler_shown = EINA_FALSE; + // TIZEN ONLY (20160915): hide cbhm + if ((sd->api) && (sd->api->obj_hide_clipboard)) + { + sd->api->obj_hide_clipboard(obj); + } + // + edje_object_signal_emit(sd->entry_edje, "elm,action,unfocus", "elm"); + if (sd->scroll) + edje_object_signal_emit(sd->scr_edje, "elm,action,unfocus", "elm"); + evas_object_focus_set(sd->entry_edje, EINA_FALSE); + if (top && top_is_win && sd->input_panel_enable && + !edje_object_part_text_imf_context_get(sd->entry_edje, "elm.text")) + elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_OFF); + eo_do(obj, eo_event_callback_call(ELM_WIDGET_EVENT_UNFOCUSED, NULL)); + if (_elm_atspi_enabled()) + elm_interface_atspi_accessible_state_changed_signal_emit(obj, ELM_ATSPI_STATE_FOCUSED, EINA_FALSE); + // TIZEN ONLY (20150201): Add cursor handler + if (sd->cursor_handler_shown) + { + evas_object_hide(sd->cursor_handler); + sd->cursor_handler_shown = EINA_FALSE; - if (sd->cursor_handler_update_job) - ecore_job_del(sd->cursor_handler_update_job); - sd->cursor_handler_update_job = NULL; + if (sd->cursor_handler_update_job) + ecore_job_del(sd->cursor_handler_update_job); + sd->cursor_handler_update_job = NULL; + } + // } - // + if (_elm_config->selection_clear_enable) { if ((sd->have_selection) && (!sd->hoversel)) @@ -2277,6 +2284,7 @@ _elm_entry_elm_widget_on_focus(Eo *obj, Elm_Entry_Data *sd, Elm_Object_Item *ite } } edje_object_signal_emit(sd->scr_edje, "validation,default", "elm"); + } return EINA_TRUE; -- 2.7.4