summaryrefslogtreecommitdiff
path: root/src/w32inevt.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2012-10-14 10:03:16 +0200
committerEli Zaretskii <eliz@gnu.org>2012-10-14 10:03:16 +0200
commitdd8c2f5adeba029790a007ec829e18442a4ade36 (patch)
treeea6045c78021c965e34bbfafa4ca36e8b8533c84 /src/w32inevt.c
parent4f0800ec2ffdfee7b56062aeac263e5071cf8868 (diff)
parent8111f5e6f05228e36496f3bdccad711f569acb9b (diff)
Merge from trunk.
Diffstat (limited to 'src/w32inevt.c')
-rw-r--r--src/w32inevt.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/w32inevt.c b/src/w32inevt.c
index 7d60c06d78..a5868be612 100644
--- a/src/w32inevt.c
+++ b/src/w32inevt.c
@@ -644,6 +644,38 @@ handle_file_notifications (struct input_event *hold_quit)
return nevents;
}
+/* Here's an overview of how Emacs input works in non-GUI sessions on
+ MS-Windows. (For description of the GUI input, see the commentary
+ before w32_msg_pump in w32fns.c.)
+
+ When Emacs is idle, it loops inside wait_reading_process_output,
+ calling pselect periodically to check whether any input is
+ available. On Windows, pselect is redirected to sys_select, which
+ uses MsgWaitForMultipleObjects to wait for input, either from the
+ keyboard or from any of the Emacs subprocesses. In addition,
+ MsgWaitForMultipleObjects wakes up when some Windows message is
+ posted to the input queue of the Emacs's main thread (which is the
+ thread in which sys_select runs).
+
+ When the Emacs's console window has focus, Windows sends input
+ events that originate from the keyboard or the mouse; these events
+ wake up MsgWaitForMultipleObjects, which reports that input is
+ available. Emacs then calls w32_console_read_socket, below, to
+ read the input. w32_console_read_socket uses
+ GetNumberOfConsoleInputEvents and ReadConsoleInput to peek at and
+ read the console input events.
+
+ One type of non-keyboard input event that gets reported as input
+ available is due to the Emacs's console window receiving focus.
+ When that happens, Emacs gets the FOCUS_EVENT event and sys_select
+ reports some input; however, w32_console_read_socket ignores such
+ events when called to read them.
+
+ Note that any other Windows message sent to the main thread will
+ also wake up MsgWaitForMultipleObjects. These messages get
+ immediately dispatched to their destinations by calling
+ drain_message_queue. */
+
int
w32_console_read_socket (struct terminal *terminal,
struct input_event *hold_quit)