elm_code: Cancel selection if clicked outside of the editor area
authorAndy Williams <andy@andywilliams.me>
Thu, 21 Dec 2017 22:05:28 +0000 (22:05 +0000)
committerWonki Kim <wonki_.kim@samsung.com>
Wed, 10 Jan 2018 11:08:13 +0000 (20:08 +0900)
src/lib/elementary/elm_code_widget.c

index 2f9b693..394e158 100644 (file)
@@ -1179,6 +1179,17 @@ _elm_code_widget_mouse_up_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj E
 }
 
 static void
+_elm_code_widget_scroller_clicked_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
+                                     void *event_info EINA_UNUSED)
+{
+   Elm_Code_Widget *widget;
+
+   widget = (Elm_Code_Widget *)data;
+
+   elm_code_widget_selection_clear(widget);
+}
+
+static void
 _elm_code_widget_cursor_move_home(Elm_Code_Widget *widget)
 {
    Elm_Code_Widget_Data *pd;
@@ -2296,6 +2307,8 @@ _elm_code_widget_efl_canvas_group_group_add(Eo *obj, Elm_Code_Widget_Data *pd)
    elm_layout_content_set(obj, "elm.swallow.content", scroller);
    elm_object_focus_allow_set(scroller, EINA_FALSE);
    pd->scroller = scroller;
+   evas_object_event_callback_add(scroller, EVAS_CALLBACK_MOUSE_DOWN,
+                                  _elm_code_widget_scroller_clicked_cb, obj);
 
    fontname = edje_object_data_get(elm_layout_edje_get(obj), "font.name");
    fontsize = edje_object_data_get(elm_layout_edje_get(obj), "font.size");