aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2012-10-12 16:14:35 +0200
committerEli Zaretskii2012-10-12 16:14:35 +0200
commit605a3df6811c2b3ce9379149cc8fd64fc9846136 (patch)
tree6574738c0ec8d941cc4f5969321c05fedabd9da6 /src
parent98222ee58b78eba8ff719c8ca3802b809baac02b (diff)
downloademacs-605a3df6811c2b3ce9379149cc8fd64fc9846136.tar.gz
emacs-605a3df6811c2b3ce9379149cc8fd64fc9846136.zip
Add comments about how non-GUI input works on MS-Windows.
Diffstat (limited to 'src')
-rw-r--r--src/w32fns.c4
-rw-r--r--src/w32inevt.c32
2 files changed, 35 insertions, 1 deletions
diff --git a/src/w32fns.c b/src/w32fns.c
index 28a689ddc6c..c5e4be4ffc9 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -2333,7 +2333,9 @@ w32_name_of_message (UINT msg)
2333} 2333}
2334#endif /* EMACSDEBUG */ 2334#endif /* EMACSDEBUG */
2335 2335
2336/* Here's an overview of how Emacs input works on MS-Windows. 2336/* Here's an overview of how Emacs input works in GUI sessions on
2337 MS-Windows. (For description of non-GUI input, see the commentary
2338 before w32_console_read_socket in w32inevt.c.)
2337 2339
2338 System messages are read and processed by w32_msg_pump below. This 2340 System messages are read and processed by w32_msg_pump below. This
2339 function runs in a separate thread. It handles a small number of 2341 function runs in a separate thread. It handles a small number of
diff --git a/src/w32inevt.c b/src/w32inevt.c
index c322d3a0b44..899a6fb89bf 100644
--- a/src/w32inevt.c
+++ b/src/w32inevt.c
@@ -576,6 +576,38 @@ maybe_generate_resize_event (void)
576 0, 0, 0); 576 0, 0, 0);
577} 577}
578 578
579/* Here's an overview of how Emacs input works in non-GUI sessions on
580 MS-Windows. (For description of the GUI input, see the commentary
581 before w32_msg_pump in w32fns.c.)
582
583 When Emacs is idle, it loops inside wait_reading_process_output,
584 calling pselect periodically to check whether any input is
585 available. On Windows, pselect is redirected to sys_select, which
586 uses MsgWaitForMultipleObjects to wait for input, either from the
587 keyboard or from any of the Emacs subprocesses. In addition,
588 MsgWaitForMultipleObjects wakes up when some Windows message is
589 posted to the input queue of the Emacs's main thread (which is the
590 thread in which sys_select runs).
591
592 When the Emacs's console window has focus, Windows sends input
593 events that originate from the keyboard or the mouse; these events
594 wake up MsgWaitForMultipleObjects, which reports that input is
595 available. Emacs then calls w32_console_read_socket, below, to
596 read the input. w32_console_read_socket uses
597 GetNumberOfConsoleInputEvents and ReadConsoleInput to peek at and
598 read the console input events.
599
600 One type of non-keyboard input event that gets reported as input
601 available is due to the Emacs's console window receiving focus.
602 When that happens, Emacs gets the FOCUS_EVENT event and sys_select
603 reports some input; however, w32_console_read_socket ignores such
604 events when called to read them.
605
606 Note that any other Windows message sent to the main thread will
607 also wake up MsgWaitForMultipleObjects. These messages get
608 immediately dispatched to their destinations by calling
609 drain_message_queue. */
610
579int 611int
580w32_console_read_socket (struct terminal *terminal, 612w32_console_read_socket (struct terminal *terminal,
581 struct input_event *hold_quit) 613 struct input_event *hold_quit)