yakov pushed a commit to branch master.

http://git.enlightenment.org/tools/erigo.git/commit/?id=0862c82ae61cfcf7e0dd37452e9359508fcc2b5a

commit 0862c82ae61cfcf7e0dd37452e9359508fcc2b5a
Author: Yakov Goldberg <[email protected]>
Date:   Thu Dec 3 10:16:24 2015 +0200

    Revert "Fixing segv when dragging between factory and window"
    
    This reverts commit 36759bb7f1012aaa5afea7db2aea2ad1b6476e68.
---
 src/bin/gui/dnd.c                | 10 ++++------
 src/bin/gui/dnd.h                |  3 ++-
 src/bin/gui/editor.c             | 16 ----------------
 src/bin/gui/egui_logic.c         |  4 ++--
 src/bin/gui/egui_logic_private.h |  1 -
 5 files changed, 8 insertions(+), 26 deletions(-)

diff --git a/src/bin/gui/dnd.c b/src/bin/gui/dnd.c
index 0dd11d6..f6a169b 100644
--- a/src/bin/gui/dnd.c
+++ b/src/bin/gui/dnd.c
@@ -31,10 +31,9 @@ typedef struct
    Eid *wdg_id; /*Widget id*/
    char *image_path; /* image for DnD icon. */
    Eo *obj; /*object, where drag starts. Used to call cb on delete.  */
-   void (*_factory_dragdone_post_cb)(Eina_Bool accept, const Eo *wdg_eo, const 
Gui_Widget * drag_start_wdg);
 } Factory_Drag_Info;
 
-Factory_Drag_Info _wdg_drag = {NULL, NULL, NULL, NULL};
+Factory_Drag_Info _wdg_drag = {NULL, NULL, NULL};
 
 /* Information about Drop Target*/
 typedef struct
@@ -178,7 +177,8 @@ static void
 _dragdone(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED)
 {
    dnd_debug("In");
-   if (_drag_info_global._wdg_dragdone_post_cb)
+
+   if (_drag_info_global.canvas_is_source)
      {
         _drag_info_global._wdg_dragdone_post_cb(_drag_info_global.drag_accept, 
_drag_info_global.obj, _drag_info_global.drag_start_wdg);
      }
@@ -491,7 +491,6 @@ _drag_start_from_factory(void *data)
    char *wdg_data = json_widget_generate(fdi->wdg_id);
    dnd_debug("Data %s", wdg_data);
    _drag_info_global._drag_data = wdg_data;
-   _drag_info_global._wdg_dragdone_post_cb = fdi->_factory_dragdone_post_cb;
    elm_drag_start(fdi->obj, ELM_SEL_FORMAT_TEXT,
                   wdg_data, ELM_XDND_ACTION_COPY,
                   image_create_icon_f, fdi,
@@ -538,14 +537,13 @@ _factory_drag_info_free(void *data, Eo *obj EINA_UNUSED, 
const Eo_Event_Descript
 /* Function to make Eo object draggable, when mouse down/up are handled inside.
  * Dragging from factory. */
 void
-drag_add(Eo *obj, const char *image_path, Eid *wdg_id, void 
(*_factory_dragdone_post_cb)(Eina_Bool accept, const Eo *wdg_eo, const 
Gui_Widget * drag_start_wdg))
+drag_add(Eo *obj, const char *image_path, Eid *wdg_id)
 {
    Factory_Drag_Info *fdi = calloc(1, sizeof(Factory_Drag_Info));
    if (image_path)
      fdi->image_path = strdup(image_path);
    fdi->wdg_id = wdg_id;
    fdi->obj = obj;
-   fdi->_factory_dragdone_post_cb = _factory_dragdone_post_cb;
    eo_do(obj, eo_event_callback_add(EVAS_OBJECT_EVENT_MOUSE_DOWN, 
_factory_drag_mouse_down, fdi));
    eo_do(obj, eo_event_callback_add(EVAS_OBJECT_EVENT_DEL, 
_factory_drag_info_free, fdi));
 }
diff --git a/src/bin/gui/dnd.h b/src/bin/gui/dnd.h
index 63e4518..884bb3e 100644
--- a/src/bin/gui/dnd.h
+++ b/src/bin/gui/dnd.h
@@ -2,7 +2,8 @@
 #define _DND_H
 
 void
-drag_add(Eo *obj, const char *image_path, Eid *wdg_id, void 
(*_factory_dragdone_post_cb)(Eina_Bool accept, const Eo *wdg_eo, const 
Gui_Widget * drag_start_wdg));
+drag_add(Eo *obj, const char *image_path, Eid *wdg_id);
+
 void
 drag_start(Eo *obj, Eid *wdg_id, void (*_dragdone_post_cb)(Eina_Bool accept, 
const Eo *wdg_eo, const Gui_Widget *drag_start_wdg));
 
diff --git a/src/bin/gui/editor.c b/src/bin/gui/editor.c
index 6ef8359..68bf2ac 100644
--- a/src/bin/gui/editor.c
+++ b/src/bin/gui/editor.c
@@ -2780,21 +2780,6 @@ _drag_start_post(const Gui_Widget *wdg, const Eo 
*_wdg_eo)
    wdg_parent_set((Gui_Widget *) wdg, NULL);
 }
 
-/* This callback is added for dragging object from factory. */
-static void
-_factory_dragdone_post_cb(Eina_Bool accept, const Eo *wdg_eo EINA_UNUSED, 
const Gui_Widget *drag_start_wdg EINA_UNUSED)
-{
-   if (!accept ||
-       (accept && !dnd_is_destination()))
-     {
-        if (_dragged_wdg)
-          {
-             wdg_del(_dragged_wdg);
-             _dragged_wdg = NULL;
-          }
-     }
-}
-
 /* This callback is added only for dragging of objects on canvas. */
 static void
 _dragdone_post_cb(Eina_Bool accept, const Eo *wdg_eo, const Gui_Widget 
*drag_start_wdg)
@@ -4864,7 +4849,6 @@ editor_init(GuiLogicCbs *_guilogic_cbs)
    _guilogic_cbs->_project_close = _project_close;
    _guilogic_cbs->_project_new = _project_new;
    _guilogic_cbs->_theme_hoversel_fill = _theme_hoversel_fill;
-   _guilogic_cbs->_factory_dragdone_post_cb = _factory_dragdone_post_cb;
 
    updater_completion_callback_add(_context_changed_cb, NULL);
 
diff --git a/src/bin/gui/egui_logic.c b/src/bin/gui/egui_logic.c
index b89401c..78bcfcf 100644
--- a/src/bin/gui/egui_logic.c
+++ b/src/bin/gui/egui_logic.c
@@ -1066,7 +1066,7 @@ egui_start(const char *filename)
               eo_event_callback_add(EVAS_OBJECT_EVENT_MOUSE_DOWN, 
_factory_tt_mouse_down, NULL)); \
         elm_object_tooltip_text_set(box, #widget); \
         eo_do(eo_parent, elm_obj_table_pack(box, x, y, w, h)); \
-        drag_add(box, NULL, obj_id, _guilogic_cbs->_factory_dragdone_post_cb); 
\
+        drag_add(box, NULL, obj_id); \
         _factory_widgets_list = eina_list_append(_factory_widgets_list, box); \
      }
 #define FACTORY_IMG_CREATE(widget, image_path, parent, x, y, w, h) \
@@ -1082,7 +1082,7 @@ egui_start(const char *filename)
         eo_do(o, eo_event_callback_add(EVAS_OBJECT_EVENT_MOUSE_DOWN, 
_factory_tt_mouse_down, NULL)); \
         eo_do(eo_parent, elm_obj_table_pack(o, x, y, w, h)); \
         wdg_id = gui_context_eid_get_by_name(global_context_get(), #widget); \
-        drag_add(o, path, wdg_id, _guilogic_cbs->_factory_dragdone_post_cb); \
+        drag_add(o, path, wdg_id); \
      }
 
    gui_parser_json_file_read((Gui_Context *)global_context_get(), 
PACKAGE_DATA_DIR"/layouts/factory.json");
diff --git a/src/bin/gui/egui_logic_private.h b/src/bin/gui/egui_logic_private.h
index 2c856c9..84a0e77 100644
--- a/src/bin/gui/egui_logic_private.h
+++ b/src/bin/gui/egui_logic_private.h
@@ -16,7 +16,6 @@ typedef struct
    void (*_project_close)(const Gui_Context *ctx);
    Gui_Context* (*_project_new)(const char *filename);
    void (*_theme_hoversel_fill)();
-   void (*_factory_dragdone_post_cb)(Eina_Bool accept, const Eo *wdg_eo, const 
Gui_Widget * drag_start_wdg);
 } GuiLogicCbs;
 
 Eina_Bool

-- 


Reply via email to