summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-04-13 15:03:50 +0800
committerPo Lu <luangruo@yahoo.com>2022-04-13 15:03:50 +0800
commite1c6b40e9d3b9bb44a310dcac4f7f05b4e5bde4f (patch)
tree759830a8e8fcbb2ea9b088a625d5a1e230db162d /src
parenteb85abf5b2d0ce02f934f2d334ecd60c57da907c (diff)
downloademacs-e1c6b40e9d3b9bb44a310dcac4f7f05b4e5bde4f.tar.gz
emacs-e1c6b40e9d3b9bb44a310dcac4f7f05b4e5bde4f.tar.bz2
emacs-e1c6b40e9d3b9bb44a310dcac4f7f05b4e5bde4f.zip
Fix input availability detection during visible-bell
* src/xterm.c (XTflash): Exit pselect loop also if input becomes available on f's display connection.
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/xterm.c b/src/xterm.c
index c1c9ebde5cb..0c1c70340de 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. */