From 98d8bb8edefef1a332e9de4cd346931e899c2e41 Mon Sep 17 00:00:00 2001 From: xcomputerman Date: Sun, 24 Oct 2004 03:58:11 +0000 Subject: [PATCH] Flesh out a little more Xdnd code SVN revision: 12001 --- legacy/ecore/src/lib/ecore_x/ecore_x.c | 2 +- legacy/ecore/src/lib/ecore_x/ecore_x_dnd.c | 24 ++++++++++++++++++- .../ecore/src/lib/ecore_x/ecore_x_selection.c | 3 +++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/legacy/ecore/src/lib/ecore_x/ecore_x.c b/legacy/ecore/src/lib/ecore_x/ecore_x.c index ff11f890f6..2eada9447a 100644 --- a/legacy/ecore/src/lib/ecore_x/ecore_x.c +++ b/legacy/ecore/src/lib/ecore_x/ecore_x.c @@ -400,7 +400,7 @@ ecore_x_init(const char *name) _ecore_x_atom_selection_prop_primary = XInternAtom(_ecore_x_disp, "_ECORE_SELECTION_PRIMARY", False); _ecore_x_atom_selection_prop_secondary = XInternAtom(_ecore_x_disp, "_ECORE_SELECTION_SECONDARY", False); _ecore_x_atom_selection_prop_clipboard = XInternAtom(_ecore_x_disp, "_ECORE_SELECTION_CLIPBOARD", False); - _ecore_x_atom_selection_prop_xdnd = XInternAtom(_ecore_x_disp, "_ECORE_SELECTION_XDND", False); + _ecore_x_atom_selection_prop_xdnd = XInternAtom(_ecore_x_disp, "JXSelectionWindowProperty", False); _ecore_x_atom_selection_xdnd = XInternAtom(_ecore_x_disp, "XdndSelection", False); _ecore_x_atom_xdnd_aware = XInternAtom(_ecore_x_disp, "XdndAware", False); _ecore_x_atom_xdnd_type_list = XInternAtom(_ecore_x_disp, "XdndTypeList", False); diff --git a/legacy/ecore/src/lib/ecore_x/ecore_x_dnd.c b/legacy/ecore/src/lib/ecore_x/ecore_x_dnd.c index d89651ad3e..d8bbf89b31 100644 --- a/legacy/ecore/src/lib/ecore_x/ecore_x_dnd.c +++ b/legacy/ecore/src/lib/ecore_x/ecore_x_dnd.c @@ -203,7 +203,7 @@ _ecore_x_dnd_drag(int x, int y) xev.xclient.message_type = _ecore_x_atom_xdnd_position; xev.xclient.data.l[0] = _xdnd->source; xev.xclient.data.l[1] = 0; /* Reserved */ - xev.xclient.data.l[2] = ((x << 16) & 0xffff0000) | (y * 0xffff); + xev.xclient.data.l[2] = ((x << 16) & 0xffff0000) | (y & 0xffff); xev.xclient.data.l[3] = CurrentTime; /* Version 1 */ xev.xclient.data.l[4] = _xdnd->action; /* Version 2, Needs to be pre-set */ XSendEvent(_ecore_x_disp, win, False, 0, &xev); @@ -241,4 +241,26 @@ _ecore_x_dnd_drag(int x, int y) _xdnd->dest = win; } +void +_ecore_x_dnd_send_finished(void) +{ + XEvent xev; + + xev.xany.type = ClientMessage; + xev.xany.display = _ecore_x_disp; + xev.xclient.window = _xdnd->source; + xev.xclient.message_type = _ecore_x_atom_xdnd_finished; + xev.xclient.format = 32; + + xev.xclient.data.l[0] = _xdnd->dest; + memset(xev.xclient.data.l + 1, 0, sizeof(long) * 3); + XSendEvent(_ecore_x_disp, _xdnd->source, False, 0, &xev); +} + +int +_ecore_x_dnd_own_selection(void) +{ + return (!XSetSelectionOwner(_ecore_x_disp, _ecore_x_atom_selection_xdnd, + _xdnd->source, CurrentTime)); +} diff --git a/legacy/ecore/src/lib/ecore_x/ecore_x_selection.c b/legacy/ecore/src/lib/ecore_x/ecore_x_selection.c index 7c113f52c8..587d8ff0f3 100644 --- a/legacy/ecore/src/lib/ecore_x/ecore_x_selection.c +++ b/legacy/ecore/src/lib/ecore_x/ecore_x_selection.c @@ -325,6 +325,8 @@ _ecore_x_selection_request(Ecore_X_Window w, Ecore_X_Atom selection, char *targe prop = _ecore_x_atom_selection_prop_primary; else if (selection == _ecore_x_atom_selection_secondary) prop = _ecore_x_atom_selection_prop_secondary; + else if (selection == _ecore_x_atom_selection_xdnd) + prop = _ecore_x_atom_selection_prop_xdnd; else prop = _ecore_x_atom_selection_prop_clipboard; @@ -523,3 +525,4 @@ static int _ecore_x_selection_converter_text(char *target, void *data, int size, } } +