aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim F. Storm2004-10-09 23:24:49 +0000
committerKim F. Storm2004-10-09 23:24:49 +0000
commit5c12e63f92556f30b3cb182c2dbfa0a0d7046545 (patch)
treea547b905c80994493d4b2bfac78c4f8b3719ad61
parent9688f9eb3a5f08a6742ec68b3cd993d14a9571b4 (diff)
downloademacs-5c12e63f92556f30b3cb182c2dbfa0a0d7046545.tar.gz
emacs-5c12e63f92556f30b3cb182c2dbfa0a0d7046545.zip
(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.
-rw-r--r--src/keyboard.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 78e7498287e..ba9db5b6e94 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -676,6 +676,9 @@ static Lisp_Object apply_modifiers P_ ((int, Lisp_Object));
676static void clear_event P_ ((struct input_event *)); 676static void clear_event P_ ((struct input_event *));
677static void any_kboard_state P_ ((void)); 677static void any_kboard_state P_ ((void));
678static SIGTYPE interrupt_signal P_ ((int signalnum)); 678static SIGTYPE interrupt_signal P_ ((int signalnum));
679static void timer_start_idle P_ ((void));
680static void timer_stop_idle P_ ((void));
681static void timer_resume_idle P_ ((void));
679 682
680/* Nonzero means don't try to suspend even if the operating system seems 683/* Nonzero means don't try to suspend even if the operating system seems
681 to support it. */ 684 to support it. */
@@ -2387,7 +2390,6 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
2387 volatile Lisp_Object also_record; 2390 volatile Lisp_Object also_record;
2388 volatile int reread; 2391 volatile int reread;
2389 struct gcpro gcpro1, gcpro2; 2392 struct gcpro gcpro1, gcpro2;
2390 EMACS_TIME last_idle_start;
2391 int polling_stopped_here = 0; 2393 int polling_stopped_here = 0;
2392 2394
2393 also_record = Qnil; 2395 also_record = Qnil;
@@ -2894,9 +2896,6 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
2894 2896
2895 non_reread: 2897 non_reread:
2896 2898
2897 /* Record the last idle start time so that we can reset it
2898 should the next event read be a help-echo. */
2899 last_idle_start = timer_idleness_start_time;
2900 timer_stop_idle (); 2899 timer_stop_idle ();
2901 RESUME_POLLING; 2900 RESUME_POLLING;
2902 2901
@@ -2936,7 +2935,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
2936 prevents automatic window selection (under 2935 prevents automatic window selection (under
2937 mouse_autoselect_window from acting as a real input event, for 2936 mouse_autoselect_window from acting as a real input event, for
2938 example banishing the mouse under mouse-avoidance-mode. */ 2937 example banishing the mouse under mouse-avoidance-mode. */
2939 timer_idleness_start_time = last_idle_start; 2938 timer_resume_idle ();
2940 2939
2941 /* Resume allowing input from any kboard, if that was true before. */ 2940 /* Resume allowing input from any kboard, if that was true before. */
2942 if (!was_locked) 2941 if (!was_locked)
@@ -3135,7 +3134,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
3135 show_help_echo (help, window, object, position, 0); 3134 show_help_echo (help, window, object, position, 0);
3136 3135
3137 /* We stopped being idle for this event; undo that. */ 3136 /* We stopped being idle for this event; undo that. */
3138 timer_idleness_start_time = last_idle_start; 3137 timer_resume_idle ();
3139 goto retry; 3138 goto retry;
3140 } 3139 }
3141 3140
@@ -4252,7 +4251,7 @@ swallow_events (do_display)
4252/* Record the start of when Emacs is idle, 4251/* Record the start of when Emacs is idle,
4253 for the sake of running idle-time timers. */ 4252 for the sake of running idle-time timers. */
4254 4253
4255void 4254static void
4256timer_start_idle () 4255timer_start_idle ()
4257{ 4256{
4258 Lisp_Object timers; 4257 Lisp_Object timers;
@@ -4280,12 +4279,23 @@ timer_start_idle ()
4280 4279
4281/* Record that Emacs is no longer idle, so stop running idle-time timers. */ 4280/* Record that Emacs is no longer idle, so stop running idle-time timers. */
4282 4281
4283void 4282static void
4284timer_stop_idle () 4283timer_stop_idle ()
4285{ 4284{
4286 EMACS_SET_SECS_USECS (timer_idleness_start_time, -1, -1); 4285 EMACS_SET_SECS_USECS (timer_idleness_start_time, -1, -1);
4287} 4286}
4288 4287
4288/* Resume idle timer from last idle start time. */
4289
4290static void
4291timer_resume_idle ()
4292{
4293 if (! EMACS_TIME_NEG_P (timer_idleness_start_time))
4294 return;
4295
4296 timer_idleness_start_time = timer_last_idleness_start_time;
4297}
4298
4289/* This is only for debugging. */ 4299/* This is only for debugging. */
4290struct input_event last_timer_event; 4300struct input_event last_timer_event;
4291 4301
@@ -8847,14 +8857,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
8847 keymap may have changed, so replay the sequence. */ 8857 keymap may have changed, so replay the sequence. */
8848 if (BUFFERP (key)) 8858 if (BUFFERP (key))
8849 { 8859 {
8850 EMACS_TIME initial_idleness_start_time; 8860 timer_resume_idle ();
8851 EMACS_SET_SECS_USECS (initial_idleness_start_time,
8852 EMACS_SECS (timer_last_idleness_start_time),
8853 EMACS_USECS (timer_last_idleness_start_time));
8854
8855 /* Resume idle state, using the same start-time as before. */
8856 timer_start_idle ();
8857 timer_idleness_start_time = initial_idleness_start_time;
8858 8861
8859 mock_input = t; 8862 mock_input = t;
8860 /* Reset the current buffer from the selected window 8863 /* Reset the current buffer from the selected window