emacs-diffs
[Top][All Lists]
Advanced

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

master 25587ada2c: Remove what should be unnecessary calls to block_inpu


From: Po Lu
Subject: master 25587ada2c: Remove what should be unnecessary calls to block_input
Date: Sun, 18 Sep 2022 03:24:13 -0400 (EDT)

branch: master
commit 25587ada2c094e5435a7a39bf99e97730cc7ecd0
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Remove what should be unnecessary calls to block_input
    
    * 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 | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index deceafbc81..cb6581b78c 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -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)



reply via email to

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