aboutsummaryrefslogtreecommitdiffstats
path: root/src/mac.c
diff options
context:
space:
mode:
authorSteven Tamm2004-07-19 04:42:43 +0000
committerSteven Tamm2004-07-19 04:42:43 +0000
commite082ac9deb976fa9ea3e09d639191bee9e9d5315 (patch)
tree82a1728cf854c76c67afea7fcd1cc5fc81a44688 /src/mac.c
parent1204e81c9e8cc713c8d19116873d9d96a9471467 (diff)
downloademacs-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/mac.c')
-rw-r--r--src/mac.c57
1 files changed, 30 insertions, 27 deletions
diff --git a/src/mac.c b/src/mac.c
index 9f3455ab5dc..dfe5b01761e 100644
--- a/src/mac.c
+++ b/src/mac.c
@@ -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 }