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. */
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;
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;
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)
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;
}
/* 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;
/* 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;
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