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