Commit a2d5fca0 authored by Jan Djärv's avatar Jan Djärv

* keyboard.c (READABLE_EVENTS_DO_TIMERS_NOW)

(READABLE_EVENTS_FILTER_EVENTS)
(READABLE_EVENTS_IGNORE_SQUEEZABLES): New flags for readable_events.
get_filtered_input_pending, readable_filtered_events): Removed.
(tracking_off): Call readable_events and get_input_pending with
flag READABLE_EVENTS_DO_TIMERS_NOW.
(readable_events): Move code from old readable_filtered_events here,
but check new READABLE_EVENTS_* in argument flags instead of previous
two boolean arguments do_timers_now and filter_events.
If we are doing mouse tracking and the mouse moved, return only if
READABLE_EVENTS_IGNORE_SQUEEZABLES is not set in flags.
(swallow_events): Call get_input_pending with flag
READABLE_EVENTS_DO_TIMERS_NOW.
(get_input_pending): Move code from old   get_filtered_input_pending
here.  Replace boolean arguments do_timers_now, filter_events with
flags, and pass flags to readable_events.  Document new
READABLE_EVENTS_* flags.
(detect_input_pending_ignore_squeezables): New function.
(detect_input_pending_run_timers): Call get_input_pending with flag
READABLE_EVENTS_DO_TIMERS_NOW.
(Finput_pending_p): Call get_input_pending with flags
READABLE_EVENTS_DO_TIMERS_NOW and READABLE_EVENTS_FILTER_EVENTS.

* dispnew.c (update_window, update_frame_1): Replace calls to
detect_input_pending with detect_input_pending_ignore_squeezables
so that redisplay is not paused if the event queue contains only
mouse movements.

* lisp.h: Declare detect_input_pending_ignore_squeezables.
parent 42187e99
2005-01-16 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
* keyboard.c (READABLE_EVENTS_DO_TIMERS_NOW)
(READABLE_EVENTS_FILTER_EVENTS)
(READABLE_EVENTS_IGNORE_SQUEEZABLES): New flags for readable_events.
get_filtered_input_pending, readable_filtered_events): Removed.
(tracking_off): Call readable_events and get_input_pending with
flag READABLE_EVENTS_DO_TIMERS_NOW.
(readable_events): Move code from old readable_filtered_events here,
but check new READABLE_EVENTS_* in argument flags instead of previous
two boolean arguments do_timers_now and filter_events.
If we are doing mouse tracking and the mouse moved, return only if
READABLE_EVENTS_IGNORE_SQUEEZABLES is not set in flags.
(swallow_events): Call get_input_pending with flag
READABLE_EVENTS_DO_TIMERS_NOW.
(get_input_pending): Move code from old get_filtered_input_pending
here. Replace boolean arguments do_timers_now, filter_events with
flags, and pass flags to readable_events. Document new
READABLE_EVENTS_* flags.
(detect_input_pending_ignore_squeezables): New function.
(detect_input_pending_run_timers): Call get_input_pending with flag
READABLE_EVENTS_DO_TIMERS_NOW.
(Finput_pending_p): Call get_input_pending with flags
READABLE_EVENTS_DO_TIMERS_NOW and READABLE_EVENTS_FILTER_EVENTS.
* dispnew.c (update_window, update_frame_1): Replace calls to
detect_input_pending with detect_input_pending_ignore_squeezables
so that redisplay is not paused if the event queue contains only
mouse movements.
* lisp.h: Declare detect_input_pending_ignore_squeezables.
2005-01-15 Steven Tamm <steventamm@mac.com>
* macterm.c (Vmac_use_core_graphics): defined for
......
......@@ -4075,7 +4075,7 @@ update_window (w, force_p)
if (redisplay_dont_pause)
force_p = 1;
else
detect_input_pending ();
detect_input_pending_ignore_squeezables ();
/* If forced to complete the update, or if no input is pending, do
the update. */
......@@ -4149,7 +4149,7 @@ update_window (w, force_p)
scrolling large windows with repeated scroll-up
commands will too quickly pause redisplay. */
if (!force_p && ++n_updated % preempt_count == 0)
detect_input_pending ();
detect_input_pending_ignore_squeezables ();
changed_p |= update_window_line (w, vpos,
&mouse_face_overwritten_p);
......@@ -5093,7 +5093,7 @@ update_frame_1 (f, force_p, inhibit_id_p)
if (redisplay_dont_pause)
force_p = 1;
else if (!force_p && detect_input_pending ())
else if (!force_p && detect_input_pending_ignore_squeezables ())
{
pause = 1;
goto do_pause;
......@@ -5149,7 +5149,7 @@ update_frame_1 (f, force_p, inhibit_id_p)
}
if ((i - 1) % preempt_count == 0)
detect_input_pending ();
detect_input_pending_ignore_squeezables ();
update_frame_line (f, i);
}
......
......@@ -646,14 +646,17 @@ static EMACS_TIME timer_last_idleness_start_time;
/* Global variable declarations. */
/* Flags for readable_events. */
#define READABLE_EVENTS_DO_TIMERS_NOW (1 << 0)
#define READABLE_EVENTS_FILTER_EVENTS (1 << 1)
#define READABLE_EVENTS_IGNORE_SQUEEZABLES (1 << 2)
/* Function for init_keyboard to call with no args (if nonzero). */
void (*keyboard_init_hook) ();
static int read_avail_input P_ ((int));
static void get_input_pending P_ ((int *, int));
static void get_filtered_input_pending P_ ((int *, int, int));
static int readable_events P_ ((int));
static int readable_filtered_events P_ ((int, int));
static Lisp_Object read_char_x_menu_prompt P_ ((int, Lisp_Object *,
Lisp_Object, int *));
static Lisp_Object read_char_x_menu_prompt ();
......@@ -3441,10 +3444,11 @@ tracking_off (old_value)
input has been processed. If the only input available was
the sort that we have just disabled, then we need to call
redisplay. */
if (!readable_events (1))
if (!readable_events (READABLE_EVENTS_DO_TIMERS_NOW))
{
redisplay_preserve_echo_area (6);
get_input_pending (&input_pending, 1);
get_input_pending (&input_pending,
READABLE_EVENTS_DO_TIMERS_NOW);
}
}
return Qnil;
......@@ -3496,20 +3500,19 @@ some_mouse_moved ()
/* Return true iff there are any events in the queue that read-char
would return. If this returns false, a read-char would block. */
static int
readable_filtered_events (do_timers_now, filter_events)
int do_timers_now;
int filter_events;
readable_events (flags)
int flags;
{
if (do_timers_now)
timer_check (do_timers_now);
if (flags & READABLE_EVENTS_DO_TIMERS_NOW)
timer_check (1);
/* If the buffer contains only FOCUS_IN_EVENT events,
and FILTER_EVENTS is nonzero, report it as empty. */
/* If the buffer contains only FOCUS_IN_EVENT events, and
READABLE_EVENTS_FILTER_EVENTS is set, report it as empty. */
if (kbd_fetch_ptr != kbd_store_ptr)
{
int have_live_event = 1;
if (filter_events)
if (flags & READABLE_EVENTS_FILTER_EVENTS)
{
struct input_event *event;
......@@ -3530,7 +3533,8 @@ readable_filtered_events (do_timers_now, filter_events)
}
#ifdef HAVE_MOUSE
if (!NILP (do_mouse_tracking) && some_mouse_moved ())
if (!(flags & READABLE_EVENTS_IGNORE_SQUEEZABLES)
&& !NILP (do_mouse_tracking) && some_mouse_moved ())
return 1;
#endif
if (single_kboard)
......@@ -3548,15 +3552,6 @@ readable_filtered_events (do_timers_now, filter_events)
return 0;
}
/* Return true iff there are any events in the queue that read-char
would return. If this returns false, a read-char would block. */
static int
readable_events (do_timers_now)
int do_timers_now;
{
return readable_filtered_events (do_timers_now, 0);
}
/* Set this for debugging, to have a way to get out */
int stop_character;
......@@ -4227,7 +4222,7 @@ swallow_events (do_display)
}
old_timers_run = timers_run;
get_input_pending (&input_pending, 1);
get_input_pending (&input_pending, READABLE_EVENTS_DO_TIMERS_NOW);
if (timers_run != old_timers_run && do_display)
redisplay_preserve_echo_area (7);
......@@ -6519,18 +6514,20 @@ lucid_event_type_list_p (object)
but works even if FIONREAD does not exist.
(In fact, this may actually read some input.)
If DO_TIMERS_NOW is nonzero, actually run timer events that are ripe.
If FILTER_EVENTS is nonzero, ignore internal events (FOCUS_IN_EVENT). */
If READABLE_EVENTS_DO_TIMERS_NOW is set in FLAGS, actually run
timer events that are ripe.
If READABLE_EVENTS_FILTER_EVENTS is set in FLAGS, ignore internal
events (FOCUS_IN_EVENT).
If READABLE_EVENTS_IGNORE_SQUEEZABLES is set in FLAGS, ignore mouse
movements. */
static void
get_filtered_input_pending (addr, do_timers_now, filter_events)
get_input_pending (addr, flags)
int *addr;
int do_timers_now;
int filter_events;
int flags;
{
/* First of all, have we already counted some input? */
*addr = (!NILP (Vquit_flag)
|| readable_filtered_events (do_timers_now, filter_events));
*addr = (!NILP (Vquit_flag) || readable_events (flags));
/* If input is being read as it arrives, and we have none, there is none. */
if (*addr > 0 || (interrupt_input && ! interrupts_deferred))
......@@ -6538,23 +6535,7 @@ get_filtered_input_pending (addr, do_timers_now, filter_events)
/* Try to read some input and see how much we get. */
gobble_input (0);
*addr = (!NILP (Vquit_flag)
|| readable_filtered_events (do_timers_now, filter_events));
}
/* Store into *addr a value nonzero if terminal input chars are available.
Serves the purpose of ioctl (0, FIONREAD, addr)
but works even if FIONREAD does not exist.
(In fact, this may actually read some input.)
If DO_TIMERS_NOW is nonzero, actually run timer events that are ripe. */
static void
get_input_pending (addr, do_timers_now)
int *addr;
int do_timers_now;
{
get_filtered_input_pending (addr, do_timers_now, 0);
*addr = (!NILP (Vquit_flag) || readable_events (flags));
}
/* Interface to read_avail_input, blocking SIGIO or SIGALRM if necessary. */
......@@ -9871,6 +9852,18 @@ detect_input_pending ()
return input_pending;
}
/* Return nonzero if input events other than mouse movements are
pending. */
int
detect_input_pending_ignore_squeezables ()
{
if (!input_pending)
get_input_pending (&input_pending, READABLE_EVENTS_IGNORE_SQUEEZABLES);
return input_pending;
}
/* Return nonzero if input events are pending, and run any pending timers. */
int
......@@ -9880,7 +9873,7 @@ detect_input_pending_run_timers (do_display)
int old_timers_run = timers_run;
if (!input_pending)
get_input_pending (&input_pending, 1);
get_input_pending (&input_pending, READABLE_EVENTS_DO_TIMERS_NOW);
if (old_timers_run != timers_run && do_display)
{
......@@ -9929,7 +9922,9 @@ if there is a doubt, the value is t. */)
if (!NILP (Vunread_command_events) || unread_command_char != -1)
return (Qt);
get_filtered_input_pending (&input_pending, 1, 1);
get_input_pending (&input_pending,
READABLE_EVENTS_DO_TIMERS_NOW
| READABLE_EVENTS_FILTER_EVENTS);
return input_pending > 0 ? Qt : Qnil;
}
......
......@@ -2906,6 +2906,7 @@ EXFUN (Fevent_convert_list, 1);
EXFUN (Fread_key_sequence, 5);
EXFUN (Fset_input_mode, 4);
extern int detect_input_pending P_ ((void));
extern int detect_input_pending_ignore_squeezables P_ ((void));
extern int detect_input_pending_run_timers P_ ((int));
extern void safe_run_hooks P_ ((Lisp_Object));
extern void cmd_error_internal P_ ((Lisp_Object, char *));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment