changeset 57410:73be00e59d8e

(timer_resume_idle): New function to resume idle timer without resetting timers on the idle list. (read_char): Use timer_resume_idle. Remove local var last_idle_start. (timer_start_idle, timer_stop_idle): Declare static. (read_key_sequence): Use timer_resume_idle instead of timer_start_idle.
author Kim F. Storm <storm@cua.dk>
date Sat, 09 Oct 2004 23:24:49 +0000
parents d367877eabf0
children 9f48fc9a49f1
files src/keyboard.c
diffstat 1 files changed, 19 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/keyboard.c	Sat Oct 09 23:24:31 2004 +0000
+++ b/src/keyboard.c	Sat Oct 09 23:24:49 2004 +0000
@@ -676,6 +676,9 @@
 static void clear_event P_ ((struct input_event *));
 static void any_kboard_state P_ ((void));
 static SIGTYPE interrupt_signal P_ ((int signalnum));
+static void timer_start_idle P_ ((void));
+static void timer_stop_idle P_ ((void));
+static void timer_resume_idle P_ ((void));
 
 /* Nonzero means don't try to suspend even if the operating system seems
    to support it.  */
@@ -2387,7 +2390,6 @@
   volatile Lisp_Object also_record;
   volatile int reread;
   struct gcpro gcpro1, gcpro2;
-  EMACS_TIME last_idle_start;
   int polling_stopped_here = 0;
 
   also_record = Qnil;
@@ -2894,9 +2896,6 @@
 
  non_reread:
 
-  /* Record the last idle start time so that we can reset it
-     should the next event read be a help-echo.  */
-  last_idle_start = timer_idleness_start_time;
   timer_stop_idle ();
   RESUME_POLLING;
 
@@ -2936,7 +2935,7 @@
 	   prevents automatic window selection (under
 	   mouse_autoselect_window from acting as a real input event, for
 	   example banishing the mouse under mouse-avoidance-mode.  */
-	timer_idleness_start_time = last_idle_start;
+	timer_resume_idle ();
 
       /* Resume allowing input from any kboard, if that was true before.  */
       if (!was_locked)
@@ -3135,7 +3134,7 @@
       show_help_echo (help, window, object, position, 0);
 
       /* We stopped being idle for this event; undo that.  */
-      timer_idleness_start_time = last_idle_start;
+      timer_resume_idle ();
       goto retry;
     }
 
@@ -4252,7 +4251,7 @@
 /* Record the start of when Emacs is idle,
    for the sake of running idle-time timers.  */
 
-void
+static void
 timer_start_idle ()
 {
   Lisp_Object timers;
@@ -4280,12 +4279,23 @@
 
 /* Record that Emacs is no longer idle, so stop running idle-time timers.  */
 
-void
+static void
 timer_stop_idle ()
 {
   EMACS_SET_SECS_USECS (timer_idleness_start_time, -1, -1);
 }
 
+/* Resume idle timer from last idle start time.  */
+
+static void
+timer_resume_idle ()
+{
+  if (! EMACS_TIME_NEG_P (timer_idleness_start_time))
+    return;
+
+  timer_idleness_start_time = timer_last_idleness_start_time;
+}
+
 /* This is only for debugging.  */
 struct input_event last_timer_event;
 
@@ -8847,14 +8857,7 @@
 	     keymap may have changed, so replay the sequence.  */
 	  if (BUFFERP (key))
 	    {
-	      EMACS_TIME initial_idleness_start_time;
-	      EMACS_SET_SECS_USECS (initial_idleness_start_time,
-				    EMACS_SECS (timer_last_idleness_start_time),
-				    EMACS_USECS (timer_last_idleness_start_time));
-
-	      /* Resume idle state, using the same start-time as before.  */
-	      timer_start_idle ();
-	      timer_idleness_start_time = initial_idleness_start_time;
+	      timer_resume_idle ();
 
 	      mock_input = t;
 	      /* Reset the current buffer from the selected window