/* Keyboard code page - may be changed by language-change events. */
int w32_keyboard_codepage;
-/* Incremented by w32_read_socket whenever it really tries to read
- events. */
-static int volatile input_signal_count;
-
#ifdef CYGWIN
int w32_message_fd = -1;
#endif /* CYGWIN */
block_input ();
- /* So people can tell when we have read the available input. */
- input_signal_count++;
-
/* Process any incoming thread messages. */
drain_message_queue ();
\f
/* Change of visibility. */
-/* This tries to wait until the frame is really visible.
+/* This tries to wait until the frame is really visible, depending on
+ the value of Vx_visible_frame_timeout.
However, if the window manager asks the user where to position
the frame, this will return before the user finishes doing that.
The frame will not actually be visible at that time,
: SW_SHOWNORMAL);
}
+ if (!FLOATP (Vx_wait_for_event_timeout))
+ return;
+
/* Synchronize to ensure Emacs knows the frame is visible
before we do anything else. We do this loop with input not blocked
so that incoming events are handled. */
{
Lisp_Object frame;
- int count;
+ double timeout = XFLOAT_DATA (Vx_wait_for_event_timeout);
+ double start_time = XFLOAT_DATA (Ffloat_time (Qnil));
/* This must come after we set COUNT. */
unblock_input ();
/* Wait until the frame is visible. Process X events until a
MapNotify event has been seen, or until we think we won't get a
MapNotify at all.. */
- for (count = input_signal_count + 10;
- input_signal_count < count && !FRAME_VISIBLE_P (f);)
+ while (timeout > (XFLOAT_DATA (Ffloat_time (Qnil)) - start_time) &&
+ !FRAME_VISIBLE_P (f))
{
/* Force processing of queued events. */
/* TODO: x_sync equivalent? */
DEFSYM (Qrenamed_from, "renamed-from");
DEFSYM (Qrenamed_to, "renamed-to");
+ DEFVAR_LISP ("x-wait-for-event-timeout", Vx_wait_for_event_timeout,
+ doc: /* How long to wait for X events.
+
+Emacs will wait up to this many seconds to receive X events after
+making changes which affect the state of the graphical interface.
+Under some window managers this can take an indefinite amount of time,
+so it is important to limit the wait.
+
+If set to a non-float value, there will be no wait at all. */);
+ Vx_wait_for_event_timeout = make_float (0.1);
+
DEFVAR_INT ("w32-num-mouse-buttons",
w32_num_mouse_buttons,
doc: /* Number of physical mouse buttons. */);