emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 9f43549cdf: Don't wait for XdndFinished messages if the target di


From: Po Lu
Subject: master 9f43549cdf: Don't wait for XdndFinished messages if the target did not send status
Date: Sun, 27 Mar 2022 03:54:07 -0400 (EDT)

branch: master
commit 9f43549cdfaeb26392f6b99524ae35c4101d0eb7
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Don't wait for XdndFinished messages if the target did not send status
    
    * 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 | 32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index 099b992d08..a77b90a4b5 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -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;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]