changeset 45751:7318ee0c9772

(readable_events): Ignore any number of FOCUS_IN_EVENT events and return 0 if nothing else in buffer.
author Richard M. Stallman <rms@gnu.org>
date Tue, 11 Jun 2002 19:29:40 +0000
parents 73b33fa2ec78
children 55eeb73a3227
files src/keyboard.c
diffstat 1 files changed, 20 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/keyboard.c	Tue Jun 11 19:28:20 2002 +0000
+++ b/src/keyboard.c	Tue Jun 11 19:29:40 2002 +0000
@@ -3259,8 +3259,27 @@
   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;