/[emacs]/emacs/src/keyboard.c
ViewVC logotype

Diff of /emacs/src/keyboard.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.683 by monnier, Mon Jun 17 18:45:44 2002 UTC revision 1.684 by jhd, Fri Jun 28 19:43:33 2002 UTC
# Line 672  void (*keyboard_init_hook) (); Line 672  void (*keyboard_init_hook) ();
672    
673  static int read_avail_input P_ ((int));  static int read_avail_input P_ ((int));
674  static void get_input_pending P_ ((int *, int));  static void get_input_pending P_ ((int *, int));
675    static void get_filtered_input_pending P_ ((int *, int, int));
676  static int readable_events P_ ((int));  static int readable_events P_ ((int));
677    static int readable_filtered_events P_ ((int, int));
678  static Lisp_Object read_char_x_menu_prompt P_ ((int, Lisp_Object *,  static Lisp_Object read_char_x_menu_prompt P_ ((int, Lisp_Object *,
679                                                  Lisp_Object, int *));                                                  Lisp_Object, int *));
680  static Lisp_Object read_char_x_menu_prompt ();  static Lisp_Object read_char_x_menu_prompt ();
# Line 3253  some_mouse_moved () Line 3255  some_mouse_moved ()
3255  /* Return true iff there are any events in the queue that read-char  /* Return true iff there are any events in the queue that read-char
3256     would return.  If this returns false, a read-char would block.  */     would return.  If this returns false, a read-char would block.  */
3257  static int  static int
3258  readable_events (do_timers_now)  readable_filtered_events (do_timers_now, filter_events)
3259       int do_timers_now;       int do_timers_now;
3260         int filter_events;
3261  {  {
3262    if (do_timers_now)    if (do_timers_now)
3263      timer_check (do_timers_now);      timer_check (do_timers_now);
3264    
3265    /* If the buffer contains only FOCUS_IN_EVENT events,    /* If the buffer contains only FOCUS_IN_EVENT events,
3266       report it as empty.  */       and FILTER_EVENTS is nonzero, report it as empty.  */
3267    if (kbd_fetch_ptr != kbd_store_ptr)    if (kbd_fetch_ptr != kbd_store_ptr)
3268      {      {
3269        struct input_event *event;        int have_live_event = 1;
3270    
3271        event = ((kbd_fetch_ptr < kbd_buffer + KBD_BUFFER_SIZE)        if (filter_events)
3272                 ? kbd_fetch_ptr          {
3273                 : kbd_buffer);            struct input_event *event;
3274    
3275        while (event->kind == FOCUS_IN_EVENT)            event = ((kbd_fetch_ptr < kbd_buffer + KBD_BUFFER_SIZE)
3276          {                     ? kbd_fetch_ptr
3277            event++;                     : kbd_buffer);
3278            if (event == kbd_buffer + KBD_BUFFER_SIZE)  
3279              event = kbd_buffer;            while (have_live_event && event->kind == FOCUS_IN_EVENT)
3280            if (event == kbd_store_ptr)              {
3281              return 0;                event++;
3282          }                if (event == kbd_buffer + KBD_BUFFER_SIZE)
3283        return 1;                  event = kbd_buffer;
3284                  if (event == kbd_store_ptr)
3285                    have_live_event = 0;
3286                }
3287            }
3288          if (have_live_event) return 1;
3289      }      }
3290    
3291  #ifdef HAVE_MOUSE  #ifdef HAVE_MOUSE
# Line 3299  readable_events (do_timers_now) Line 3307  readable_events (do_timers_now)
3307    return 0;    return 0;
3308  }  }
3309    
3310    /* Return true iff there are any events in the queue that read-char
3311       would return.  If this returns false, a read-char would block.  */
3312    static int
3313    readable_events (do_timers_now)
3314         int do_timers_now;
3315    {
3316      return readable_filtered_events (do_timers_now, 0);
3317    }
3318    
3319  /* Set this for debugging, to have a way to get out */  /* Set this for debugging, to have a way to get out */
3320  int stop_character;  int stop_character;
3321    
# Line 6144  lucid_event_type_list_p (object) Line 6161  lucid_event_type_list_p (object)
6161     but works even if FIONREAD does not exist.     but works even if FIONREAD does not exist.
6162     (In fact, this may actually read some input.)     (In fact, this may actually read some input.)
6163    
6164     If DO_TIMERS_NOW is nonzero, actually run timer events that are ripe.  */     If DO_TIMERS_NOW is nonzero, actually run timer events that are ripe.
6165       If FILTER_EVENTS is nonzero, ignore internal events (FOCUS_IN_EVENT). */
6166    
6167  static void  static void
6168  get_input_pending (addr, do_timers_now)  get_filtered_input_pending (addr, do_timers_now, filter_events)
6169       int *addr;       int *addr;
6170       int do_timers_now;       int do_timers_now;
6171         int filter_events;
6172  {  {
6173    /* First of all, have we already counted some input?  */    /* First of all, have we already counted some input?  */
6174    *addr = !NILP (Vquit_flag) || readable_events (do_timers_now);    *addr = (!NILP (Vquit_flag)
6175               || readable_filtered_events (do_timers_now, filter_events));
6176    
6177    /* If input is being read as it arrives, and we have none, there is none.  */    /* If input is being read as it arrives, and we have none, there is none.  */
6178    if (*addr > 0 || (interrupt_input && ! interrupts_deferred))    if (*addr > 0 || (interrupt_input && ! interrupts_deferred))
# Line 6160  get_input_pending (addr, do_timers_now) Line 6180  get_input_pending (addr, do_timers_now)
6180    
6181    /* Try to read some input and see how much we get.  */    /* Try to read some input and see how much we get.  */
6182    gobble_input (0);    gobble_input (0);
6183    *addr = !NILP (Vquit_flag) || readable_events (do_timers_now);    *addr = (!NILP (Vquit_flag)
6184               || readable_filtered_events (do_timers_now, filter_events));
6185    }
6186    
6187    /* Store into *addr a value nonzero if terminal input chars are available.
6188       Serves the purpose of ioctl (0, FIONREAD, addr)
6189       but works even if FIONREAD does not exist.
6190       (In fact, this may actually read some input.)
6191    
6192       If DO_TIMERS_NOW is nonzero, actually run timer events that are ripe.  */
6193    
6194    static void
6195    get_input_pending (addr, do_timers_now)
6196         int *addr;
6197         int do_timers_now;
6198    {
6199      get_filtered_input_pending (addr, do_timers_now, 0);
6200  }  }
6201    
6202  /* Interface to read_avail_input, blocking SIGIO or SIGALRM if necessary.  */  /* Interface to read_avail_input, blocking SIGIO or SIGALRM if necessary.  */
# Line 9563  if there is a doubt, the value is t.  */ Line 9599  if there is a doubt, the value is t.  */
9599    if (!NILP (Vunread_command_events) || unread_command_char != -1)    if (!NILP (Vunread_command_events) || unread_command_char != -1)
9600      return (Qt);      return (Qt);
9601    
9602    get_input_pending (&input_pending, 1);    get_filtered_input_pending (&input_pending, 1, 1);
9603    return input_pending > 0 ? Qt : Qnil;    return input_pending > 0 ? Qt : Qnil;
9604  }  }
9605    

Legend:
Removed from v.1.683  
changed lines
  Added in v.1.684

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26