]> git.eshelyaron.com Git - emacs.git/commitdiff
Remove what should be unnecessary calls to block_input
authorPo Lu <luangruo@yahoo.com>
Sun, 18 Sep 2022 07:23:42 +0000 (15:23 +0800)
committerPo Lu <luangruo@yahoo.com>
Sun, 18 Sep 2022 07:24:02 +0000 (15:24 +0800)
* src/xterm.c (handle_one_xevent): Do not block input inside.
This function is not reentrant and is always called with input
blocked.

src/xterm.c

index deceafbc817d3bc7a03daa0e57c01b8142c3f0ba..cb6581b78cfe553381f0c0f024d327883e5e0a22 100644 (file)
@@ -17628,6 +17628,12 @@ handle_one_xevent (struct x_display_info *dpyinfo,
   int dx, dy;
   USE_SAFE_ALLOCA;
 
+  /* This function is not reentrant, so input should be blocked before
+     it is called.  */
+
+  if (!input_blocked_p ())
+    emacs_abort ();
+
   *finish = X_EVENT_NORMAL;
 
   EVENT_INIT (inev.ie);
@@ -18526,11 +18532,9 @@ handle_one_xevent (struct x_display_info *dpyinfo,
              Window root;
              unsigned int dummy_uint;
 
-             block_input ();
              XGetGeometry (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
                            &root, &f->left_pos, &f->top_pos,
                            &dummy_uint, &dummy_uint, &dummy_uint, &dummy_uint);
-             unblock_input ();
            }
 
           x_set_frame_alpha (f);
@@ -18555,7 +18559,6 @@ handle_one_xevent (struct x_display_info *dpyinfo,
         {
           if (!FRAME_VISIBLE_P (f))
             {
-              block_input ();
              /* By default, do not set the frame's visibility here, see
                 https://lists.gnu.org/archive/html/emacs-devel/2017-02/msg00133.html.
                 The default behavior can be overridden by setting
@@ -18574,7 +18577,6 @@ handle_one_xevent (struct x_display_info *dpyinfo,
 #endif
               f->output_data.x->has_been_visible = true;
               SET_FRAME_GARBAGED (f);
-              unblock_input ();
             }
           else if (FRAME_GARBAGED_P (f))
            {
@@ -20069,12 +20071,10 @@ handle_one_xevent (struct x_display_info *dpyinfo,
          flicker.  Don't try to optimize these calls by looking only
          for size changes: that's not sufficient.  We miss some
          surface invalidations and flicker.  */
-      block_input ();
 #ifdef HAVE_XDBE
       if (f && FRAME_X_DOUBLE_BUFFERED_P (f))
         x_drop_xrender_surfaces (f);
 #endif
-      unblock_input ();
 #if defined USE_CAIRO && !defined USE_GTK
       if (f)
        x_cr_update_surface_desired_size (f, configureEvent.xconfigure.width,
@@ -20104,10 +20104,8 @@ handle_one_xevent (struct x_display_info *dpyinfo,
               f->new_width, f->new_height);
 
 #ifdef HAVE_XDBE
-         block_input ();
           if (FRAME_X_DOUBLE_BUFFERED_P (f))
             x_drop_xrender_surfaces (f);
-          unblock_input ();
 #endif
           xg_frame_resized (f, configureEvent.xconfigure.width,
                             configureEvent.xconfigure.height);
@@ -20197,11 +20195,9 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                  Window root;
                  unsigned int dummy_uint;
 
-                 block_input ();
                  XGetGeometry (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
                                &root, &f->left_pos, &f->top_pos,
                                &dummy_uint, &dummy_uint, &dummy_uint, &dummy_uint);
-                 unblock_input ();
                }
 
              if (!FRAME_TOOLTIP_P (f)
@@ -20486,12 +20482,10 @@ handle_one_xevent (struct x_display_info *dpyinfo,
 
            if (FRAME_PARENT_FRAME (f) || (hf && frame_ancestor_p (f, hf)))
              {
-               block_input ();
                XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
                                RevertToParent, event->xbutton.time);
                if (FRAME_PARENT_FRAME (f))
                  XRaiseWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f));
-               unblock_input ();
              }
          }
 
@@ -22152,7 +22146,6 @@ handle_one_xevent (struct x_display_info *dpyinfo,
 
                  if (FRAME_PARENT_FRAME (f) || (hf && frame_ancestor_p (f, hf)))
                    {
-                     block_input ();
 #if defined HAVE_GTK3 || (!defined USE_GTK && !defined USE_X_TOOLKIT)
                      if (device)
                        {
@@ -22175,7 +22168,6 @@ handle_one_xevent (struct x_display_info *dpyinfo,
 #endif
                      if (FRAME_PARENT_FRAME (f))
                        XRaiseWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f));
-                     unblock_input ();
                    }
                }
 
@@ -23680,7 +23672,6 @@ handle_one_xevent (struct x_display_info *dpyinfo,
 #endif
     OTHER:
 #ifdef USE_X_TOOLKIT
-      block_input ();
       if (*finish != X_EVENT_DROP)
        {
          /* Ignore some obviously bogus ConfigureNotify events that
@@ -23697,7 +23688,6 @@ handle_one_xevent (struct x_display_info *dpyinfo,
 #endif
            }
        }
-      unblock_input ();
 #endif /* USE_X_TOOLKIT */
 #if defined USE_GTK && !defined HAVE_GTK3 && defined HAVE_XINPUT2
       if (*finish != X_EVENT_DROP && copy)