diff options
| author | YAMAMOTO Mitsuharu | 2006-12-15 08:05:10 +0000 |
|---|---|---|
| committer | YAMAMOTO Mitsuharu | 2006-12-15 08:05:10 +0000 |
| commit | 5c144a059cb4231064dd98e20e919d60e92fd87d (patch) | |
| tree | 98c15ef9204516eee30622c20e5d43fc3898ff58 /src/mac.c | |
| parent | 5fecafe7077077759258bb8d97e9a0bedff8c8dd (diff) | |
| download | emacs-5c144a059cb4231064dd98e20e919d60e92fd87d.tar.gz emacs-5c144a059cb4231064dd98e20e919d60e92fd87d.zip | |
(wakeup_from_rne_enabled_p) [TARGET_API_MAC_CARBON]: New
variable.
(ENABLE_WAKEUP_FROM_RNE, DISABLE_WAKEUP_FROM_RNE): New macros.
[!MAC_OSX] (select): Use them.
[MAC_OSX] (select_and_poll_event, sys_select): Likewise.
(mac_wakeup_from_rne) [TARGET_API_MAC_CARBON]: New function.
Diffstat (limited to 'src/mac.c')
| -rw-r--r-- | src/mac.c | 25 |
1 files changed, 25 insertions, 0 deletions
| @@ -79,6 +79,15 @@ static ComponentInstance as_scripting_component; | |||
| 79 | /* The single script context used for all script executions. */ | 79 | /* The single script context used for all script executions. */ |
| 80 | static OSAID as_script_context; | 80 | static OSAID as_script_context; |
| 81 | 81 | ||
| 82 | #if TARGET_API_MAC_CARBON | ||
| 83 | static int wakeup_from_rne_enabled_p = 0; | ||
| 84 | #define ENABLE_WAKEUP_FROM_RNE (wakeup_from_rne_enabled_p = 1) | ||
| 85 | #define DISABLE_WAKEUP_FROM_RNE (wakeup_from_rne_enabled_p = 0) | ||
| 86 | #else | ||
| 87 | #define ENABLE_WAKEUP_FROM_RNE 0 | ||
| 88 | #define DISABLE_WAKEUP_FROM_RNE 0 | ||
| 89 | #endif | ||
| 90 | |||
| 82 | #ifndef MAC_OSX | 91 | #ifndef MAC_OSX |
| 83 | static OSErr posix_pathname_to_fsspec P_ ((const char *, FSSpec *)); | 92 | static OSErr posix_pathname_to_fsspec P_ ((const char *, FSSpec *)); |
| 84 | static OSErr fsspec_to_posix_pathname P_ ((const FSSpec *, char *, int)); | 93 | static OSErr fsspec_to_posix_pathname P_ ((const FSSpec *, char *, int)); |
| @@ -2431,6 +2440,7 @@ select (nfds, rfds, wfds, efds, timeout) | |||
| 2431 | BLOCK_INPUT block, in case that some input has already been read | 2440 | BLOCK_INPUT block, in case that some input has already been read |
| 2432 | asynchronously. */ | 2441 | asynchronously. */ |
| 2433 | BLOCK_INPUT; | 2442 | BLOCK_INPUT; |
| 2443 | ENABLE_WAKEUP_FROM_RNE; | ||
| 2434 | if (!detect_input_pending ()) | 2444 | if (!detect_input_pending ()) |
| 2435 | { | 2445 | { |
| 2436 | #if TARGET_API_MAC_CARBON | 2446 | #if TARGET_API_MAC_CARBON |
| @@ -2461,6 +2471,7 @@ select (nfds, rfds, wfds, efds, timeout) | |||
| 2461 | } | 2471 | } |
| 2462 | #endif /* not TARGET_API_MAC_CARBON */ | 2472 | #endif /* not TARGET_API_MAC_CARBON */ |
| 2463 | } | 2473 | } |
| 2474 | DISABLE_WAKEUP_FROM_RNE; | ||
| 2464 | UNBLOCK_INPUT; | 2475 | UNBLOCK_INPUT; |
| 2465 | 2476 | ||
| 2466 | if (err == noErr) | 2477 | if (err == noErr) |
| @@ -5023,6 +5034,7 @@ select_and_poll_event (nfds, rfds, wfds, efds, timeout) | |||
| 5023 | BLOCK_INPUT block, in case that some input has already been read | 5034 | BLOCK_INPUT block, in case that some input has already been read |
| 5024 | asynchronously. */ | 5035 | asynchronously. */ |
| 5025 | BLOCK_INPUT; | 5036 | BLOCK_INPUT; |
| 5037 | ENABLE_WAKEUP_FROM_RNE; | ||
| 5026 | if (!detect_input_pending ()) | 5038 | if (!detect_input_pending ()) |
| 5027 | { | 5039 | { |
| 5028 | EMACS_TIME select_timeout; | 5040 | EMACS_TIME select_timeout; |
| @@ -5045,6 +5057,7 @@ select_and_poll_event (nfds, rfds, wfds, efds, timeout) | |||
| 5045 | kEventLeaveInQueue, NULL); | 5057 | kEventLeaveInQueue, NULL); |
| 5046 | } | 5058 | } |
| 5047 | } | 5059 | } |
| 5060 | DISABLE_WAKEUP_FROM_RNE; | ||
| 5048 | UNBLOCK_INPUT; | 5061 | UNBLOCK_INPUT; |
| 5049 | 5062 | ||
| 5050 | if (r != 0) | 5063 | if (r != 0) |
| @@ -5124,6 +5137,7 @@ sys_select (nfds, rfds, wfds, efds, timeout) | |||
| 5124 | BLOCK_INPUT block, in case that some input has already been | 5137 | BLOCK_INPUT block, in case that some input has already been |
| 5125 | read asynchronously. */ | 5138 | read asynchronously. */ |
| 5126 | BLOCK_INPUT; | 5139 | BLOCK_INPUT; |
| 5140 | ENABLE_WAKEUP_FROM_RNE; | ||
| 5127 | if (!detect_input_pending ()) | 5141 | if (!detect_input_pending ()) |
| 5128 | { | 5142 | { |
| 5129 | int minfd, fd; | 5143 | int minfd, fd; |
| @@ -5184,6 +5198,7 @@ sys_select (nfds, rfds, wfds, efds, timeout) | |||
| 5184 | CFRunLoopRemoveSource (runloop, source, kCFRunLoopDefaultMode); | 5198 | CFRunLoopRemoveSource (runloop, source, kCFRunLoopDefaultMode); |
| 5185 | } | 5199 | } |
| 5186 | } | 5200 | } |
| 5201 | DISABLE_WAKEUP_FROM_RNE; | ||
| 5187 | UNBLOCK_INPUT; | 5202 | UNBLOCK_INPUT; |
| 5188 | 5203 | ||
| 5189 | if (err == noErr || err == eventLoopQuitErr) | 5204 | if (err == noErr || err == eventLoopQuitErr) |
| @@ -5385,6 +5400,16 @@ init_mac_osx_environment () | |||
| 5385 | } | 5400 | } |
| 5386 | #endif /* MAC_OSX */ | 5401 | #endif /* MAC_OSX */ |
| 5387 | 5402 | ||
| 5403 | #if TARGET_API_MAC_CARBON | ||
| 5404 | void | ||
| 5405 | mac_wakeup_from_rne () | ||
| 5406 | { | ||
| 5407 | if (wakeup_from_rne_enabled_p) | ||
| 5408 | /* Post a harmless event so as to wake up from | ||
| 5409 | ReceiveNextEvent. */ | ||
| 5410 | mac_post_mouse_moved_event (); | ||
| 5411 | } | ||
| 5412 | #endif | ||
| 5388 | 5413 | ||
| 5389 | void | 5414 | void |
| 5390 | syms_of_mac () | 5415 | syms_of_mac () |