From 1ae7a4f5e252618448dbd998a93878bf9d6f054a Mon Sep 17 00:00:00 2001 From: Daniel Zaoui Date: Sun, 1 Dec 2013 14:48:21 +0200 Subject: [PATCH] Ecore: add DnD abort from source This can be used to cancel a DnD drag operation in the middle. --- src/lib/ecore_x/Ecore_X.h | 1 + src/lib/ecore_x/xcb/ecore_xcb_dnd.c | 10 ++++++++++ src/lib/ecore_x/xlib/ecore_x_dnd.c | 11 +++++++++++ 3 files changed, 22 insertions(+) diff --git a/src/lib/ecore_x/Ecore_X.h b/src/lib/ecore_x/Ecore_X.h index 4341711682..1241b24408 100644 --- a/src/lib/ecore_x/Ecore_X.h +++ b/src/lib/ecore_x/Ecore_X.h @@ -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); diff --git a/src/lib/ecore_x/xcb/ecore_xcb_dnd.c b/src/lib/ecore_x/xcb/ecore_xcb_dnd.c index 24e9a50577..07eae1f22a 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb_dnd.c +++ b/src/lib/ecore_x/xcb/ecore_xcb_dnd.c @@ -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; +} diff --git a/src/lib/ecore_x/xlib/ecore_x_dnd.c b/src/lib/ecore_x/xlib/ecore_x_dnd.c index e86c7aaa3c..9f274c9dbd 100644 --- a/src/lib/ecore_x/xlib/ecore_x_dnd.c +++ b/src/lib/ecore_x/xlib/ecore_x_dnd.c @@ -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 :*/