diff options
author | Daniel Colascione <dancol@dancol.org> | 2012-09-17 03:55:02 -0800 |
---|---|---|
committer | Daniel Colascione <dancol@dancol.org> | 2012-09-17 03:55:02 -0800 |
commit | 0fda9b750e337d876c9461db7d4426a3f0b81482 (patch) | |
tree | 1e1659bfa590cd8375c564c6fb5c3bafa65e06c0 /src/w32xfns.c | |
parent | 8b33967313f09a736a833816d32fd52e10640969 (diff) |
Implement cygw32
Here, we use the generic window-system configuration system we just
implemented to support the w32 window-system in the mainline build
under Cygwin. (Previously, the w32 window system could only be
compiled as part of the NT-native Emacs build process.)
The changes in this patch need to be applied atomically in order to
avoid breaking Emacs. The changes include:
- Changes throughout the Lisp and C code to not assume that
NT Emacs and the w32 window system are synonymous.
- Wiring up the regular select(2) event loop to Windows messages
- Cleaning up the w32 drag-and-drop receiving code.
- Exposing Cygwin path conversion functions to elisp.
- Unicode file dialog support when compiling for Cygwin.
- Splitting the w32 term lisp initialization code into code
applicable to any w32 window-system and code specific to
system-type windows-nt.
- Integrating the old and new w32 code into the build system.
Diffstat (limited to 'src/w32xfns.c')
-rw-r--r-- | src/w32xfns.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/src/w32xfns.c b/src/w32xfns.c index 62e45dd987..dfafb0ac74 100644 --- a/src/w32xfns.c +++ b/src/w32xfns.c @@ -20,6 +20,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <signal.h> #include <stdio.h> #include <setjmp.h> + #include "lisp.h" #include "keyboard.h" #include "frame.h" @@ -33,7 +34,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #define myfree(lp) GlobalFreePtr (lp) CRITICAL_SECTION critsect; + +#ifdef WINDOWSNT extern HANDLE keyboard_handle; +#endif /* WINDOWSNT */ + HANDLE input_available = NULL; HANDLE interrupt_handle = NULL; @@ -44,7 +49,11 @@ init_crit (void) /* For safety, input_available should only be reset by get_next_msg when the input queue is empty, so make it a manual reset event. */ - keyboard_handle = input_available = CreateEvent (NULL, TRUE, FALSE, NULL); + input_available = CreateEvent (NULL, TRUE, FALSE, NULL); + +#ifdef WINDOWSNT + keyboard_handle = input_available; +#endif /* WINDOWSNT */ /* interrupt_handle is signaled when quit (C-g) is detected, so that blocking system calls can be interrupted. We make it a manual @@ -241,6 +250,22 @@ get_next_msg (W32Msg * lpmsg, BOOL bWait) return (bRet); } +extern char * w32_strerror (int error_no); + +/* Tell the main thread that we have input available; if the main + thread is blocked in select(), we wake it up here. */ +static void +notify_msg_ready (void) +{ + SetEvent (input_available); + +#ifdef CYGWIN + /* Wakes up the main thread, which is blocked select()ing for /dev/windows, + among other files. */ + (void) PostThreadMessage (dwMainThreadId, WM_EMACS_INPUT_READY, 0, 0); +#endif /* CYGWIN */ +} + BOOL post_msg (W32Msg * lpmsg) { @@ -264,8 +289,7 @@ post_msg (W32Msg * lpmsg) } lpTail = lpNew; - SetEvent (input_available); - + notify_msg_ready (); leave_crit (); return (TRUE); @@ -286,7 +310,7 @@ prepend_msg (W32Msg *lpmsg) nQueue++; lpNew->lpNext = lpHead; lpHead = lpNew; - + notify_msg_ready (); leave_crit (); return (TRUE); |