Subject: Re: bug#55368: 29.0.50; Unreliable input-pending-p and throw-on-input on Emacs 29 / pgtk in Wayland

From: Po Lu <[email-masked]>
Date: Fri, 13 May 2022 10:01:18 +0800

Vijay Marupudi <[email-masked]> writes:

> Hello,
>
> I would like to report an inconsistency issue with how pending input is
> communicated with elisp code. In Emacs 29, input-pending-p sometimes
> returns t and while-no-input is interrupting code (because it uses
> throw-on-input) AFTER all keyboard input has already been read into
> elisp code and is being processed, and when there is no pending input.
> This is leading to code being unable to process and react to the latest
> input because it gets interrupted while handling the latest input.
>
> This issue does not occur in X.Org sessions, only Wayland.

Does that mean the bug doesn't happen in the regular X build, or does it
mean that nothing happens if you run the PGTK build under X Windows?

And what happens if you comment out this code in `readable_events' in
keyboard.c?

  if (!(flags & READABLE_EVENTS_IGNORE_SQUEEZABLES) && some_mouse_moved ())
    return 1;
  if (single_kboard)
    {
      if (current_kboard->kbd_queue_has_data)
	return 1;
    }
  else
    {
      KBOARD *kb;
      for (kb = all_kboards; kb; kb = kb->next_kboard)
	if (kb->kbd_queue_has_data)
	  return 1;
    }