aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2000-08-09 12:24:02 +0000
committerEli Zaretskii2000-08-09 12:24:02 +0000
commiteeabfe765e9373200ffb28e1a27237327085f7db (patch)
tree4cbe6df198bf6442060981633d6c1c784efda03c /src
parent41e757a6680137acd86ed964711fa1c0d16429c7 (diff)
downloademacs-eeabfe765e9373200ffb28e1a27237327085f7db.tar.gz
emacs-eeabfe765e9373200ffb28e1a27237327085f7db.zip
(kbd_buffer_events_waiting): New function.
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index b470ca5435b..87e385a3299 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -3251,6 +3251,31 @@ discard_mouse_events ()
3251 } 3251 }
3252 } 3252 }
3253} 3253}
3254
3255/* Return non-zero if there are any events waiting in the event buffer
3256 whose .kind is not no_event. If DISCARD is non-zero, discard all
3257 no_event placeholders up to the first real event. If there are no
3258 real events waiting and DISCARD is non-zero, this function makes
3259 the event buffer empty as side effect. */
3260int
3261kbd_buffer_events_waiting (discard)
3262 int discard;
3263{
3264 struct input_event *sp;
3265 for (sp = kbd_fetch_ptr; sp != kbd_store_ptr; sp++)
3266 {
3267 if (sp == kbd_buffer + KBD_BUFFER_SIZE)
3268 sp = kbd_buffer;
3269
3270 if (sp->kind != no_event)
3271 return 1;
3272 if (discard)
3273 kbd_fetch_ptr = sp;
3274 }
3275 if (discard)
3276 kbd_fetch_ptr = sp;
3277 return 0;
3278}
3254 3279
3255/* Read one event from the event buffer, waiting if necessary. 3280/* Read one event from the event buffer, waiting if necessary.
3256 The value is a Lisp object representing the event. 3281 The value is a Lisp object representing the event.