Commit 41540b93 authored by Po Lu's avatar Po Lu
Browse files

Don't send XdndPosition before XdndStatus arrives

* src/xterm.c (x_dnd_send_position): Set pending DND message if
target is right.
(x_dnd_send_leave): Clear pending status target.
(x_dnd_begin_drag_and_drop): Clear new flags.
(handle_one_xevent): Respect those flags.
parent ee6e4bc5
Pipeline #18736 passed with stages
in 34 minutes and 35 seconds
......@@ -1235,6 +1235,14 @@ static Window x_dnd_mouse_rect_target;
drop target if the mouse pointer lies within. */
static XRectangle x_dnd_mouse_rect;
 
/* If not None, Emacs is waiting for an XdndStatus event from this
window. */
static Window x_dnd_waiting_for_status_window;
/* If .type != 0, an event that should be sent to .xclient.window
upon receiving an XdndStatus event from said window. */
static XEvent x_dnd_pending_send_position;
/* The action the drop target actually chose to perform.
 
Under XDND, this is set upon receiving the XdndFinished or
......@@ -4380,9 +4388,16 @@ x_dnd_send_position (struct frame *f, Window target, int supported,
if (supported >= 4)
msg.xclient.data.l[4] = action;
 
x_catch_errors (dpyinfo->display);
XSendEvent (FRAME_X_DISPLAY (f), target, False, NoEventMask, &msg);
x_uncatch_errors ();
if (x_dnd_waiting_for_status_window == target)
x_dnd_pending_send_position = msg;
else
{
x_catch_errors (dpyinfo->display);
XSendEvent (FRAME_X_DISPLAY (f), target, False, NoEventMask, &msg);
x_uncatch_errors ();
x_dnd_waiting_for_status_window = target;
}
}
 
static void
......@@ -4401,6 +4416,9 @@ x_dnd_send_leave (struct frame *f, Window target)
msg.xclient.data.l[3] = 0;
msg.xclient.data.l[4] = 0;
 
puts ("RESET PENDING");
x_dnd_waiting_for_status_window = None;
x_catch_errors (dpyinfo->display);
XSendEvent (FRAME_X_DISPLAY (f), target, False, NoEventMask, &msg);
x_uncatch_errors ();
......@@ -11437,6 +11455,8 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction,
x_dnd_return_frame = 0;
x_dnd_waiting_for_finish = false;
x_dnd_waiting_for_motif_finish = 0;
x_dnd_waiting_for_status_window = None;
x_dnd_pending_send_position.type = 0;
x_dnd_xm_use_help = false;
x_dnd_motif_setup_p = false;
x_dnd_end_window = None;
......@@ -16326,6 +16346,22 @@ handle_one_xevent (struct x_display_info *dpyinfo,
x_dnd_action = None;
}
 
/* Send any pending XdndPosition message. */
if (x_dnd_waiting_for_status_window == target)
{
if (x_dnd_pending_send_position.type != 0)
{
x_catch_errors (dpyinfo->display);
XSendEvent (dpyinfo->display, target,
False, NoEventMask,
&x_dnd_pending_send_position);
x_uncatch_errors ();
}
x_dnd_pending_send_position.type = 0;
x_dnd_waiting_for_status_window = None;
}
goto done;
}
 
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment