Flesh out a little more Xdnd code

SVN revision: 12001
This commit is contained in:
xcomputerman 2004-10-24 03:58:11 +00:00 committed by xcomputerman
parent 80cb5cd954
commit 98d8bb8ede
3 changed files with 27 additions and 2 deletions

View File

@ -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);

View File

@ -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));
}

View File

@ -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,
}
}