diff options
| author | YAMAMOTO Mitsuharu | 2007-08-23 08:45:46 +0000 |
|---|---|---|
| committer | YAMAMOTO Mitsuharu | 2007-08-23 08:45:46 +0000 |
| commit | 93b234062e1872a4fed179b21ce04dfa7be46828 (patch) | |
| tree | 1e25f17c5b729a4258d21af756f59e74411c0197 /src | |
| parent | c21e6151312b5d0016599f319d3bf5a6b320ea3a (diff) | |
| download | emacs-93b234062e1872a4fed179b21ce04dfa7be46828.tar.gz emacs-93b234062e1872a4fed179b21ce04dfa7be46828.zip | |
(wakeup_from_rne_enabled_p) [MAC_OSX]: Remove variable.
(ENABLE_WAKEUP_FROM_RNE, DISABLE_WAKEUP_FROM_RNE) [MAC_OSX]:
Remove macros.
[MAC_OSX] (socket_callback): Do nothing.
[MAC_OSX] (select_and_poll_event): Use CFRunLoopRunInMode instead of
ReceiveNextEvent.
[MAC_OSX] (sys_select): Likewise. Don't set context as argument to
socket_callback.
(mac_wakeup_from_rne) [MAC_OSX]: Do nothing.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 20 | ||||
| -rw-r--r-- | src/mac.c | 84 |
2 files changed, 62 insertions, 42 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 51d088925b1..816b96db013 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,23 @@ | |||
| 1 | 2007-08-23 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 2 | |||
| 3 | * Makefile.in (RSVG_LIBS, RSVG_CFLAGS): New variables. | ||
| 4 | (ALL_CFLAGS): Use ${RSVG_CFLAGS} instead of @RSVG_CFLAGS@. | ||
| 5 | (LIBX): Remove @RSVG_LIBS@. | ||
| 6 | (LIBES): Add $(RSVG_LIBS). | ||
| 7 | |||
| 8 | * image.c (svg_load_image): Blend with specified background if exists. | ||
| 9 | Use IMAGE_BACKGROUND. Add Mac OS Support. | ||
| 10 | |||
| 11 | * mac.c (wakeup_from_rne_enabled_p) [MAC_OSX]: Remove variable. | ||
| 12 | (ENABLE_WAKEUP_FROM_RNE, DISABLE_WAKEUP_FROM_RNE) [MAC_OSX]: | ||
| 13 | Remove macros. | ||
| 14 | [MAC_OSX] (socket_callback): Do nothing. | ||
| 15 | [MAC_OSX] (select_and_poll_event): Use CFRunLoopRunInMode instead of | ||
| 16 | ReceiveNextEvent. | ||
| 17 | [MAC_OSX] (sys_select): Likewise. Don't set context as argument to | ||
| 18 | socket_callback. | ||
| 19 | (mac_wakeup_from_rne) [MAC_OSX]: Do nothing. | ||
| 20 | |||
| 1 | 2007-08-22 Glenn Morris <rgm@gnu.org> | 21 | 2007-08-22 Glenn Morris <rgm@gnu.org> |
| 2 | 22 | ||
| 3 | * image.c (x_find_image_file): Search in etc/images/ rather than | 23 | * image.c (x_find_image_file): Search in etc/images/ rather than |
| @@ -79,6 +79,7 @@ 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 | #ifndef MAC_OS_X | ||
| 82 | #if TARGET_API_MAC_CARBON | 83 | #if TARGET_API_MAC_CARBON |
| 83 | static int wakeup_from_rne_enabled_p = 0; | 84 | static int wakeup_from_rne_enabled_p = 0; |
| 84 | #define ENABLE_WAKEUP_FROM_RNE (wakeup_from_rne_enabled_p = 1) | 85 | #define ENABLE_WAKEUP_FROM_RNE (wakeup_from_rne_enabled_p = 1) |
| @@ -87,6 +88,7 @@ static int wakeup_from_rne_enabled_p = 0; | |||
| 87 | #define ENABLE_WAKEUP_FROM_RNE 0 | 88 | #define ENABLE_WAKEUP_FROM_RNE 0 |
| 88 | #define DISABLE_WAKEUP_FROM_RNE 0 | 89 | #define DISABLE_WAKEUP_FROM_RNE 0 |
| 89 | #endif | 90 | #endif |
| 91 | #endif | ||
| 90 | 92 | ||
| 91 | #ifndef MAC_OSX | 93 | #ifndef MAC_OSX |
| 92 | static OSErr posix_pathname_to_fsspec P_ ((const char *, FSSpec *)); | 94 | static OSErr posix_pathname_to_fsspec P_ ((const char *, FSSpec *)); |
| @@ -5010,12 +5012,6 @@ socket_callback (s, type, address, data, info) | |||
| 5010 | const void *data; | 5012 | const void *data; |
| 5011 | void *info; | 5013 | void *info; |
| 5012 | { | 5014 | { |
| 5013 | int fd = CFSocketGetNative (s); | ||
| 5014 | SELECT_TYPE *ofds = (SELECT_TYPE *)info; | ||
| 5015 | |||
| 5016 | if ((type == kCFSocketReadCallBack && FD_ISSET (fd, &ofds[0])) | ||
| 5017 | || (type == kCFSocketConnectCallBack && FD_ISSET (fd, &ofds[1]))) | ||
| 5018 | QuitEventLoop (GetCurrentEventLoop ()); | ||
| 5019 | } | 5015 | } |
| 5020 | #endif /* SELECT_USE_CFSOCKET */ | 5016 | #endif /* SELECT_USE_CFSOCKET */ |
| 5021 | 5017 | ||
| @@ -5025,42 +5021,45 @@ select_and_poll_event (nfds, rfds, wfds, efds, timeout) | |||
| 5025 | SELECT_TYPE *rfds, *wfds, *efds; | 5021 | SELECT_TYPE *rfds, *wfds, *efds; |
| 5026 | EMACS_TIME *timeout; | 5022 | EMACS_TIME *timeout; |
| 5027 | { | 5023 | { |
| 5028 | OSStatus err = noErr; | 5024 | int timedout_p = 0; |
| 5029 | int r = 0; | 5025 | int r = 0; |
| 5026 | EMACS_TIME select_timeout; | ||
| 5027 | EventTimeout timeoutval = | ||
| 5028 | (timeout | ||
| 5029 | ? (EMACS_SECS (*timeout) * kEventDurationSecond | ||
| 5030 | + EMACS_USECS (*timeout) * kEventDurationMicrosecond) | ||
| 5031 | : kEventDurationForever); | ||
| 5030 | 5032 | ||
| 5031 | /* Try detect_input_pending before ReceiveNextEvent in the same | 5033 | /* Try detect_input_pending before CFRunLoopRunInMode in the same |
| 5032 | 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 |
| 5033 | asynchronously. */ | 5035 | asynchronously. */ |
| 5034 | BLOCK_INPUT; | 5036 | BLOCK_INPUT; |
| 5035 | ENABLE_WAKEUP_FROM_RNE; | 5037 | do |
| 5036 | if (!detect_input_pending ()) | ||
| 5037 | { | 5038 | { |
| 5038 | EMACS_TIME select_timeout; | 5039 | if (detect_input_pending ()) |
| 5039 | EventTimeout timeoutval = | 5040 | break; |
| 5040 | (timeout | ||
| 5041 | ? (EMACS_SECS (*timeout) * kEventDurationSecond | ||
| 5042 | + EMACS_USECS (*timeout) * kEventDurationMicrosecond) | ||
| 5043 | : kEventDurationForever); | ||
| 5044 | 5041 | ||
| 5045 | EMACS_SET_SECS_USECS (select_timeout, 0, 0); | 5042 | EMACS_SET_SECS_USECS (select_timeout, 0, 0); |
| 5046 | r = select (nfds, rfds, wfds, efds, &select_timeout); | 5043 | r = select (nfds, rfds, wfds, efds, &select_timeout); |
| 5047 | if (timeoutval == 0.0) | 5044 | if (timeoutval == 0.0) |
| 5048 | err = eventLoopTimedOutErr; | 5045 | timedout_p = 1; |
| 5049 | else if (r == 0) | 5046 | else if (r == 0) |
| 5050 | { | 5047 | { |
| 5051 | #if USE_CG_DRAWING | 5048 | #if USE_CG_DRAWING |
| 5052 | mac_prepare_for_quickdraw (NULL); | 5049 | mac_prepare_for_quickdraw (NULL); |
| 5053 | #endif | 5050 | #endif |
| 5054 | err = ReceiveNextEvent (0, NULL, timeoutval, | 5051 | if (CFRunLoopRunInMode (kCFRunLoopDefaultMode, |
| 5055 | kEventLeaveInQueue, NULL); | 5052 | timeoutval >= 0 ? timeoutval : 10000.0, true) |
| 5053 | == kCFRunLoopRunTimedOut) | ||
| 5054 | timedout_p = 1; | ||
| 5056 | } | 5055 | } |
| 5057 | } | 5056 | } |
| 5058 | DISABLE_WAKEUP_FROM_RNE; | 5057 | while (timeoutval < 0 && timedout_p); |
| 5059 | UNBLOCK_INPUT; | 5058 | UNBLOCK_INPUT; |
| 5060 | 5059 | ||
| 5061 | if (r != 0) | 5060 | if (r != 0) |
| 5062 | return r; | 5061 | return r; |
| 5063 | else if (err == noErr) | 5062 | else if (!timedout_p) |
| 5064 | { | 5063 | { |
| 5065 | /* Pretend that `select' is interrupted by a signal. */ | 5064 | /* Pretend that `select' is interrupted by a signal. */ |
| 5066 | detect_input_pending (); | 5065 | detect_input_pending (); |
| @@ -5077,25 +5076,25 @@ sys_select (nfds, rfds, wfds, efds, timeout) | |||
| 5077 | SELECT_TYPE *rfds, *wfds, *efds; | 5076 | SELECT_TYPE *rfds, *wfds, *efds; |
| 5078 | EMACS_TIME *timeout; | 5077 | EMACS_TIME *timeout; |
| 5079 | { | 5078 | { |
| 5080 | OSStatus err = noErr; | 5079 | int timedout_p = 0; |
| 5081 | int r; | 5080 | int r; |
| 5082 | EMACS_TIME select_timeout; | 5081 | EMACS_TIME select_timeout; |
| 5083 | static SELECT_TYPE ofds[3]; | 5082 | SELECT_TYPE orfds, owfds, oefds; |
| 5084 | 5083 | ||
| 5085 | if (inhibit_window_system || noninteractive | 5084 | if (inhibit_window_system || noninteractive |
| 5086 | || nfds < 1 || rfds == NULL || !FD_ISSET (0, rfds)) | 5085 | || nfds < 1 || rfds == NULL || !FD_ISSET (0, rfds)) |
| 5087 | return select (nfds, rfds, wfds, efds, timeout); | 5086 | return select (nfds, rfds, wfds, efds, timeout); |
| 5088 | 5087 | ||
| 5089 | FD_CLR (0, rfds); | 5088 | FD_CLR (0, rfds); |
| 5090 | ofds[0] = *rfds; | 5089 | orfds = *rfds; |
| 5091 | 5090 | ||
| 5092 | if (wfds) | 5091 | if (wfds) |
| 5093 | ofds[1] = *wfds; | 5092 | owfds = *wfds; |
| 5094 | else | 5093 | else |
| 5095 | FD_ZERO (&ofds[1]); | 5094 | FD_ZERO (&owfds); |
| 5096 | 5095 | ||
| 5097 | if (efds) | 5096 | if (efds) |
| 5098 | ofds[2] = *efds; | 5097 | oefds = *efds; |
| 5099 | else | 5098 | else |
| 5100 | { | 5099 | { |
| 5101 | EventTimeout timeoutval = | 5100 | EventTimeout timeoutval = |
| @@ -5123,25 +5122,23 @@ sys_select (nfds, rfds, wfds, efds, timeout) | |||
| 5123 | if (r != 0 || timeoutval == 0.0) | 5122 | if (r != 0 || timeoutval == 0.0) |
| 5124 | return r; | 5123 | return r; |
| 5125 | 5124 | ||
| 5126 | *rfds = ofds[0]; | 5125 | *rfds = orfds; |
| 5127 | if (wfds) | 5126 | if (wfds) |
| 5128 | *wfds = ofds[1]; | 5127 | *wfds = owfds; |
| 5129 | 5128 | ||
| 5130 | #if SELECT_USE_CFSOCKET | 5129 | #if SELECT_USE_CFSOCKET |
| 5131 | if (timeoutval > 0 && timeoutval <= SELECT_TIMEOUT_THRESHOLD_RUNLOOP) | 5130 | if (timeoutval > 0 && timeoutval <= SELECT_TIMEOUT_THRESHOLD_RUNLOOP) |
| 5132 | goto poll_periodically; | 5131 | goto poll_periodically; |
| 5133 | 5132 | ||
| 5134 | /* Try detect_input_pending before ReceiveNextEvent in the same | 5133 | /* Try detect_input_pending before CFRunLoopRunInMode in the |
| 5135 | BLOCK_INPUT block, in case that some input has already been | 5134 | same BLOCK_INPUT block, in case that some input has already |
| 5136 | read asynchronously. */ | 5135 | been read asynchronously. */ |
| 5137 | BLOCK_INPUT; | 5136 | BLOCK_INPUT; |
| 5138 | ENABLE_WAKEUP_FROM_RNE; | ||
| 5139 | if (!detect_input_pending ()) | 5137 | if (!detect_input_pending ()) |
| 5140 | { | 5138 | { |
| 5141 | int minfd, fd; | 5139 | int minfd, fd; |
| 5142 | CFRunLoopRef runloop = | 5140 | CFRunLoopRef runloop = |
| 5143 | (CFRunLoopRef) GetCFRunLoopFromEventLoop (GetCurrentEventLoop ()); | 5141 | (CFRunLoopRef) GetCFRunLoopFromEventLoop (GetCurrentEventLoop ()); |
| 5144 | static const CFSocketContext context = {0, ofds, NULL, NULL, NULL}; | ||
| 5145 | static CFMutableDictionaryRef sources; | 5142 | static CFMutableDictionaryRef sources; |
| 5146 | 5143 | ||
| 5147 | if (sources == NULL) | 5144 | if (sources == NULL) |
| @@ -5166,7 +5163,7 @@ sys_select (nfds, rfds, wfds, efds, timeout) | |||
| 5166 | CFSocketCreateWithNative (NULL, fd, | 5163 | CFSocketCreateWithNative (NULL, fd, |
| 5167 | (kCFSocketReadCallBack | 5164 | (kCFSocketReadCallBack |
| 5168 | | kCFSocketConnectCallBack), | 5165 | | kCFSocketConnectCallBack), |
| 5169 | socket_callback, &context); | 5166 | socket_callback, NULL); |
| 5170 | 5167 | ||
| 5171 | if (socket == NULL) | 5168 | if (socket == NULL) |
| 5172 | continue; | 5169 | continue; |
| @@ -5183,8 +5180,10 @@ sys_select (nfds, rfds, wfds, efds, timeout) | |||
| 5183 | #if USE_CG_DRAWING | 5180 | #if USE_CG_DRAWING |
| 5184 | mac_prepare_for_quickdraw (NULL); | 5181 | mac_prepare_for_quickdraw (NULL); |
| 5185 | #endif | 5182 | #endif |
| 5186 | err = ReceiveNextEvent (0, NULL, timeoutval, | 5183 | if (CFRunLoopRunInMode (kCFRunLoopDefaultMode, |
| 5187 | kEventLeaveInQueue, NULL); | 5184 | timeoutval >= 0 ? timeoutval : 10000.0, true) |
| 5185 | == kCFRunLoopRunTimedOut) | ||
| 5186 | timedout_p = 1; | ||
| 5188 | 5187 | ||
| 5189 | for (fd = minfd; fd < nfds; fd++) | 5188 | for (fd = minfd; fd < nfds; fd++) |
| 5190 | if (FD_ISSET (fd, rfds) || (wfds && FD_ISSET (fd, wfds))) | 5189 | if (FD_ISSET (fd, rfds) || (wfds && FD_ISSET (fd, wfds))) |
| @@ -5196,10 +5195,9 @@ sys_select (nfds, rfds, wfds, efds, timeout) | |||
| 5196 | CFRunLoopRemoveSource (runloop, source, kCFRunLoopDefaultMode); | 5195 | CFRunLoopRemoveSource (runloop, source, kCFRunLoopDefaultMode); |
| 5197 | } | 5196 | } |
| 5198 | } | 5197 | } |
| 5199 | DISABLE_WAKEUP_FROM_RNE; | ||
| 5200 | UNBLOCK_INPUT; | 5198 | UNBLOCK_INPUT; |
| 5201 | 5199 | ||
| 5202 | if (err == noErr || err == eventLoopQuitErr) | 5200 | if (!timedout_p) |
| 5203 | { | 5201 | { |
| 5204 | EMACS_SET_SECS_USECS (select_timeout, 0, 0); | 5202 | EMACS_SET_SECS_USECS (select_timeout, 0, 0); |
| 5205 | return select_and_poll_event (nfds, rfds, wfds, efds, | 5203 | return select_and_poll_event (nfds, rfds, wfds, efds, |
| @@ -5235,11 +5233,11 @@ sys_select (nfds, rfds, wfds, efds, timeout) | |||
| 5235 | if (r != 0) | 5233 | if (r != 0) |
| 5236 | return r; | 5234 | return r; |
| 5237 | 5235 | ||
| 5238 | *rfds = ofds[0]; | 5236 | *rfds = orfds; |
| 5239 | if (wfds) | 5237 | if (wfds) |
| 5240 | *wfds = ofds[1]; | 5238 | *wfds = owfds; |
| 5241 | if (efds) | 5239 | if (efds) |
| 5242 | *efds = ofds[2]; | 5240 | *efds = oefds; |
| 5243 | 5241 | ||
| 5244 | if (timeout) | 5242 | if (timeout) |
| 5245 | { | 5243 | { |
| @@ -5402,10 +5400,12 @@ init_mac_osx_environment () | |||
| 5402 | void | 5400 | void |
| 5403 | mac_wakeup_from_rne () | 5401 | mac_wakeup_from_rne () |
| 5404 | { | 5402 | { |
| 5403 | #ifndef MAC_OSX | ||
| 5405 | if (wakeup_from_rne_enabled_p) | 5404 | if (wakeup_from_rne_enabled_p) |
| 5406 | /* Post a harmless event so as to wake up from | 5405 | /* Post a harmless event so as to wake up from |
| 5407 | ReceiveNextEvent. */ | 5406 | ReceiveNextEvent. */ |
| 5408 | mac_post_mouse_moved_event (); | 5407 | mac_post_mouse_moved_event (); |
| 5408 | #endif | ||
| 5409 | } | 5409 | } |
| 5410 | #endif | 5410 | #endif |
| 5411 | 5411 | ||