emacs-diffs
[Top][All Lists]
Advanced

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

master 1c4cd5e7d9: Stop catching errors for some requests


From: Po Lu
Subject: master 1c4cd5e7d9: Stop catching errors for some requests
Date: Sun, 26 Jun 2022 01:35:36 -0400 (EDT)

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

    Stop catching errors for some requests
    
    * src/xterm.c (x_dnd_compute_toplevels)
    (frame_set_mouse_pixel_position, x_focus_frame): Use
    `x_ignore_errors_for_next_request'.  This results in a healthy
    ~30% speedup for the involved requests.
---
 src/xterm.c | 30 +++++++++++++-----------------
 1 file changed, 13 insertions(+), 17 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index 8a42b77f51..8aeaca230f 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -3184,11 +3184,10 @@ x_dnd_compute_toplevels (struct x_display_info *dpyinfo)
 
          if (dpyinfo->xshape_supported_p)
            {
-             x_catch_errors (dpyinfo->display);
+             x_ignore_errors_for_next_request (dpyinfo);
              XShapeSelectInput (dpyinfo->display,
                                 toplevels[i],
                                 ShapeNotifyMask);
-             x_uncatch_errors ();
 
 #ifndef HAVE_XCB_SHAPE
              x_catch_errors (dpyinfo->display);
@@ -24770,12 +24769,12 @@ frame_set_mouse_pixel_position (struct frame *f, int 
pix_x, int pix_y)
                              FRAME_X_WINDOW (f),
                              &deviceid))
        {
-         x_catch_errors (FRAME_X_DISPLAY (f));
+         x_ignore_errors_for_next_request (FRAME_DISPLAY_INFO (f));
+
          XIWarpPointer (FRAME_X_DISPLAY (f),
                         deviceid, None,
                         FRAME_X_WINDOW (f),
                         0, 0, 0, 0, pix_x, pix_y);
-         x_uncatch_errors ();
        }
     }
   else
@@ -24889,7 +24888,7 @@ x_get_focus_frame (struct frame *f)
 
 /* In certain situations, when the window manager follows a
    click-to-focus policy, there seems to be no way around calling
-   XSetInputFocus to give another frame the input focus .
+   XSetInputFocus to give another frame the input focus.
 
    In an ideal world, XSetInputFocus should generally be avoided so
    that applications don't interfere with the window manager's focus
@@ -24899,28 +24898,25 @@ x_get_focus_frame (struct frame *f)
 static void
 x_focus_frame (struct frame *f, bool noactivate)
 {
-  Display *dpy = FRAME_X_DISPLAY (f);
+  struct x_display_info *dpyinfo;
 
-  block_input ();
-  x_catch_errors (dpy);
+  dpyinfo = FRAME_DISPLAY_INFO (f);
 
   if (FRAME_X_EMBEDDED_P (f))
-    {
-      /* For Xembedded frames, normally the embedder forwards key
-        events.  See XEmbed Protocol Specification at
-        https://freedesktop.org/wiki/Specifications/xembed-spec/  */
-      xembed_request_focus (f);
-    }
+    /* For Xembedded frames, normally the embedder forwards key
+       events.  See XEmbed Protocol Specification at
+       https://freedesktop.org/wiki/Specifications/xembed-spec/  */
+    xembed_request_focus (f);
   else
     {
+      /* Ignore any BadMatch error this request might result in.  */
+      x_ignore_errors_for_next_request (dpyinfo);
       XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
                      RevertToParent, CurrentTime);
+
       if (!noactivate)
        x_ewmh_activate_frame (f);
     }
-
-  x_uncatch_errors ();
-  unblock_input ();
 }
 
 



reply via email to

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