emacs-diffs
[Top][All Lists]
Advanced

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

master 45bdeb7d9c: Eliminate extra call to XTranslateCoordinates looking


From: Po Lu
Subject: master 45bdeb7d9c: Eliminate extra call to XTranslateCoordinates looking for drop target
Date: Fri, 10 Jun 2022 02:48:15 -0400 (EDT)

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

    Eliminate extra call to XTranslateCoordinates looking for drop target
    
    * src/xterm.c (x_dnd_get_target_window): Translate coordinates
    starting from the root window and avoid extra sync.
---
 src/xterm.c | 26 +++++---------------------
 1 file changed, 5 insertions(+), 21 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index ed8f068136..375b345a90 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -3553,7 +3553,7 @@ x_dnd_get_target_window (struct x_display_info *dpyinfo,
                         int root_x, int root_y, int *proto_out,
                         int *motif_out, Window *toplevel_out)
 {
-  Window child_return, child, dummy, proxy;
+  Window child_return, child, proxy;
   int dest_x_return, dest_y_return, rc, proto, motif;
   int parent_x, parent_y;
   bool extents_p;
@@ -3698,11 +3698,9 @@ x_dnd_get_target_window (struct x_display_info *dpyinfo,
       parent_y = dest_y_return;
 
       x_catch_errors (dpyinfo->display);
-      rc = XTranslateCoordinates (dpyinfo->display,
-                                 child_return, child_return,
-                                 dest_x_return, dest_y_return,
-                                 &dest_x_return, &dest_y_return,
-                                 &child_return);
+      rc = XTranslateCoordinates (dpyinfo->display, dpyinfo->root_window,
+                                 child_return, root_x, root_y, &dest_x_return,
+                                 &dest_y_return, &child_return);
 
       if (x_had_errors_p (dpyinfo->display) || !rc)
        {
@@ -3757,23 +3755,9 @@ x_dnd_get_target_window (struct x_display_info *dpyinfo,
                  return proxy;
                }
            }
-
-         rc = XTranslateCoordinates (dpyinfo->display,
-                                     child, child_return,
-                                     dest_x_return, dest_y_return,
-                                     &dest_x_return, &dest_y_return,
-                                     &dummy);
-
-         if (x_had_errors_p (dpyinfo->display) || !rc)
-           {
-             x_uncatch_errors_after_check ();
-             *proto_out = -1;
-             *toplevel_out = dpyinfo->root_window;
-             return None;
-           }
        }
 
-      x_uncatch_errors_after_check ();
+      x_uncatch_errors ();
     }
 
 #if defined HAVE_XCOMPOSITE && (XCOMPOSITE_MAJOR > 0 || XCOMPOSITE_MINOR > 2)



reply via email to

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