summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hirt <daniel.hirt@samsung.com>2016-01-21 16:59:50 +0200
committerDaniel Hirt <daniel.hirt@samsung.com>2016-01-21 16:59:50 +0200
commitbf9ab3d0d6ad6b1b312d87aea3d7e65bc25b89a9 (patch)
treeb18e333d25d33c962ecbe6feb3517c636695e50a
parent29545d8224863671c686f9e58608ed4cabc7634a (diff)
Editor: Add "select none" behavior with mouse clickdevs/herdsman/next
Now, clicking on an empty area (the canvas) will select none of the widgets. Also, needed to stop events from the added canvas rectangle from reaching the window.
-rw-r--r--src/bin/gui/editor.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/bin/gui/editor.c b/src/bin/gui/editor.c
index d41c375..edf599e 100644
--- a/src/bin/gui/editor.c
+++ b/src/bin/gui/editor.c
@@ -80,6 +80,7 @@ _zoom_label_update(double zoom);
80 80
81static Gui_Context *_active_ctx = NULL; 81static Gui_Context *_active_ctx = NULL;
82static const Egui_Layout_Widgets *g; 82static const Egui_Layout_Widgets *g;
83static Eo *_canvas_grid_rect = NULL;
83 84
84Eina_Bool 85Eina_Bool
85_canvas_resize_cb(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED); 86_canvas_resize_cb(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED);
@@ -590,7 +591,7 @@ _mouse_down_main(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *de
590 /* Catch mouse down on resize marker. */ 591 /* Catch mouse down on resize marker. */
591 if (_mmd.data != BORDER_OUT) 592 if (_mmd.data != BORDER_OUT)
592 { 593 {
593 return EO_CALLBACK_CONTINUE; 594 return EO_CALLBACK_STOP;
594 } 595 }
595 596
596 const Gui_Session *session = gui_context_editor_session_get(wdg_context_get(wdg_main)); 597 const Gui_Session *session = gui_context_editor_session_get(wdg_context_get(wdg_main));
@@ -616,7 +617,7 @@ _mouse_down_main(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *de
616 /* Start dragging only if mouse down on not dummy or main wdg. */ 617 /* Start dragging only if mouse down on not dummy or main wdg. */
617 if ((wdg != wdg_main) && (!eid_is_dummy(wdg_eid_get(wdg)))) 618 if ((wdg != wdg_main) && (!eid_is_dummy(wdg_eid_get(wdg))))
618 _drag_timer_start = ecore_timer_add(0.2, _drag_widget_start, wdg); 619 _drag_timer_start = ecore_timer_add(0.2, _drag_widget_start, wdg);
619 return EO_CALLBACK_CONTINUE; 620 return EO_CALLBACK_STOP;
620} 621}
621 622
622/* Callback, called when press mouse button */ 623/* Callback, called when press mouse button */
@@ -1107,7 +1108,7 @@ _frame_mouse_down(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *d
1107 { 1108 {
1108 _drag_timer_start = ecore_timer_add(0.2, _drag_widget_start, wdg); 1109 _drag_timer_start = ecore_timer_add(0.2, _drag_widget_start, wdg);
1109 } 1110 }
1110 return EO_CALLBACK_CONTINUE; 1111 return EO_CALLBACK_STOP;
1111} 1112}
1112 1113
1113static Eina_Bool 1114static Eina_Bool
@@ -5019,6 +5020,12 @@ _canvas_resize_cb(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *d
5019 eo_do(g->main_win->canvas_grid, evas_obj_size_hint_min_set((w - dx) * scale, (h - dy) * scale)); 5020 eo_do(g->main_win->canvas_grid, evas_obj_size_hint_min_set((w - dx) * scale, (h - dy) * scale));
5020 _zoom_label_update(scale * 100); 5021 _zoom_label_update(scale * 100);
5021 } 5022 }
5023 if (_canvas_grid_rect)
5024 {
5025 Evas_Coord w, h;
5026 eo_do(g->main_win->canvas_grid, elm_obj_grid_size_get(&w, &h));
5027 elm_grid_pack_set(_canvas_grid_rect, 0, 0, w, h);
5028 }
5022 5029
5023 return EO_CALLBACK_CONTINUE; 5030 return EO_CALLBACK_CONTINUE;
5024} 5031}
@@ -5165,6 +5172,13 @@ _context_changed_cb(void *data EINA_UNUSED, Memento *mem, Eina_Bool dir EINA_UNU
5165 } 5172 }
5166} 5173}
5167 5174
5175Eina_Bool
5176_canvas_scroller_down_cb(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
5177{
5178 _editor_wdg_selected_set(NULL);
5179 return EO_CALLBACK_STOP;
5180}
5181
5168void 5182void
5169editor_init(GuiLogicCbs *_guilogic_cbs) 5183editor_init(GuiLogicCbs *_guilogic_cbs)
5170{ 5184{
@@ -5238,5 +5252,16 @@ editor_init(GuiLogicCbs *_guilogic_cbs)
5238 key_binding_new(_key_binding_paste_cb, NULL, "ctrl", "v", NULL); 5252 key_binding_new(_key_binding_paste_cb, NULL, "ctrl", "v", NULL);
5239 5253
5240 ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, _mouse_wheel_cb, NULL); 5254 ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, _mouse_wheel_cb, NULL);
5255
5256 {
5257 Evas_Coord gw, gh;
5258
5259 _canvas_grid_rect = eo_add(EVAS_RECTANGLE_CLASS, g->main_win->main_win);
5260 eo_do(g->main_win->canvas_grid, elm_obj_grid_size_get(&gw, &gh));
5261 eo_do(g->main_win->canvas_grid, elm_obj_grid_pack(_canvas_grid_rect, 0, 0, gw, gh));
5262 eo_do(_canvas_grid_rect, efl_gfx_color_set(255, 255, 255, 0));
5263 eo_do(_canvas_grid_rect, eo_event_callback_add(EVAS_OBJECT_EVENT_MOUSE_DOWN, _canvas_scroller_down_cb, NULL));
5264 evas_object_show(_canvas_grid_rect);
5265 }
5241} 5266}
5242 5267