summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Poole <netstar@gmail.com>2017-10-26 22:39:21 +0100
committerAndy Williams <andy@andywilliams.me>2018-02-10 21:52:37 +0000
commitc93ee448c2fad2dadef51ed6ffb98759d1a1d974 (patch)
tree0e26de192202e4b858b641e865a61d7aeb180044
parent80327232fb6a79bc98c8c9dae30d66c8519a96de (diff)
elm_code: hide cursor if we hide the widget.
The cursor isn't clipped so if we decide to hide the widget this ensures the cursor also is hidden. This should not affect any existing application using elm_code API.
-rw-r--r--src/lib/elementary/elm_code_widget.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/lib/elementary/elm_code_widget.c b/src/lib/elementary/elm_code_widget.c
index 0b4b817c25..954b2f99a7 100644
--- a/src/lib/elementary/elm_code_widget.c
+++ b/src/lib/elementary/elm_code_widget.c
@@ -609,6 +609,32 @@ _elm_code_widget_update_focus_directions(Elm_Code_Widget *obj)
609} 609}
610 610
611static void 611static void
612_elm_code_widget_show_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
613 void *event_info EINA_UNUSED)
614{
615 Elm_Code_Widget_Data *pd;
616 Elm_Code_Widget *widget = (Elm_Code_Widget *) data;
617
618 pd = efl_data_scope_get(widget, ELM_CODE_WIDGET_CLASS);
619
620 if (pd->cursor_rect)
621 evas_object_show(pd->cursor_rect);
622}
623
624static void
625_elm_code_widget_hidden_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
626 void *event_info EINA_UNUSED)
627{
628 Elm_Code_Widget_Data *pd;
629 Elm_Code_Widget *widget = (Elm_Code_Widget *) data;
630
631 pd = efl_data_scope_get(widget, ELM_CODE_WIDGET_CLASS);
632
633 if (pd->cursor_rect)
634 evas_object_hide(pd->cursor_rect);
635}
636
637static void
612_elm_code_widget_cursor_ensure_visible(Elm_Code_Widget *widget) 638_elm_code_widget_cursor_ensure_visible(Elm_Code_Widget *widget)
613{ 639{
614 Evas_Coord viewx, viewy, vieww, viewh, cellw = 0, cellh = 0; 640 Evas_Coord viewx, viewy, vieww, viewh, cellw = 0, cellh = 0;
@@ -2254,6 +2280,8 @@ _elm_code_widget_efl_canvas_group_group_add(Eo *obj, Elm_Code_Widget_Data *pd)
2254 2280
2255 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _elm_code_widget_resize_cb, obj); 2281 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _elm_code_widget_resize_cb, obj);
2256 evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN, _elm_code_widget_key_down_cb, obj); 2282 evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN, _elm_code_widget_key_down_cb, obj);
2283 evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _elm_code_widget_hidden_cb, obj);
2284 evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _elm_code_widget_show_cb, obj);
2257 2285
2258 evas_object_smart_callback_add(obj, "focused", _elm_code_widget_focused_event_cb, obj); 2286 evas_object_smart_callback_add(obj, "focused", _elm_code_widget_focused_event_cb, obj);
2259 evas_object_smart_callback_add(obj, "unfocused", _elm_code_widget_unfocused_event_cb, obj); 2287 evas_object_smart_callback_add(obj, "unfocused", _elm_code_widget_unfocused_event_cb, obj);