Ecore: add DnD abort from source
authorDaniel Zaoui <daniel.zaoui@samsung.com>
Sun, 1 Dec 2013 12:48:21 +0000 (14:48 +0200)
committerDaniel Zaoui <daniel.zaoui@samsung.com>
Mon, 9 Dec 2013 07:11:27 +0000 (09:11 +0200)
This can be used to cancel a DnD drag operation in the middle.

src/lib/ecore_x/Ecore_X.h
src/lib/ecore_x/xcb/ecore_xcb_dnd.c
src/lib/ecore_x/xlib/ecore_x_dnd.c

index 4341711..1241b24 100644 (file)
@@ -1401,6 +1401,7 @@ EAPI void                      ecore_x_dnd_send_finished(void);
 EAPI void                      ecore_x_dnd_source_action_set(Ecore_X_Atom action);
 EAPI Ecore_X_Atom              ecore_x_dnd_source_action_get(void);
 EAPI void                      ecore_x_dnd_callback_pos_update_set(void (*cb)(void *, Ecore_X_Xdnd_Position *data), const void *data);
+EAPI Eina_Bool                 ecore_x_dnd_abort(Ecore_X_Window xwin_source); /**< @since 1.9 */
 
 EAPI Ecore_X_Window            ecore_x_window_new(Ecore_X_Window parent, int x, int y, int w, int h);
 EAPI Ecore_X_Window            ecore_x_window_override_new(Ecore_X_Window parent, int x, int y, int w, int h);
index 24e9a50..07eae1f 100644 (file)
@@ -712,3 +712,13 @@ _ecore_xcb_dnd_converter_copy(char         *target EINA_UNUSED,
      }
 }
 
+EAPI Eina_Bool
+ecore_x_dnd_abort(Ecore_X_Window xwin_source)
+{
+   if (xwin_source == _source->win)
+     {
+        _source->will_accept = 0;
+        return ecore_x_dnd_self_drop();
+     }
+   else return EINA_FALSE;
+}
index e86c7aa..9f274c9 100644 (file)
@@ -757,4 +757,15 @@ _ecore_x_dnd_drag(Ecore_X_Window root,
    _source->dest = win;
 }
 
+EAPI Eina_Bool
+ecore_x_dnd_abort(Ecore_X_Window xwin_source)
+{
+   if (xwin_source == _source->win)
+     {
+        _source->will_accept = 0;
+        return ecore_x_dnd_self_drop();
+     }
+   else return EINA_FALSE;
+}
+
 /* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/