From: Richard M. Stallman Date: Tue, 11 Jun 2002 19:29:40 +0000 (+0000) Subject: (readable_events): Ignore any number of X-Git-Tag: ttn-vms-21-2-B4~14672 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a0ba8995e3c579f4c57a674b1b44d60f6a4fb82d;p=emacs.git (readable_events): Ignore any number of FOCUS_IN_EVENT events and return 0 if nothing else in buffer. --- diff --git a/src/keyboard.c b/src/keyboard.c index ffc86840865..6b02c399bf2 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -3259,8 +3259,27 @@ readable_events (do_timers_now) if (do_timers_now) timer_check (do_timers_now); + /* If the buffer contains only FOCUS_IN_EVENT events, + report it as empty. */ if (kbd_fetch_ptr != kbd_store_ptr) - return 1; + { + struct input_event *event; + + event = ((kbd_fetch_ptr < kbd_buffer + KBD_BUFFER_SIZE) + ? kbd_fetch_ptr + : kbd_buffer); + + while (event->kind == FOCUS_IN_EVENT) + { + event++; + if (event == kbd_buffer + KBD_BUFFER_SIZE) + event = kbd_buffer; + if (event == kbd_store_ptr) + return 0; + } + return 1; + } + #ifdef HAVE_MOUSE if (!NILP (do_mouse_tracking) && some_mouse_moved ()) return 1;