From: Po Lu Date: Fri, 10 Jun 2022 06:47:40 +0000 (+0800) Subject: Eliminate extra call to XTranslateCoordinates looking for drop target X-Git-Tag: emacs-29.0.90~1910^2~111 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=45bdeb7d9c62dbc4811db85da81993f45b6b9780;p=emacs.git 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. --- diff --git a/src/xterm.c b/src/xterm.c index ed8f0681360..375b345a90a 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)