Expand drop_status so we can tell if the target changed action.
(Not fully protocol compliant yet... I think we still need to check and set atoms for individual actions, rather than just xdndActionList?) Don't send additional position messages if target hasn't responded with a status message. Kevin Brosius <cobra@compuserve.com> SVN revision: 5764
This commit is contained in:
parent
ee061acfb5
commit
0c04a24b95
|
@ -457,6 +457,8 @@ extern "C"
|
|||
{
|
||||
Window win, root, source_win;
|
||||
int x, y, w, h;
|
||||
int copy, link, move, private;
|
||||
int all_position_msgs;
|
||||
int ok;
|
||||
} Ecore_Event_Dnd_Drop_Status;
|
||||
|
||||
|
@ -825,6 +827,7 @@ extern "C"
|
|||
void ecore_dnd_own_selection(Window win);
|
||||
void ecore_dnd_send_drop(Window win, Window source_win);
|
||||
void ecore_get_virtual_area(int *area_x, int *area_y);
|
||||
void ecore_clear_target_status(void);
|
||||
|
||||
|
||||
/* ---------------- IPC CALLS */
|
||||
|
|
|
@ -1044,6 +1044,7 @@ ecore_event_x_handle_client_message(XEvent * xevent)
|
|||
static Atom atom_xdndactioncopy = 0;
|
||||
static Atom atom_xdndactionlink = 0;
|
||||
static Atom atom_xdndactionmove = 0;
|
||||
static Atom atom_xdndactionprivate = 0;
|
||||
|
||||
/* setup some known atoms to translate this message into a sensible event */
|
||||
ECORE_ATOM(atom_wm_delete_window, "WM_DELETE_WINDOW");
|
||||
|
@ -1057,6 +1058,7 @@ ecore_event_x_handle_client_message(XEvent * xevent)
|
|||
ECORE_ATOM(atom_xdndactioncopy, "XdndActionCopy");
|
||||
ECORE_ATOM(atom_xdndactionlink, "XdndActionLink");
|
||||
ECORE_ATOM(atom_xdndactionmove, "XdndActionMove");
|
||||
ECORE_ATOM(atom_xdndactionprivate, "XdndActionPrivate");
|
||||
ECORE_ATOM(atom_text_uri_list, "text/uri-list");
|
||||
|
||||
/* first type = delete event sent to client */
|
||||
|
@ -1131,6 +1133,7 @@ ecore_event_x_handle_client_message(XEvent * xevent)
|
|||
{
|
||||
Ecore_Event_Dnd_Drop_Status *e;
|
||||
|
||||
ecore_clear_target_status();
|
||||
e = NEW(Ecore_Event_Dnd_Drop_Status, 1);
|
||||
e->win = xevent->xclient.window;
|
||||
e->root = ecore_window_get_root(e->win);
|
||||
|
@ -1139,10 +1142,25 @@ ecore_event_x_handle_client_message(XEvent * xevent)
|
|||
e->y = xevent->xclient.data.l[2] & 0xffff;
|
||||
e->w = (xevent->xclient.data.l[3] >> 16) & 0xffff;
|
||||
e->h = xevent->xclient.data.l[3] & 0xffff;
|
||||
|
||||
e->copy = e->link = e->move = e->private = 0;
|
||||
if( xevent->xclient.data.l[4] == atom_xdndactioncopy )
|
||||
e->copy = 1;
|
||||
else if( xevent->xclient.data.l[4] == atom_xdndactionlink )
|
||||
e->link = 1;
|
||||
else if( xevent->xclient.data.l[4] == atom_xdndactionmove )
|
||||
e->move = 1;
|
||||
else if( xevent->xclient.data.l[4] == atom_xdndactionprivate )
|
||||
e->private = 1;
|
||||
|
||||
if (xevent->xclient.data.l[1] & 0x1)
|
||||
e->ok = 1;
|
||||
else
|
||||
e->ok = 0;
|
||||
if (xevent->xclient.data.l[1] & 0x2)
|
||||
e->all_position_msgs = 1;
|
||||
else
|
||||
e->all_position_msgs = 0;
|
||||
ecore_add_event(ECORE_EVENT_DND_DROP_STATUS, e, ecore_event_generic_free);
|
||||
}
|
||||
else if ((xevent->xclient.message_type == atom_xdndfinished) &&
|
||||
|
|
|
@ -46,6 +46,7 @@ static int mouse_x = 0, mouse_y = 0;
|
|||
|
||||
static Window current_dnd_win = 0;
|
||||
static int current_dnd_target_ok = 0;
|
||||
static int dnd_await_target_status = 0;
|
||||
|
||||
static int x_grabs = 0;
|
||||
|
||||
|
@ -2048,26 +2049,32 @@ ecore_window_dnd_handle_motion(Window source_win, int x, int y, int dragging)
|
|||
xevent.xclient.data.l[3] = atom_text_plain;
|
||||
xevent.xclient.data.l[4] = atom_text_moz_url;
|
||||
XSendEvent(disp, win, False, 0, &xevent);
|
||||
ecore_clear_target_status();
|
||||
}
|
||||
/* kjb cep */
|
||||
if(!dnd_await_target_status)
|
||||
{
|
||||
/* send position information */
|
||||
xevent.xany.type = ClientMessage;
|
||||
xevent.xany.display = disp;
|
||||
xevent.xclient.window = win;
|
||||
xevent.xclient.message_type = atom_xdndposition;
|
||||
xevent.xclient.format = 32;
|
||||
xevent.xclient.data.l[0] = source_win;
|
||||
xevent.xclient.data.l[1] = (3 << 24);
|
||||
xevent.xclient.data.l[2] = ((x << 16) & 0xffff0000) | (y & 0xffff);
|
||||
xevent.xclient.data.l[3] = CurrentTime;
|
||||
if (dnd_copy)
|
||||
xevent.xclient.data.l[4] = atom_xdndactioncopy;
|
||||
else if (dnd_link)
|
||||
xevent.xclient.data.l[4] = atom_xdndactionlink;
|
||||
else if (dnd_move)
|
||||
xevent.xclient.data.l[4] = atom_xdndactionmove;
|
||||
else
|
||||
xevent.xclient.data.l[4] = atom_xdndactionask;
|
||||
XSendEvent(disp, win, False, 0, &xevent);
|
||||
dnd_await_target_status = 1;
|
||||
}
|
||||
/* send position information */
|
||||
xevent.xany.type = ClientMessage;
|
||||
xevent.xany.display = disp;
|
||||
xevent.xclient.window = win;
|
||||
xevent.xclient.message_type = atom_xdndposition;
|
||||
xevent.xclient.format = 32;
|
||||
xevent.xclient.data.l[0] = source_win;
|
||||
xevent.xclient.data.l[1] = (3 << 24);
|
||||
xevent.xclient.data.l[2] = ((x << 16) & 0xffff0000) | (y & 0xffff);
|
||||
xevent.xclient.data.l[3] = CurrentTime;
|
||||
if (dnd_copy)
|
||||
xevent.xclient.data.l[4] = atom_xdndactioncopy;
|
||||
else if (dnd_link)
|
||||
xevent.xclient.data.l[4] = atom_xdndactionlink;
|
||||
else if (dnd_move)
|
||||
xevent.xclient.data.l[4] = atom_xdndactionmove;
|
||||
else
|
||||
xevent.xclient.data.l[4] = atom_xdndactionask;
|
||||
XSendEvent(disp, win, False, 0, &xevent);
|
||||
}
|
||||
if (!dragging)
|
||||
{
|
||||
|
@ -2107,6 +2114,14 @@ ecore_window_dnd_handle_motion(Window source_win, int x, int y, int dragging)
|
|||
current_dnd_win = win;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ecore_clear_target_status(void)
|
||||
{
|
||||
dnd_await_target_status = 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ecore_dnd_selection_convert(Window win, Window req, Atom type)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue