unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@stupidchicken.com>
Cc: rms@gnu.org, emacs-devel@gnu.org
Subject: Re: [simon.marshall@misys.com: Lingering input pending with motif menu bar]
Date: Tue, 04 Jul 2006 09:45:45 -0400	[thread overview]
Message-ID: <87mzbp8ovq.fsf@stupidchicken.com> (raw)
In-Reply-To: <m38xn9wxdv.fsf@kfs-l.imdomain.dk> (Kim F. Storm's message of "Tue, 04 Jul 2006 11:08:12 +0200")

> 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	other threads:[~2006-07-04 13:45 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-01 23:55 [simon.marshall@misys.com: Lingering input pending with motif menu bar] Richard Stallman
2006-07-04  1:13 ` Chong Yidong
2006-07-04  9:08   ` Kim F. Storm
2006-07-04 13:45     ` Chong Yidong [this message]
2006-07-04 20:53       ` Richard Stallman
2006-07-04 21:21         ` [simon.marshall@misys.com: Lingering input pending with motifmenu bar] Drew Adams
2006-07-05 17:01           ` Richard Stallman
2006-07-05 20:48             ` [simon.marshall@misys.com: Lingering input pending withmotifmenu bar] Drew Adams
2006-07-07  4:14               ` Richard Stallman
2006-07-05 17:01           ` [simon.marshall@misys.com: Lingering input pending with motifmenu bar] Richard Stallman
2006-07-05  0:06         ` [simon.marshall@misys.com: Lingering input pending with motif menu bar] Chong Yidong
2006-07-05  9:04           ` Kim F. Storm
2006-07-04 17:03     ` [simon.marshall@misys.com: Lingering input pending with motifmenu bar] Drew Adams
2006-07-07 21:55 ` Revamping sit-for [Was: Lingering input pending with motif menu bar] Chong Yidong
2006-07-07 22:02   ` Revamping sit-for David Kastrup
2006-07-07 22:58   ` Revamping sit-for [Was: Lingering input pending with motif menu bar] Drew Adams
2006-07-08  1:39     ` Revamping sit-for Chong Yidong
2006-07-08  3:53       ` Drew Adams
2006-07-08 12:00         ` Chong Yidong
2006-07-08 12:36           ` David Kastrup
2006-07-08 12:56             ` Romain Francoise
2006-07-08 12:40           ` Stefan Monnier
2006-07-08 15:41           ` Drew Adams
2006-07-08 20:57           ` Richard Stallman
2006-07-08 15:31   ` Revamping sit-for [Was: Lingering input pending with motif menu bar] Richard Stallman
2006-07-08 22:49     ` Kim F. Storm
2006-07-09 19:03       ` Richard Stallman
2006-07-10 12:10         ` Kim F. Storm
2006-07-11  5:50           ` Richard Stallman
2006-07-08 23:02     ` Kim F. Storm
2006-07-10 19:47     ` Revamping sit-for Chong Yidong
2006-07-11  0:24       ` Chong Yidong
2006-07-11 18:16         ` Richard Stallman
2006-07-11 18:39           ` Kim F. Storm
2006-07-12 19:22             ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mzbp8ovq.fsf@stupidchicken.com \
    --to=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).