emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/keyboard.c


From: Jan Djärv
Subject: [Emacs-diffs] Changes to emacs/src/keyboard.c
Date: Fri, 28 Jun 2002 15:43:33 -0400

Index: emacs/src/keyboard.c
diff -c emacs/src/keyboard.c:1.683 emacs/src/keyboard.c:1.684
*** emacs/src/keyboard.c:1.683  Mon Jun 17 14:45:44 2002
--- emacs/src/keyboard.c        Fri Jun 28 15:43:33 2002
***************
*** 672,678 ****
--- 672,680 ----
  
  static int read_avail_input P_ ((int));
  static void get_input_pending P_ ((int *, int));
+ static void get_filtered_input_pending P_ ((int *, int, int));
  static int readable_events P_ ((int));
+ static int readable_filtered_events P_ ((int, int));
  static Lisp_Object read_char_x_menu_prompt P_ ((int, Lisp_Object *,
                                                Lisp_Object, int *));
  static Lisp_Object read_char_x_menu_prompt ();
***************
*** 3253,3283 ****
  /* Return true iff there are any events in the queue that read-char
     would return.  If this returns false, a read-char would block.  */
  static int
! readable_events (do_timers_now)
       int 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)
      {
!       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
--- 3255,3291 ----
  /* Return true iff there are any events in the queue that read-char
     would return.  If this returns false, a read-char would block.  */
  static int
! readable_filtered_events (do_timers_now, filter_events)
       int do_timers_now;
+      int filter_events;
  {
    if (do_timers_now)
      timer_check (do_timers_now);
  
    /* If the buffer contains only FOCUS_IN_EVENT events,
!      and FILTER_EVENTS is nonzero, report it as empty.  */
    if (kbd_fetch_ptr != kbd_store_ptr)
      {
!       int have_live_event = 1;
  
!       if (filter_events)
!         {
!           struct input_event *event;
  
!           event = ((kbd_fetch_ptr < kbd_buffer + KBD_BUFFER_SIZE)
!                    ? kbd_fetch_ptr
!                    : kbd_buffer);
! 
!           while (have_live_event && event->kind == FOCUS_IN_EVENT)
!             {
!               event++;
!               if (event == kbd_buffer + KBD_BUFFER_SIZE)
!                 event = kbd_buffer;
!               if (event == kbd_store_ptr)
!                 have_live_event = 0;
!             }
!         }
!       if (have_live_event) return 1;
      }
  
  #ifdef HAVE_MOUSE
***************
*** 3299,3304 ****
--- 3307,3321 ----
    return 0;
  }
  
+ /* Return true iff there are any events in the queue that read-char
+    would return.  If this returns false, a read-char would block.  */
+ static int
+ readable_events (do_timers_now)
+      int do_timers_now;
+ {
+   return readable_filtered_events (do_timers_now, 0);
+ }
+ 
  /* Set this for debugging, to have a way to get out */
  int stop_character;
  
***************
*** 6144,6158 ****
     but works even if FIONREAD does not exist.
     (In fact, this may actually read some input.)
  
!    If DO_TIMERS_NOW is nonzero, actually run timer events that are ripe.  */
  
  static void
! get_input_pending (addr, do_timers_now)
       int *addr;
       int do_timers_now;
  {
    /* First of all, have we already counted some input?  */
!   *addr = !NILP (Vquit_flag) || readable_events (do_timers_now);
  
    /* If input is being read as it arrives, and we have none, there is none.  
*/
    if (*addr > 0 || (interrupt_input && ! interrupts_deferred))
--- 6161,6178 ----
     but works even if FIONREAD does not exist.
     (In fact, this may actually read some input.)
  
!    If DO_TIMERS_NOW is nonzero, actually run timer events that are ripe.
!    If FILTER_EVENTS is nonzero, ignore internal events (FOCUS_IN_EVENT). */
  
  static void
! get_filtered_input_pending (addr, do_timers_now, filter_events)
       int *addr;
       int do_timers_now;
+      int filter_events;
  {
    /* First of all, have we already counted some input?  */
!   *addr = (!NILP (Vquit_flag)
!            || readable_filtered_events (do_timers_now, filter_events));
  
    /* If input is being read as it arrives, and we have none, there is none.  
*/
    if (*addr > 0 || (interrupt_input && ! interrupts_deferred))
***************
*** 6160,6166 ****
  
    /* Try to read some input and see how much we get.  */
    gobble_input (0);
!   *addr = !NILP (Vquit_flag) || readable_events (do_timers_now);
  }
  
  /* Interface to read_avail_input, blocking SIGIO or SIGALRM if necessary.  */
--- 6180,6202 ----
  
    /* Try to read some input and see how much we get.  */
    gobble_input (0);
!   *addr = (!NILP (Vquit_flag)
!            || readable_filtered_events (do_timers_now, filter_events));
! }
! 
! /* Store into *addr a value nonzero if terminal input chars are available.
!    Serves the purpose of ioctl (0, FIONREAD, addr)
!    but works even if FIONREAD does not exist.
!    (In fact, this may actually read some input.)
! 
!    If DO_TIMERS_NOW is nonzero, actually run timer events that are ripe.  */
! 
! static void
! get_input_pending (addr, do_timers_now)
!      int *addr;
!      int do_timers_now;
! {
!   get_filtered_input_pending (addr, do_timers_now, 0);
  }
  
  /* Interface to read_avail_input, blocking SIGIO or SIGALRM if necessary.  */
***************
*** 9563,9569 ****
    if (!NILP (Vunread_command_events) || unread_command_char != -1)
      return (Qt);
  
!   get_input_pending (&input_pending, 1);
    return input_pending > 0 ? Qt : Qnil;
  }
  
--- 9599,9605 ----
    if (!NILP (Vunread_command_events) || unread_command_char != -1)
      return (Qt);
  
!   get_filtered_input_pending (&input_pending, 1, 1);
    return input_pending > 0 ? Qt : Qnil;
  }
  



reply via email to

[Prev in Thread] Current Thread [Next in Thread]