From: Po Lu Date: Thu, 7 Jul 2022 01:21:22 +0000 (+0800) Subject: Avoid excessive synchronization performing "xterm" drops X-Git-Tag: emacs-29.0.90~1447^2~1133 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8575962d46d1f1d08836bf00cb74ccd344953bcb;p=emacs.git Avoid excessive synchronization performing "xterm" drops * src/xterm.c (x_dnd_do_unsupported_drop): Asynchronously catch errors around XSendEvent. --- diff --git a/src/xterm.c b/src/xterm.c index 225c45ff7cb..a21daa2dfc0 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -3860,6 +3860,7 @@ x_dnd_do_unsupported_drop (struct x_display_info *dpyinfo, event.xbutton.root = dpyinfo->root_window; event.xbutton.x_root = root_x; event.xbutton.y_root = root_y; + x_catch_errors (dpyinfo->display); child = dpyinfo->root_window; @@ -3892,6 +3893,8 @@ x_dnd_do_unsupported_drop (struct x_display_info *dpyinfo, if (owner != FRAME_X_WINDOW (f)) goto cancel; + x_uncatch_errors (); + event.xbutton.window = child; event.xbutton.subwindow = None; event.xbutton.x = dest_x; @@ -3905,14 +3908,20 @@ x_dnd_do_unsupported_drop (struct x_display_info *dpyinfo, event.xbutton.type = ButtonPress; event.xbutton.time = before + 1; + x_ignore_errors_for_next_request (dpyinfo); XSendEvent (dpyinfo->display, child, True, ButtonPressMask, &event); + x_stop_ignoring_errors (dpyinfo); event.xbutton.type = ButtonRelease; event.xbutton.time = before + 2; + x_ignore_errors_for_next_request (dpyinfo); XSendEvent (dpyinfo->display, child, True, ButtonReleaseMask, &event); + x_stop_ignoring_errors (dpyinfo); + + return; cancel: x_uncatch_errors ();