]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix special DND event coordinates
authorPo Lu <luangruo@yahoo.com>
Mon, 13 Jun 2022 01:11:08 +0000 (09:11 +0800)
committerPo Lu <luangruo@yahoo.com>
Mon, 13 Jun 2022 01:11:08 +0000 (09:11 +0800)
* src/xterm.c (x_dnd_note_self_drop): Set DND action to
XdndActionPrivate.
(x_dnd_begin_drag_and_drop): Don't return XdndPrivate specially
here.
(handle_one_xevent): Fix order of arguments to
x_dnd_note_self_drop.

src/xterm.c

index f2306a6015a21d21752698c09ca01d87f2a30c4e..b1e877566fabda304e6e4e7d668338c2a9d3f4c7 100644 (file)
@@ -4303,6 +4303,11 @@ x_dnd_note_self_drop (struct x_display_info *dpyinfo, Window target,
                              &win_x, &win_y, &dummy))
     return;
 
+  /* Emacs can't respond to DND events inside the nested event
+     loop, so when dragging items to itself, always return
+     XdndActionPrivate.  */
+  x_dnd_action = dpyinfo->Xatom_XdndActionPrivate;
+
   EVENT_INIT (ie);
 
   ie.kind = DRAG_N_DROP_EVENT;
@@ -10805,7 +10810,6 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction,
 #endif
   XWindowAttributes root_window_attrs;
   struct input_event hold_quit;
-  struct frame *any;
   char *atom_name, *ask_actions;
   Lisp_Object action, ltimestamp;
   specpdl_ref ref, count, base;
@@ -11431,15 +11435,6 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction,
   x_dnd_return_frame_object = NULL;
   FRAME_DISPLAY_INFO (f)->grabbed = 0;
 
-  /* Emacs can't respond to DND events inside the nested event
-     loop, so when dragging items to itself, always return
-     XdndActionPrivate.  */
-  if (x_dnd_end_window != None
-      && (any = x_any_window_to_frame (FRAME_DISPLAY_INFO (f),
-                                      x_dnd_end_window))
-      && (allow_current_frame || any != f))
-    return unbind_to (base, QXdndActionPrivate);
-
   if (x_dnd_action != None)
     {
       block_input ();
@@ -18196,9 +18191,11 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                        && x_dnd_last_window_is_frame)
                      {
                        x_dnd_waiting_for_finish = false;
-                       x_dnd_note_self_drop (dpyinfo, x_dnd_last_seen_window,
-                                             event->xbutton.time, event->xbutton.x_root,
-                                             event->xbutton.y_root);
+                       x_dnd_note_self_drop (dpyinfo,
+                                             x_dnd_last_seen_window,
+                                             event->xbutton.x_root,
+                                             event->xbutton.y_root,
+                                             event->xbutton.time);
                      }
                    else if (x_dnd_last_seen_window != None
                        && x_dnd_last_protocol_version != -1)
@@ -19596,7 +19593,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                            {
                              x_dnd_waiting_for_finish = false;
                              x_dnd_note_self_drop (dpyinfo, x_dnd_last_seen_window,
-                                                   xev->time, xev->root_x, xev->root_y);
+                                                   xev->root_x, xev->root_y, xev->time);
                            }
                          else if (x_dnd_last_seen_window != None
                                   && x_dnd_last_protocol_version != -1)