diff options
| author | Steven Tamm | 2004-07-19 04:42:43 +0000 |
|---|---|---|
| committer | Steven Tamm | 2004-07-19 04:42:43 +0000 |
| commit | e082ac9deb976fa9ea3e09d639191bee9e9d5315 (patch) | |
| tree | 82a1728cf854c76c67afea7fcd1cc5fc81a44688 /src | |
| parent | 1204e81c9e8cc713c8d19116873d9d96a9471467 (diff) | |
| download | emacs-e082ac9deb976fa9ea3e09d639191bee9e9d5315.tar.gz emacs-e082ac9deb976fa9ea3e09d639191bee9e9d5315.zip | |
Fixes for Ctrl-G support on carbon, replacing old timeout based polling
with alarm based polling.
mac.c (sys_select): Redo sys_select to use alarm-based
polling instead of 1 sec timeouts (like solaris).
macterm.c (x_make_frame_visible): Comment in polling on
frame creation.
keyboard.c: Undef SIGIO on Carbon
atimer.c (alarm_signal_handler): Call alarm handlers after
scheduling.
eval.c (Feval): Remove quit_char test
process.c (wait_reading_process_input): Remove clearing
stdin for select call on process input
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 18 | ||||
| -rw-r--r-- | src/atimer.c | 6 | ||||
| -rw-r--r-- | src/eval.c | 3 | ||||
| -rw-r--r-- | src/keyboard.c | 2 | ||||
| -rw-r--r-- | src/mac.c | 57 | ||||
| -rw-r--r-- | src/macterm.c | 4 | ||||
| -rw-r--r-- | src/process.c | 7 |
7 files changed, 59 insertions, 38 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 7a236ada29a..bc59ae9e2d7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,21 @@ | |||
| 1 | 2004-07-18 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 2 | |||
| 3 | * mac.c (sys_select): Redo sys_select to use alarm-based | ||
| 4 | polling instead of 1 sec timeouts (like solaris). | ||
| 5 | |||
| 6 | * macterm.c (x_make_frame_visible): Comment in polling on | ||
| 7 | frame creation. | ||
| 8 | |||
| 9 | * keyboard.c: Undef SIGIO on Carbon | ||
| 10 | |||
| 11 | * atimer.c (alarm_signal_handler): Call alarm handlers after | ||
| 12 | scheduling. | ||
| 13 | |||
| 14 | * eval.c (Feval): Remove quit_char test | ||
| 15 | |||
| 16 | * process.c (wait_reading_process_input): Remove clearing | ||
| 17 | stdin for select call on process input. | ||
| 18 | |||
| 1 | 2004-07-18 Luc Teirlinck <teirllm@auburn.edu> | 19 | 2004-07-18 Luc Teirlinck <teirllm@auburn.edu> |
| 2 | 20 | ||
| 3 | * xdisp.c (syms_of_xdisp) <window-scroll-functions>: Correct | 21 | * xdisp.c (syms_of_xdisp) <window-scroll-functions>: Correct |
diff --git a/src/atimer.c b/src/atimer.c index 7e78bdad9c0..9ec0238ff28 100644 --- a/src/atimer.c +++ b/src/atimer.c | |||
| @@ -375,7 +375,9 @@ alarm_signal_handler (signo) | |||
| 375 | 375 | ||
| 376 | t = atimers; | 376 | t = atimers; |
| 377 | atimers = atimers->next; | 377 | atimers = atimers->next; |
| 378 | #ifndef MAC_OSX | ||
| 378 | t->fn (t); | 379 | t->fn (t); |
| 380 | #endif | ||
| 379 | 381 | ||
| 380 | if (t->type == ATIMER_CONTINUOUS) | 382 | if (t->type == ATIMER_CONTINUOUS) |
| 381 | { | 383 | { |
| @@ -387,6 +389,10 @@ alarm_signal_handler (signo) | |||
| 387 | t->next = free_atimers; | 389 | t->next = free_atimers; |
| 388 | free_atimers = t; | 390 | free_atimers = t; |
| 389 | } | 391 | } |
| 392 | #ifdef MAC_OSX | ||
| 393 | /* Fix for Ctrl-G. Perhaps this should apply to all platforms. */ | ||
| 394 | t->fn (t); | ||
| 395 | #endif | ||
| 390 | 396 | ||
| 391 | EMACS_GET_TIME (now); | 397 | EMACS_GET_TIME (now); |
| 392 | } | 398 | } |
diff --git a/src/eval.c b/src/eval.c index d7cfe959158..f28105ac987 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -2145,9 +2145,6 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, | |||
| 2145 | val = call_debugger (Fcons (Qexit, Fcons (val, Qnil))); | 2145 | val = call_debugger (Fcons (Qexit, Fcons (val, Qnil))); |
| 2146 | backtrace_list = backtrace.next; | 2146 | backtrace_list = backtrace.next; |
| 2147 | 2147 | ||
| 2148 | #ifdef HAVE_CARBON | ||
| 2149 | mac_check_for_quit_char(); | ||
| 2150 | #endif | ||
| 2151 | return val; | 2148 | return val; |
| 2152 | } | 2149 | } |
| 2153 | 2150 | ||
diff --git a/src/keyboard.c b/src/keyboard.c index de6356987b8..eb2ed608856 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -607,7 +607,7 @@ int flow_control; | |||
| 607 | 607 | ||
| 608 | /* We are unable to use interrupts if FIONREAD is not available, | 608 | /* We are unable to use interrupts if FIONREAD is not available, |
| 609 | so flush SIGIO so we won't try. */ | 609 | so flush SIGIO so we won't try. */ |
| 610 | #ifndef FIONREAD | 610 | #if !defined (FIONREAD) || defined(HAVE_CARBON) |
| 611 | #ifdef SIGIO | 611 | #ifdef SIGIO |
| 612 | #undef SIGIO | 612 | #undef SIGIO |
| 613 | #endif | 613 | #endif |
| @@ -2782,12 +2782,9 @@ sys_select (n, rfds, wfds, efds, timeout) | |||
| 2782 | SELECT_TYPE *efds; | 2782 | SELECT_TYPE *efds; |
| 2783 | struct timeval *timeout; | 2783 | struct timeval *timeout; |
| 2784 | { | 2784 | { |
| 2785 | if (!inhibit_window_system && rfds && FD_ISSET (0, rfds)) | 2785 | if (inhibit_window_system || noninteractive |
| 2786 | return 1; | 2786 | || rfds == NULL || !FD_ISSET (0, rfds)) |
| 2787 | else if (inhibit_window_system || noninteractive || | 2787 | return select(n, rfds, wfds, efds, timeout); |
| 2788 | (timeout && (EMACS_SECS(*timeout)==0) && | ||
| 2789 | (EMACS_USECS(*timeout)==0))) | ||
| 2790 | return select(n, rfds, wfds, efds, timeout); | ||
| 2791 | else | 2788 | else |
| 2792 | { | 2789 | { |
| 2793 | EMACS_TIME end_time, now; | 2790 | EMACS_TIME end_time, now; |
| @@ -2798,30 +2795,36 @@ sys_select (n, rfds, wfds, efds, timeout) | |||
| 2798 | 2795 | ||
| 2799 | do | 2796 | do |
| 2800 | { | 2797 | { |
| 2798 | EMACS_TIME select_timeout | ||
| 2799 | SELECT_TYPE orfds = *rfds; | ||
| 2801 | int r; | 2800 | int r; |
| 2802 | EMACS_TIME one_second; | 2801 | OSErr err; |
| 2803 | SELECT_TYPE orfds; | 2802 | |
| 2804 | 2803 | EMACS_SET_SECS (select_timeout, 0); | |
| 2805 | FD_ZERO (&orfds); | 2804 | EMACS_SET_USECS (select_timeout, 100); |
| 2806 | if (rfds) | 2805 | |
| 2807 | { | 2806 | if (timeout && EMACS_TIME_LT (*timeout, select_timeout)) |
| 2808 | orfds = *rfds; | 2807 | select_timeout = *timeout; |
| 2809 | } | 2808 | |
| 2810 | 2809 | r = select (n, &orfds, wfds, efds, &select_timeout); | |
| 2811 | EMACS_SET_SECS (one_second, 1); | 2810 | err = ReceiveNextEvent (0, NULL, kEventDurationNoWait, false, NULL); |
| 2812 | EMACS_SET_USECS (one_second, 0); | 2811 | if (r > 0) |
| 2813 | 2812 | { | |
| 2814 | if (timeout && EMACS_TIME_LT(*timeout, one_second)) | 2813 | *rfds = orfds; |
| 2815 | one_second = *timeout; | 2814 | if (err == noErr) |
| 2816 | 2815 | { | |
| 2817 | if ((r = select (n, &orfds, wfds, efds, &one_second)) > 0) | 2816 | FD_SET (0, rfds); |
| 2817 | r++; | ||
| 2818 | } | ||
| 2819 | return r; | ||
| 2820 | } | ||
| 2821 | else if (err == noErr) | ||
| 2818 | { | 2822 | { |
| 2819 | *rfds = orfds; | 2823 | FD_ZERO (rfds); |
| 2820 | return r; | 2824 | FD_SET (0, rfds); |
| 2825 | return 1; | ||
| 2821 | } | 2826 | } |
| 2822 | 2827 | ||
| 2823 | mac_check_for_quit_char(); | ||
| 2824 | |||
| 2825 | EMACS_GET_TIME (now); | 2828 | EMACS_GET_TIME (now); |
| 2826 | EMACS_SUB_TIME (now, end_time, now); | 2829 | EMACS_SUB_TIME (now, end_time, now); |
| 2827 | } | 2830 | } |
diff --git a/src/macterm.c b/src/macterm.c index 7d9c2bf7105..9e482a17c8e 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -5321,7 +5321,6 @@ x_make_frame_visible (f) | |||
| 5321 | 5321 | ||
| 5322 | XFlush (FRAME_MAC_DISPLAY (f)); | 5322 | XFlush (FRAME_MAC_DISPLAY (f)); |
| 5323 | 5323 | ||
| 5324 | #if 0 /* MAC_TODO */ | ||
| 5325 | /* Synchronize to ensure Emacs knows the frame is visible | 5324 | /* Synchronize to ensure Emacs knows the frame is visible |
| 5326 | before we do anything else. We do this loop with input not blocked | 5325 | before we do anything else. We do this loop with input not blocked |
| 5327 | so that incoming events are handled. */ | 5326 | so that incoming events are handled. */ |
| @@ -5365,9 +5364,6 @@ x_make_frame_visible (f) | |||
| 5365 | FRAME_SAMPLE_VISIBILITY (f); | 5364 | FRAME_SAMPLE_VISIBILITY (f); |
| 5366 | } | 5365 | } |
| 5367 | } | 5366 | } |
| 5368 | #else | ||
| 5369 | UNBLOCK_INPUT; | ||
| 5370 | #endif /* MAC_TODO */ | ||
| 5371 | } | 5367 | } |
| 5372 | 5368 | ||
| 5373 | /* Change from mapped state to withdrawn state. */ | 5369 | /* Change from mapped state to withdrawn state. */ |
diff --git a/src/process.c b/src/process.c index 4c47fc0e92a..aad36b904b5 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -4190,12 +4190,13 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display) | |||
| 4190 | SELECT_TYPE Atemp, Ctemp; | 4190 | SELECT_TYPE Atemp, Ctemp; |
| 4191 | 4191 | ||
| 4192 | Atemp = input_wait_mask; | 4192 | Atemp = input_wait_mask; |
| 4193 | #ifdef MAC_OSX | 4193 | #if 0 |
| 4194 | /* On Mac OS X, the SELECT system call always says input is | 4194 | /* On Mac OS X 10.0, the SELECT system call always says input is |
| 4195 | present (for reading) at stdin, even when none is. This | 4195 | present (for reading) at stdin, even when none is. This |
| 4196 | causes the call to SELECT below to return 1 and | 4196 | causes the call to SELECT below to return 1 and |
| 4197 | status_notify not to be called. As a result output of | 4197 | status_notify not to be called. As a result output of |
| 4198 | subprocesses are incorrectly discarded. */ | 4198 | subprocesses are incorrectly discarded. |
| 4199 | */ | ||
| 4199 | FD_CLR (0, &Atemp); | 4200 | FD_CLR (0, &Atemp); |
| 4200 | #endif | 4201 | #endif |
| 4201 | Ctemp = connect_wait_mask; | 4202 | Ctemp = connect_wait_mask; |