all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kevin Rodgers <kevin.d.rodgers@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Inhibit more keyboard event during execution of function
Date: Mon, 28 Dec 2009 23:51:40 -0700	[thread overview]
Message-ID: <hhc8ts$g3h$1@ger.gmane.org> (raw)
In-Reply-To: <87skauojkb.fsf@gmail.com>

Mathias Dahl wrote:
> I have made a small game for my kid that lets him press a key and that
> will play a sound and display an image. It is implemented as a major
> mode with a keymap where each key is defined using `define-key' and
> bound to a special play command with a string of what to play (say,
> "cow"). Now, it works for me, but when I tested this on my son today he
> kept the key pressed way longer than I do, with the effect that the key
> repeats, playing the sound many times. Quite annoying. Is there a way to
> get around this? I have been thinking of having some timing built in so
> that I will not play again unless a certain time has passed.
> 
> Also, even though I tell Emacs to draw the image first (using
> `insert-image-file'), it is not displayed until the sound has stopped
> playing (I use `play-sound-file'). Any way around this?

I don't know if this will work, but you could try let-binding
unread-command-events to nil while the sound is being played.
The idea is that any input events would be added to the queue,
but when the sound is done the queued events would be discarded
and the command loop wouldn't see them.

-- 
Kevin Rodgers
Denver, Colorado, USA





  reply	other threads:[~2009-12-29  6:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-28 21:49 Inhibit more keyboard event during execution of function Mathias Dahl
2009-12-29  6:51 ` Kevin Rodgers [this message]
     [not found] ` <mailman.367.1262069524.18930.help-gnu-emacs@gnu.org>
2009-12-29 20:03   ` Mathias Dahl
2009-12-29 20:53     ` Lennart Borgman
     [not found]     ` <mailman.388.1262120023.18930.help-gnu-emacs@gnu.org>
2009-12-29 22:40       ` Mathias Dahl
2009-12-29 23:52         ` Lennart Borgman
2009-12-29 22:11 ` Ilya Zakharevich
2009-12-29 22:38   ` Mathias Dahl
2009-12-29 22:56 ` Mathias Dahl
2009-12-29 23:00   ` Mathias Dahl
2009-12-30  9:52     ` Andreas Politz
     [not found]     ` <mailman.421.1262166805.18930.help-gnu-emacs@gnu.org>
2009-12-31  7:51       ` Mathias Dahl

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

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

  git send-email \
    --in-reply-to='hhc8ts$g3h$1@ger.gmane.org' \
    --to=kevin.d.rodgers@gmail.com \
    --cc=help-gnu-emacs@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.