emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: address@hidden: Lingering input pending with motif menu bar]


From: Chong Yidong
Subject: Re: address@hidden: Lingering input pending with motif menu bar]
Date: Tue, 04 Jul 2006 09:45:45 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> Problem is that input-pending-p simply indicates that there is
> some unprocessed event in the queue -- not necessarily something
> the user entered by pressing a key or clicking a mouse button.
>
> I haven't looked to see what specific events are in the queue
> in the above cases, but maybe it is a help-echo and "leave" event.
>
>> Maybe someone who's worked on sit-for and/or the no-toolkit menu code
>> can enlighten us.  Why does the input-pending-p get triggered, and is
>> there any way to distinguish between a real input event and a fake
>> one?  (Checking unread-command-chars or last-input-event doesn't
>> work).
>
> There is code to ignore FOCUS_IN events in readable_events.
> Maybe we can extend the list to include more events.
> But we may want to actually process some of those events.

I've found a Lisp-level workaround --- by using `read-event' and
`with-timeout', it's possible to catch just the events we are
interested in (i.e., mouse clicks and keystrokes).  It took quite a
long time to find something that works, though.

If this is an acceptable solution, the Elisp manual node on "Waiting"
could be updated to mention this hack.

*** emacs/lisp/play/hanoi.el.~1.19.~    2006-05-09 10:08:04.000000000 -0400
--- emacs/lisp/play/hanoi.el    2006-07-04 09:44:24.000000000 -0400
***************
*** 399,407 ****
  ;; update display and pause, quitting with a pithy comment if the user
  ;; hits a key.
  (defun hanoi-sit-for (seconds)
!   (sit-for seconds)
!   (if (input-pending-p)
!       (signal 'quit '("I can tell you've had enough"))))
  
  ;; move ring to a given buffer position and update ring's car.
  (defun hanoi-ring-to-pos (ring pos)
--- 399,409 ----
  ;; update display and pause, quitting with a pithy comment if the user
  ;; hits a key.
  (defun hanoi-sit-for (seconds)
!   (if (= 0 seconds)
!       (sit-for 0)
!     (if (with-timeout (seconds nil)
!         (read-event))
!       (signal 'quit '("I can tell you've had enough")))))
  
  ;; move ring to a given buffer position and update ring's car.
  (defun hanoi-ring-to-pos (ring pos)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]