]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't wait for XdndFinished messages if the target did not send status
authorPo Lu <luangruo@yahoo.com>
Sun, 27 Mar 2022 07:51:41 +0000 (15:51 +0800)
committerPo Lu <luangruo@yahoo.com>
Sun, 27 Mar 2022 07:53:56 +0000 (15:53 +0800)
* src/xterm.c (x_dnd_send_leave): Return if we should wait for a
XdndFinished message.
(handle_one_xevent): Use that value for
`x_dnd_waiting_for_finish'.

src/xterm.c

index 099b992d0831ab064c654f992986ee6ca4bfd046..a77b90a4b5c692494892d09a48c52e678d172514 100644 (file)
@@ -1785,7 +1785,7 @@ x_dnd_send_leave (struct frame *f, Window target)
   x_uncatch_errors ();
 }
 
-static void
+static bool
 x_dnd_send_drop (struct frame *f, Window target, Time timestamp,
                 int supported)
 {
@@ -1824,7 +1824,7 @@ x_dnd_send_drop (struct frame *f, Window target, Time timestamp,
                              x_dnd_n_targets, atom_names))
            {
              XFree (name);
-             return;
+             return false;
            }
 
          for (i = x_dnd_n_targets; i != 0; --i)
@@ -1844,9 +1844,14 @@ x_dnd_send_drop (struct frame *f, Window target, Time timestamp,
          XFree (name);
          kbd_buffer_store_event (&ie);
 
-         return;
+         return false;
        }
     }
+  else if (x_dnd_action == None)
+    {
+      x_dnd_send_leave (f, target);
+      return false;
+    }
 
   msg.xclient.type = ClientMessage;
   msg.xclient.message_type = dpyinfo->Xatom_XdndDrop;
@@ -1864,6 +1869,7 @@ x_dnd_send_drop (struct frame *f, Window target, Time timestamp,
   x_catch_errors (dpyinfo->display);
   XSendEvent (FRAME_X_DISPLAY (f), target, False, 0, &msg);
   x_uncatch_errors ();
+  return true;
 }
 
 void
@@ -13451,16 +13457,13 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                if (x_dnd_last_seen_window != None
                    && x_dnd_last_protocol_version != -1)
                  {
-                   /* Crazy hack to make dragging from one frame to
-                      another work.  */
-                   x_dnd_waiting_for_finish = !x_any_window_to_frame (dpyinfo,
-                                                                      x_dnd_last_seen_window);
                    x_dnd_pending_finish_target = x_dnd_last_seen_window;
                    x_dnd_waiting_for_finish_proto = x_dnd_last_protocol_version;
 
-                   x_dnd_send_drop (x_dnd_frame, x_dnd_last_seen_window,
-                                    x_dnd_selection_timestamp,
-                                    x_dnd_last_protocol_version);
+                   x_dnd_waiting_for_finish
+                     = x_dnd_send_drop (x_dnd_frame, x_dnd_last_seen_window,
+                                        x_dnd_selection_timestamp,
+                                        x_dnd_last_protocol_version);
                  }
 
                x_dnd_last_protocol_version = -1;
@@ -14453,14 +14456,13 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                      if (x_dnd_last_seen_window != None
                          && x_dnd_last_protocol_version != -1)
                        {
-                         x_dnd_waiting_for_finish = !x_any_window_to_frame (dpyinfo,
-                                                                            x_dnd_last_seen_window);
                          x_dnd_pending_finish_target = x_dnd_last_seen_window;
                          x_dnd_waiting_for_finish_proto = x_dnd_last_protocol_version;
 
-                         x_dnd_send_drop (x_dnd_frame, x_dnd_last_seen_window,
-                                          x_dnd_selection_timestamp,
-                                          x_dnd_last_protocol_version);
+                         x_dnd_waiting_for_finish
+                           = x_dnd_send_drop (x_dnd_frame, x_dnd_last_seen_window,
+                                              x_dnd_selection_timestamp,
+                                              x_dnd_last_protocol_version);
                        }
 
                      x_dnd_last_protocol_version = -1;