emacs-diffs
[Top][All Lists]
Advanced

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

master e1c6b40e9d: Fix input availability detection during visible-bell


From: Po Lu
Subject: master e1c6b40e9d: Fix input availability detection during visible-bell
Date: Wed, 13 Apr 2022 03:05:08 -0400 (EDT)

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

    Fix input availability detection during visible-bell
    
    * src/xterm.c (XTflash): Exit pselect loop also if input becomes
    available on f's display connection.
---
 src/xterm.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/xterm.c b/src/xterm.c
index c1c9ebde5c..0c1c70340d 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -8652,6 +8652,8 @@ XTflash (struct frame *f)
 {
   GC gc;
   XGCValues values;
+  fd_set fds;
+  int fd;
 
   block_input ();
 
@@ -8702,6 +8704,7 @@ XTflash (struct frame *f)
 
   struct timespec delay = make_timespec (0, 150 * 1000 * 1000);
   struct timespec wakeup = timespec_add (current_timespec (), delay);
+  fd = ConnectionNumber (FRAME_X_DISPLAY (f));
 
   /* Keep waiting until past the time wakeup or any input gets
      available.  */
@@ -8717,8 +8720,17 @@ XTflash (struct frame *f)
       /* How long `select' should wait.  */
       timeout = make_timespec (0, 10 * 1000 * 1000);
 
+      /* Wait for some input to become available on the X
+        connection.  */
+      FD_ZERO (&fds);
+      FD_SET (fd, &fds);
+
       /* Try to wait that long--but we might wake up sooner.  */
-      pselect (0, NULL, NULL, NULL, &timeout, NULL);
+      pselect (fd + 1, &fds, NULL, NULL, &timeout, NULL);
+
+      /* Some input is available, exit the visible bell.  */
+      if (FD_ISSET (fd, &fds))
+       break;
     }
 
   /* If window is tall, flash top and bottom line.  */



reply via email to

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