diff options
| author | Eli Zaretskii | 2000-08-09 12:24:02 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2000-08-09 12:24:02 +0000 |
| commit | eeabfe765e9373200ffb28e1a27237327085f7db (patch) | |
| tree | 4cbe6df198bf6442060981633d6c1c784efda03c /src | |
| parent | 41e757a6680137acd86ed964711fa1c0d16429c7 (diff) | |
| download | emacs-eeabfe765e9373200ffb28e1a27237327085f7db.tar.gz emacs-eeabfe765e9373200ffb28e1a27237327085f7db.zip | |
(kbd_buffer_events_waiting): New function.
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 25 |
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. */ | ||
| 3260 | int | ||
| 3261 | kbd_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. |