]> code.delx.au - gnu-emacs/commitdiff
Add a comment with overview of how Emacs input works on MS-Windows.
authorEli Zaretskii <eliz@gnu.org>
Sun, 7 Oct 2012 14:50:29 +0000 (16:50 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sun, 7 Oct 2012 14:50:29 +0000 (16:50 +0200)
src/w32fns.c
src/w32term.c

index 6d5d68223540c9ef0155c422c6ea05f6f43ffc84..0dbeb232db97368499ed72a2f5a813f300268cc3 100644 (file)
@@ -2246,6 +2246,27 @@ unregister_hot_keys (HWND hwnd)
     }
 }
 
+/* Here's an overview of how Emacs input works on MS-Windows.
+
+   System messages are read and processed by w32_msg_pump below.  This
+   function runs in a separate thread.  It handles a small number of
+   custom WM_EMACS_* messages (posted by the main thread, look for
+   PostMessage calls), and dispatches the rest to w32_wnd_proc, which
+   is the main window procedure for the entire Emacs application.
+
+   w32_wnd_proc also runs in the same separate input thread.  It
+   handles some messages, mostly those that need GDI calls, by itself.
+   For the others, it calls my_post_msg, which inserts the messages
+   into the input queue serviced by w32_read_socket.
+
+   w32_read_socket runs in the main (a.k.a. "Lisp") thread, and is
+   called synchronously from keyboard.c when it is known or suspected
+   that some input is available.  w32_read_socket either handles
+   messages immediately, or converts them messages into Emacs input
+   events and stuffs them into kbd_buffer, where kbd_buffer_get_event
+   can get at them and process them when read_char and its callers
+   require input.  */
+
 /* Main message dispatch loop. */
 
 static void
index 1cc8bd2adefb873f8c9fc8d0fb550deb0c88480a..517813672c444585c421e8a8141cbaaa34d626cb 100644 (file)
@@ -4138,6 +4138,9 @@ static char dbcs_lead = 0;
    This routine is called by the SIGIO handler.
    We return as soon as there are no more events to be read.
 
+   For an overview of how Emacs input works on MS-Windows, see the
+   commentary before w32_msg_pump in w32fns.c.
+
    We return the number of characters stored into the buffer,
    thus pretending to be `read'.