entry: clear selection on unfocus for both editable and non-editable entries
authorMinchul Lee <slotus.lee@samsung.com>
Thu, 22 Dec 2016 07:27:34 +0000 (16:27 +0900)
committerWonki Kim <wonki_.kim@samsung.com>
Mon, 2 Jan 2017 05:37:11 +0000 (14:37 +0900)
Change-Id: Ieb050330efd16cc9ba909ba664021f6a4e03bbd9
Signed-off-by: Minchul Lee <slotus.lee@samsung.com>
src/lib/elm_entry.c

index 71eb70ca7e8027a7efc2fe02fcc8833fc9755e06..ce78b479978f3d5a20f6fcd4aab8ccbdb4a2624a 100644 (file)
@@ -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;