mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-05 03:20:39 -08:00
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.
This commit is contained in:
parent
a7aeef934b
commit
4cc2f820b5
2 changed files with 18 additions and 2 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -1261,7 +1261,13 @@ x_get_foreign_selection (Lisp_Object selection_symbol, Lisp_Object target_type,
|
|||
intmax_t timeout = max (0, x_selection_timeout);
|
||||
intmax_t secs = timeout / 1000;
|
||||
int nsecs = (timeout % 1000) * 1000000;
|
||||
TRACE1 (" Start waiting %"PRIdMAX" secs for SelectionNotify", secs);
|
||||
TRACE1 (" Start waiting %"PRIdMAX" secs for SelectionNotify.", secs);
|
||||
|
||||
if (input_blocked_p ())
|
||||
TRACE0 (" Input is blocked.");
|
||||
else
|
||||
TRACE1 (" Waiting for %d nsecs in addition.", nsecs);
|
||||
|
||||
/* This function can be called with input blocked inside Xt or GTK
|
||||
timeouts run inside popup menus, so use a function that works
|
||||
when input is blocked. Prefer wait_reading_process_output
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue