emacs-diffs
[Top][All Lists]
Advanced

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

master f7307f6215: Remove extra call to XTranslateCoordinates when perfo


From: Po Lu
Subject: master f7307f6215: Remove extra call to XTranslateCoordinates when performing "xterm" drop
Date: Fri, 10 Jun 2022 08:52:17 -0400 (EDT)

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

    Remove extra call to XTranslateCoordinates when performing "xterm" drop
    
    * src/xterm.c (x_dnd_do_unsupported_drop): Signal error when
    XdndSelection is lost, set subwindow, and simplify
    XTranslateCoordinates loop.
---
 src/xterm.c | 29 +++++++++++++----------------
 1 file changed, 13 insertions(+), 16 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index 375b345a90..30322b0c09 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -3443,7 +3443,6 @@ x_dnd_do_unsupported_drop (struct x_display_info *dpyinfo,
   int dest_x, dest_y;
   Window child_return, child;
 
-  event.xbutton.type = ButtonPress;
   event.xbutton.serial = 0;
   event.xbutton.send_event = True;
   event.xbutton.display = dpyinfo->display;
@@ -3457,39 +3456,37 @@ x_dnd_do_unsupported_drop (struct x_display_info 
*dpyinfo,
   dest_x = root_x;
   dest_y = root_y;
 
-  while (XTranslateCoordinates (dpyinfo->display, child,
-                               child, root_x, root_y, &dest_x,
-                               &dest_y, &child_return)
-        && child_return != None
-        && XTranslateCoordinates (dpyinfo->display, child,
-                                  child_return, root_x, root_y,
-                                  &dest_x, &dest_y, &child))
-    {
-      child = child_return;
-      root_x = dest_x;
-      root_y = dest_y;
-    }
+  while (XTranslateCoordinates (dpyinfo->display, dpyinfo->root_window,
+                               child, root_x, root_y, &dest_x, &dest_y,
+                               &child_return)
+        && child_return != None)
+    child = child_return;
 
   if (CONSP (value))
     x_own_selection (QPRIMARY, Fnth (make_fixnum (1), value),
                     frame);
   else
-    x_own_selection (QPRIMARY, Qnil, frame);
+    error ("Lost ownership of XdndSelection");
 
   event.xbutton.window = child;
+  event.xbutton.subwindow = None;
   event.xbutton.x = dest_x;
   event.xbutton.y = dest_y;
   event.xbutton.state = 0;
   event.xbutton.button = 2;
   event.xbutton.same_screen = True;
-  event.xbutton.time = before + 1;
-  event.xbutton.time = before + 2;
 
   x_set_pending_dnd_time (before);
 
+  event.xbutton.type = ButtonPress;
+  event.xbutton.time = before + 1;
+
   XSendEvent (dpyinfo->display, child,
              True, ButtonPressMask, &event);
+
   event.xbutton.type = ButtonRelease;
+  event.xbutton.time = before + 2;
+
   XSendEvent (dpyinfo->display, child,
              True, ButtonReleaseMask, &event);
 



reply via email to

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