CVS update by aidan xemacs/src ...

xemacs-cvs at xemacs.org xemacs-cvs at xemacs.org
Mon Dec 11 05:10:23 EST 2006


  User: aidan   
  Date: 06/12/11 11:10:23

  Modified:    xemacs/src ChangeLog event-tty.c
Log:
2006-12-08  Aidan Kehoe  <kehoea at parhasard.net>

        * event-tty.c:
        * event-tty.c (emacs_tty_event_pending_p):
        * event-tty.c (reinit_vars_of_event_tty):
        Pay attention to the dispatch event queue, and input pending
        signals in emacs_tty_event_pending_p. Makes pure TTY builds more
        responsive.

Revision  Changes    Path
1.1032    +9 -0      XEmacs/xemacs/src/ChangeLog

Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/ChangeLog,v
retrieving revision 1.1031
retrieving revision 1.1032
diff -u -p -r1.1031 -r1.1032
--- ChangeLog	2006/12/11 10:04:27	1.1031
+++ ChangeLog	2006/12/11 10:10:18	1.1032
@@ -1,5 +1,14 @@
 2006-12-11  Aidan Kehoe  <kehoea at parhasard.net>
 
+	* event-tty.c: 
+	* event-tty.c (emacs_tty_event_pending_p): 
+	* event-tty.c (reinit_vars_of_event_tty): 
+	Pay attention to the dispatch event queue, and input pending 
+	signals in emacs_tty_event_pending_p. Makes pure TTY builds more 
+	responsive.  
+
+2006-12-11  Aidan Kehoe  <kehoea at parhasard.net>
+
 	* glyphs-eimage.c (png_warning_func): 
 	* glyphs-eimage.c (png_instantiate): 
 	* glyphs-eimage.c (tiff_warning_func): 



1.18      +64 -6     XEmacs/xemacs/src/event-tty.c

Index: event-tty.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/event-tty.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -p -r1.17 -r1.18
--- event-tty.c	2006/08/04 20:55:04	1.17
+++ event-tty.c	2006/12/11 10:10:20	1.18
@@ -45,6 +45,8 @@ static struct event_stream *tty_event_st
 extern int mswindows_is_blocking;
 #endif
 
+static int last_quit_check_signal_tick_count;
+
 
 /************************************************************************/
 /*				timeout events				*/
@@ -84,22 +86,76 @@ tty_timeout_to_emacs_event (Lisp_Event *
 static int
 emacs_tty_event_pending_p (int how_many)
 {
+  Lisp_Object event;
+  int tick_count_val;
+
+  /* Cf. the comments on emacs_Xt_event_pending_p in event-xlike-inc.c . */
+
   if (!how_many)
     {
       EMACS_TIME sometime;
-      /* see if there's a pending timeout. */
+
+      /* (1) Any pending events in the dispatch queue? */
+      if (!NILP(dispatch_event_queue))
+        {
+          return 1;
+        }
+
+      /* (2) Any TTY or process input available? */
+      if (poll_fds_for_input (non_fake_input_wait_mask))
+        return 1;
+
+      /* (3) Any timeout input available? */
       EMACS_GET_TIME (sometime);
       if (tty_timer_queue &&
 	  EMACS_TIME_EQUAL_OR_GREATER (sometime, tty_timer_queue->time))
 	return 1;
+    }
+  else
+    {
+      /* HOW_MANY > 0 */
+      EVENT_CHAIN_LOOP (event, dispatch_event_queue)
+	{
+	  if (command_event_p (event))
+	    {
+	      how_many--;
+	      if (how_many <= 0)
+		return 1;
+	    }
+	}
 
-      return poll_fds_for_input (non_fake_input_wait_mask);
     }
+
+  tick_count_val = quit_check_signal_tick_count;
+
+  /* Checking in_modal_loop here is a bit cargo-cultish, since its use is
+     specific to builds with a window system. */
+  if (!in_modal_loop &&
+      (last_quit_check_signal_tick_count != tick_count_val))
+    {
+      last_quit_check_signal_tick_count = tick_count_val;
 
-  /* #### Not right!  We need to *count* the number of pending events, which
-     means we need to have a dispatch queue and drain the pending events,
-     using drain_tty_devices(). */
-  return poll_fds_for_input (tty_only_mask);
+      /* We need to drain the entire queue now -- if we only drain part of
+         it, we may later on end up with events actually pending but
+         detect_input_pending() returning false because there wasn't
+         another SIGIO. */
+      event_stream_drain_queue ();
+
+      if (!how_many)
+        return !NILP (dispatch_event_queue);
+
+      EVENT_CHAIN_LOOP (event, dispatch_event_queue)
+        {
+          if (command_event_p (event))
+            {
+              how_many--;
+              if (how_many <= 0)
+                return 1;
+            }
+        }
+    }
+
+  return 0;
 }
 
 static void
@@ -304,6 +360,8 @@ reinit_vars_of_event_tty (void)
   tty_event_stream->drain_queue_cb	= emacs_tty_drain_queue;
   tty_event_stream->create_io_streams_cb = emacs_tty_create_io_streams;
   tty_event_stream->delete_io_streams_cb = emacs_tty_delete_io_streams;
+
+  last_quit_check_signal_tick_count = 0;
 }
 
 void





More information about the XEmacs-CVS mailing list