diff options
| author | Andrew Choi | 2002-08-11 00:26:24 +0000 |
|---|---|---|
| committer | Andrew Choi | 2002-08-11 00:26:24 +0000 |
| commit | 8030369ccb5c871d3ce11b96c220f318bc741ed8 (patch) | |
| tree | b2989661fb58dd8d3c70d7c915a98dd444dee1c1 /src | |
| parent | 1e7c162fa46946be3686f97470dd2b1f4eb0ab7d (diff) | |
| download | emacs-8030369ccb5c871d3ce11b96c220f318bc741ed8.tar.gz emacs-8030369ccb5c871d3ce11b96c220f318bc741ed8.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 9 | ||||
| -rw-r--r-- | src/mac.c | 24 | ||||
| -rw-r--r-- | src/macterm.c | 16 | ||||
| -rw-r--r-- | src/s/darwin.h | 7 |
4 files changed, 56 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 51409076df8..4abbbfbf3de 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2002-08-10 Andrew Choi <akochoi@shaw.ca> | ||
| 2 | |||
| 3 | * mac.c (sys_select) [MAC_OSX]: New function. | ||
| 4 | |||
| 5 | * macterm.c (MakeMeTheFrontProcess): New function. | ||
| 6 | (mac_initialize): Call MakeMeTheFrontProcess. | ||
| 7 | |||
| 8 | * s/darwin.h: Define select to sys_select. | ||
| 9 | |||
| 1 | 2002-08-09 Richard M. Stallman <rms@gnu.org> | 10 | 2002-08-09 Richard M. Stallman <rms@gnu.org> |
| 2 | 11 | ||
| 3 | * keyboard.c (make_lispy_event): Test WINDOWSNT, not WINDOWS_NT. | 12 | * keyboard.c (make_lispy_event): Test WINDOWSNT, not WINDOWS_NT. |
| @@ -2745,6 +2745,30 @@ and t is the same as `SECONDARY'. */) | |||
| 2745 | return Qnil; | 2745 | return Qnil; |
| 2746 | } | 2746 | } |
| 2747 | 2747 | ||
| 2748 | #ifdef MAC_OSX | ||
| 2749 | #undef select | ||
| 2750 | |||
| 2751 | extern int inhibit_window_system; | ||
| 2752 | |||
| 2753 | /* When Emacs is started from the Finder, SELECT always immediately | ||
| 2754 | returns as if input is present when file descriptor 0 is polled for | ||
| 2755 | input. Strangely, when Emacs is run as a GUI application from the | ||
| 2756 | command line, it blocks in the same situation. This `wrapper' of | ||
| 2757 | the system call SELECT corrects this discrepancy. */ | ||
| 2758 | int | ||
| 2759 | sys_select (n, rfds, wfds, efds, timeout) | ||
| 2760 | int n; | ||
| 2761 | SELECT_TYPE *rfds; | ||
| 2762 | SELECT_TYPE *wfds; | ||
| 2763 | SELECT_TYPE *efds; | ||
| 2764 | struct timeval *timeout; | ||
| 2765 | { | ||
| 2766 | if (!inhibit_window_system && rfds && FD_ISSET (0, rfds)) | ||
| 2767 | return 1; | ||
| 2768 | else | ||
| 2769 | return select (n, rfds, wfds, efds, timeout); | ||
| 2770 | } | ||
| 2771 | #endif /* MAC_OSX */ | ||
| 2748 | 2772 | ||
| 2749 | void | 2773 | void |
| 2750 | syms_of_mac () | 2774 | syms_of_mac () |
diff --git a/src/macterm.c b/src/macterm.c index e9cb1b07de7..a907425c391 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -366,6 +366,7 @@ extern XrmDatabase x_load_resources P_ ((Display *, char *, char *, char *)); | |||
| 366 | 366 | ||
| 367 | extern Lisp_Object x_icon_type P_ ((struct frame *)); | 367 | extern Lisp_Object x_icon_type P_ ((struct frame *)); |
| 368 | 368 | ||
| 369 | extern int inhibit_window_system; | ||
| 369 | 370 | ||
| 370 | #if __MRC__ | 371 | #if __MRC__ |
| 371 | QDGlobals qd; /* QuickDraw global information structure. */ | 372 | QDGlobals qd; /* QuickDraw global information structure. */ |
| @@ -13405,6 +13406,18 @@ mac_term_init (display_name, xrm_option, resource_name) | |||
| 13405 | return dpyinfo; | 13406 | return dpyinfo; |
| 13406 | } | 13407 | } |
| 13407 | 13408 | ||
| 13409 | #ifdef MAC_OSX | ||
| 13410 | void MakeMeTheFrontProcess () | ||
| 13411 | { | ||
| 13412 | ProcessSerialNumber psn; | ||
| 13413 | OSErr err; | ||
| 13414 | |||
| 13415 | err = GetCurrentProcess (&psn); | ||
| 13416 | if (err == noErr) | ||
| 13417 | (void) SetFrontProcess (&psn); | ||
| 13418 | } | ||
| 13419 | #endif /* MAC_OSX */ | ||
| 13420 | |||
| 13408 | /* Set up use of X before we make the first connection. */ | 13421 | /* Set up use of X before we make the first connection. */ |
| 13409 | 13422 | ||
| 13410 | static struct redisplay_interface x_redisplay_interface = | 13423 | static struct redisplay_interface x_redisplay_interface = |
| @@ -13514,6 +13527,9 @@ mac_initialize () | |||
| 13514 | #endif | 13527 | #endif |
| 13515 | 13528 | ||
| 13516 | DisableMenuCommand (NULL, kHICommandQuit); | 13529 | DisableMenuCommand (NULL, kHICommandQuit); |
| 13530 | |||
| 13531 | if (!inhibit_window_system) | ||
| 13532 | MakeMeTheFrontProcess (); | ||
| 13517 | #endif | 13533 | #endif |
| 13518 | } | 13534 | } |
| 13519 | 13535 | ||
diff --git a/src/s/darwin.h b/src/s/darwin.h index a4b3b727537..c8e5ac54f7a 100644 --- a/src/s/darwin.h +++ b/src/s/darwin.h | |||
| @@ -308,3 +308,10 @@ struct kboard; | |||
| 308 | #define realloc unexec_realloc | 308 | #define realloc unexec_realloc |
| 309 | #define free unexec_free | 309 | #define free unexec_free |
| 310 | #endif | 310 | #endif |
| 311 | |||
| 312 | /* Reroute calls to SELECT to the version defined in mac.c to fix the | ||
| 313 | problem of Emacs requiring an extra return to be typed to start | ||
| 314 | working when started from the command line. */ | ||
| 315 | #if defined (emacs) || defined (temacs) | ||
| 316 | #define select sys_select | ||
| 317 | #endif | ||