aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPo Lu2022-04-13 15:03:50 +0800
committerPo Lu2022-04-13 15:03:50 +0800
commite1c6b40e9d3b9bb44a310dcac4f7f05b4e5bde4f (patch)
tree759830a8e8fcbb2ea9b088a625d5a1e230db162d
parenteb85abf5b2d0ce02f934f2d334ecd60c57da907c (diff)
downloademacs-e1c6b40e9d3b9bb44a310dcac4f7f05b4e5bde4f.tar.gz
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.
-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)
8652{ 8652{
8653 GC gc; 8653 GC gc;
8654 XGCValues values; 8654 XGCValues values;
8655 fd_set fds;
8656 int fd;
8655 8657
8656 block_input (); 8658 block_input ();
8657 8659
@@ -8702,6 +8704,7 @@ XTflash (struct frame *f)
8702 8704
8703 struct timespec delay = make_timespec (0, 150 * 1000 * 1000); 8705 struct timespec delay = make_timespec (0, 150 * 1000 * 1000);
8704 struct timespec wakeup = timespec_add (current_timespec (), delay); 8706 struct timespec wakeup = timespec_add (current_timespec (), delay);
8707 fd = ConnectionNumber (FRAME_X_DISPLAY (f));
8705 8708
8706 /* Keep waiting until past the time wakeup or any input gets 8709 /* Keep waiting until past the time wakeup or any input gets
8707 available. */ 8710 available. */
@@ -8717,8 +8720,17 @@ XTflash (struct frame *f)
8717 /* How long `select' should wait. */ 8720 /* How long `select' should wait. */
8718 timeout = make_timespec (0, 10 * 1000 * 1000); 8721 timeout = make_timespec (0, 10 * 1000 * 1000);
8719 8722
8723 /* Wait for some input to become available on the X
8724 connection. */
8725 FD_ZERO (&fds);
8726 FD_SET (fd, &fds);
8727
8720 /* Try to wait that long--but we might wake up sooner. */ 8728 /* Try to wait that long--but we might wake up sooner. */
8721 pselect (0, NULL, NULL, NULL, &timeout, NULL); 8729 pselect (fd + 1, &fds, NULL, NULL, &timeout, NULL);
8730
8731 /* Some input is available, exit the visible bell. */
8732 if (FD_ISSET (fd, &fds))
8733 break;
8722 } 8734 }
8723 8735
8724 /* If window is tall, flash top and bottom line. */ 8736 /* If window is tall, flash top and bottom line. */