/* Nonzero means polling for input is temporarily suppressed. */
int poll_suppress_count;
-#ifdef POLL_FOR_INPUT
+/* Nonzero if polling_for_input is actually being used. */
int polling_for_input;
+#ifdef POLL_FOR_INPUT
+
/* Handle an alarm once each second and read pending input
so as to handle a C-g if it comces in. */
#endif
}
+/* Nonzero if we are using polling to handle input asynchronously. */
+
+int
+input_polling_used ()
+{
+#ifdef POLL_FOR_INPUT
+ return read_socket_hook && !interrupt_input;
+#else
+ return 0;
+#endif
+}
+
/* Turn off polling. */
stop_polling ()
{
c = read_char_minibuf_menu_prompt (commandflag, nmaps, maps);
if (! NILP (c))
- return c;
+ goto non_reread;
}
/* If in middle of key sequence and minibuffer not active,
start_polling ();
- /* Don't wipe the echo area for a trivial event. */
- if (XTYPE (c) != Lisp_Buffer)
- echo_area_glyphs = 0;
+ /* Buffer switch events are only for internal wakeups
+ so don't show them to the user. */
+ if (XTYPE (c) == Lisp_Buffer)
+ return c;
+
+ /* Wipe the echo area. */
+ echo_area_glyphs = 0;
/* Handle things that only apply to characters. */
if (XTYPE (c) == Lisp_Int)
if (dribble)
{
if (XTYPE (c) == Lisp_Int)
- putc (XINT (c), dribble);
+ {
+ if (XUINT (c) < 0x100)
+ putc (XINT (c), dribble);
+ else
+ fprintf (dribble, " 0x%x", XUINT (c));
+ }
else
{
Lisp_Object dribblee;
window = window_from_coordinates (f, column, row, &part);
if (XTYPE (window) != Lisp_Window)
- posn = Qnil;
+ {
+ window = event->frame_or_window;
+ posn = Qnil;
+ }
else
{
int pixcolumn, pixrow;
record_asynch_buffer_change ()
{
struct input_event event;
+ Lisp_Object tem;
+
event.kind = buffer_switch_event;
event.frame_or_window = Qnil;
+#ifdef subprocesses
+ /* We don't need a buffer-switch event unless Emacs is waiting for input.
+ The purpose of the event is to make read_key_sequence look up the
+ keymaps again. If we aren't in read_key_sequence, we don't need one,
+ and the event could cause trouble by messing up (input-pending-p). */
+ tem = Fwaiting_for_user_input_p ();
+ if (NILP (tem))
+ return;
+#else
+ /* We never need these events if we have no asynchronous subprocesses. */
+ return;
+#endif
+
/* Make sure no interrupt happens while storing the event. */
#ifdef SIGIO
if (interrupt_input)