Mercurial > emacs
diff src/mac.c @ 46856:eba75fedd593
2002-08-10 Andrew Choi <akochoi@shaw.ca>
* mac.c (sys_select) [MAC_OSX]: New function.
* macterm.c (MakeMeTheFrontProcess): New function.
(mac_initialize): Call MakeMeTheFrontProcess.
* s/darwin.h: Define select to sys_select.
author | Andrew Choi <akochoi@shaw.ca> |
---|---|
date | Sun, 11 Aug 2002 00:26:24 +0000 |
parents | 3d4689375228 |
children | aff9c7fcedb0 |
line wrap: on
line diff
--- a/src/mac.c Sat Aug 10 03:48:12 2002 +0000 +++ b/src/mac.c Sun Aug 11 00:26:24 2002 +0000 @@ -2745,6 +2745,30 @@ return Qnil; } +#ifdef MAC_OSX +#undef select + +extern int inhibit_window_system; + +/* When Emacs is started from the Finder, SELECT always immediately + returns as if input is present when file descriptor 0 is polled for + input. Strangely, when Emacs is run as a GUI application from the + command line, it blocks in the same situation. This `wrapper' of + the system call SELECT corrects this discrepancy. */ +int +sys_select (n, rfds, wfds, efds, timeout) + int n; + SELECT_TYPE *rfds; + SELECT_TYPE *wfds; + SELECT_TYPE *efds; + struct timeval *timeout; +{ + if (!inhibit_window_system && rfds && FD_ISSET (0, rfds)) + return 1; + else + return select (n, rfds, wfds, efds, timeout); +} +#endif /* MAC_OSX */ void syms_of_mac ()