diff options
| author | Po Lu | 2022-06-10 14:47:40 +0800 |
|---|---|---|
| committer | Po Lu | 2022-06-10 14:48:04 +0800 |
| commit | 45bdeb7d9c62dbc4811db85da81993f45b6b9780 (patch) | |
| tree | b4ba7c438c74750750e1e96e1077844c3b559c26 /src | |
| parent | e70d82d85529104deae45e5bdfe635d5dd9cd200 (diff) | |
| download | emacs-45bdeb7d9c62dbc4811db85da81993f45b6b9780.tar.gz emacs-45bdeb7d9c62dbc4811db85da81993f45b6b9780.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 26 |
1 files changed, 5 insertions, 21 deletions
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, | |||
| 3553 | int root_x, int root_y, int *proto_out, | 3553 | int root_x, int root_y, int *proto_out, |
| 3554 | int *motif_out, Window *toplevel_out) | 3554 | int *motif_out, Window *toplevel_out) |
| 3555 | { | 3555 | { |
| 3556 | Window child_return, child, dummy, proxy; | 3556 | Window child_return, child, proxy; |
| 3557 | int dest_x_return, dest_y_return, rc, proto, motif; | 3557 | int dest_x_return, dest_y_return, rc, proto, motif; |
| 3558 | int parent_x, parent_y; | 3558 | int parent_x, parent_y; |
| 3559 | bool extents_p; | 3559 | bool extents_p; |
| @@ -3698,11 +3698,9 @@ x_dnd_get_target_window (struct x_display_info *dpyinfo, | |||
| 3698 | parent_y = dest_y_return; | 3698 | parent_y = dest_y_return; |
| 3699 | 3699 | ||
| 3700 | x_catch_errors (dpyinfo->display); | 3700 | x_catch_errors (dpyinfo->display); |
| 3701 | rc = XTranslateCoordinates (dpyinfo->display, | 3701 | rc = XTranslateCoordinates (dpyinfo->display, dpyinfo->root_window, |
| 3702 | child_return, child_return, | 3702 | child_return, root_x, root_y, &dest_x_return, |
| 3703 | dest_x_return, dest_y_return, | 3703 | &dest_y_return, &child_return); |
| 3704 | &dest_x_return, &dest_y_return, | ||
| 3705 | &child_return); | ||
| 3706 | 3704 | ||
| 3707 | if (x_had_errors_p (dpyinfo->display) || !rc) | 3705 | if (x_had_errors_p (dpyinfo->display) || !rc) |
| 3708 | { | 3706 | { |
| @@ -3757,23 +3755,9 @@ x_dnd_get_target_window (struct x_display_info *dpyinfo, | |||
| 3757 | return proxy; | 3755 | return proxy; |
| 3758 | } | 3756 | } |
| 3759 | } | 3757 | } |
| 3760 | |||
| 3761 | rc = XTranslateCoordinates (dpyinfo->display, | ||
| 3762 | child, child_return, | ||
| 3763 | dest_x_return, dest_y_return, | ||
| 3764 | &dest_x_return, &dest_y_return, | ||
| 3765 | &dummy); | ||
| 3766 | |||
| 3767 | if (x_had_errors_p (dpyinfo->display) || !rc) | ||
| 3768 | { | ||
| 3769 | x_uncatch_errors_after_check (); | ||
| 3770 | *proto_out = -1; | ||
| 3771 | *toplevel_out = dpyinfo->root_window; | ||
| 3772 | return None; | ||
| 3773 | } | ||
| 3774 | } | 3758 | } |
| 3775 | 3759 | ||
| 3776 | x_uncatch_errors_after_check (); | 3760 | x_uncatch_errors (); |
| 3777 | } | 3761 | } |
| 3778 | 3762 | ||
| 3779 | #if defined HAVE_XCOMPOSITE && (XCOMPOSITE_MAJOR > 0 || XCOMPOSITE_MINOR > 2) | 3763 | #if defined HAVE_XCOMPOSITE && (XCOMPOSITE_MAJOR > 0 || XCOMPOSITE_MINOR > 2) |