summaryrefslogtreecommitdiff
path: root/src/process.c
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-06-20 20:56:49 +0800
committerPo Lu <luangruo@yahoo.com>2022-06-20 20:59:38 +0800
commit4cc2f820b500ed2f8fad9baa2cf4a057f271a006 (patch)
treec32aa9a1882205d2ab62367ebadb976e9d06df5a /src/process.c
parenta7aeef934be65ed86993181f3ad3b4b074a6afaa (diff)
downloademacs-4cc2f820b500ed2f8fad9baa2cf4a057f271a006.tar.gz
Fix x-selection-timeout if some keyboard input arrives while waiting
* src/process.c (wait_reading_process_output): Don't allow skipping calls to select if detect_input_pending when just waiting for a cell. (bug#46935) * src/xselect.c (x_get_foreign_selection): Add more debugging code.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/process.c b/src/process.c
index 0cbac172fe4..8f654961482 100644
--- a/src/process.c
+++ b/src/process.c
@@ -5492,7 +5492,17 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
triggered by processing X events). In the latter case, set
nfds to 1 to avoid breaking the loop. */
no_avail = 0;
- if ((read_kbd || !NILP (wait_for_cell))
+ if ((read_kbd
+ /* The following code doesn't make any sense for just the
+ wait_or_cell case, because detect_input_pending returns
+ whether or not the keyboard buffer isn't empty or there
+ is mouse movement. Any keyboard input that arrives
+ while waiting for a cell will cause the select call to
+ be skipped, and gobble_input to be called even when
+ there is no input available from the terminal itself.
+ Skipping the call to select also causes the timeout to
+ be ignored. (bug#46935) */
+ /* || !NILP (wait_for_cell) */)
&& detect_input_pending ())
{
nfds = read_kbd ? 0 : 1;