summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Robert <Adrian.B.Robert@gmail.com>2009-02-01 16:32:26 +0000
committerAdrian Robert <Adrian.B.Robert@gmail.com>2009-02-01 16:32:26 +0000
commit8ad093db016b77a82e7cf7a78e52e812b82442ff (patch)
tree17917ba71544e4776c0fb6b02361d8771a212301
parent8d5b8982069c803ab1546d290fe28332612bfc9e (diff)
downloademacs-8ad093db016b77a82e7cf7a78e52e812b82442ff.tar.gz
* nsterm.m (ns_read_socket): Copy 2009-01-29 and 2009-01-30
XT,w32read_socket changes to ns_read_socket. * keyboard.c (handle_interrupt): Don't call quit_throw_to_read_char() under NS. * blockinput.h: Remove NS-specific code.
-rw-r--r--src/ChangeLog8
-rw-r--r--src/blockinput.h11
-rw-r--r--src/keyboard.c11
-rw-r--r--src/nsterm.m34
4 files changed, 41 insertions, 23 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 0fb12db1707..5ff301544bd 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
+2009-02-01 Adrian Robert <Adrian.B.Robert@gmail.com>
+
+ * nsterm.m (ns_read_socket): Copy 2009-01-29 and 2009-01-30
+ XT,w32read_socket changes to ns_read_socket.
+ * keyboard.c (handle_interrupt): Don't call
+ quit_throw_to_read_char() under NS.
+ * blockinput.h: Remove NS-specific code.
+
2009-01-30 Dan Nicolaescu <dann@ics.uci.edu>
* dispnew.c (window_change_signal): Don't try to get the size of a
diff --git a/src/blockinput.h b/src/blockinput.h
index 2eed268f8e5..4b1270110d6 100644
--- a/src/blockinput.h
+++ b/src/blockinput.h
@@ -59,15 +59,6 @@ extern int interrupt_input_pending;
extern int pending_atimers;
-#if defined (HAVE_NS) && !defined (COCOA_EXPERIMENTAL_CTRL_G)
-/* NS does not use interrupt-driven input processing (yet), so this is
- unneeded and moreover was causing problems. */
-#define BLOCK_INPUT
-#define UNBLOCK_INPUT
-#define TOTALLY_UNBLOCK_INPUT
-#define UNBLOCK_INPUT_TO(LEVEL)
-
-#else
/* Begin critical section. */
#define BLOCK_INPUT (interrupt_input_blocked++)
@@ -125,8 +116,6 @@ extern int pending_atimers;
} \
while (0)
-#endif /* defined HAVE_NS && !defined COCOA_EXPERIMENTAL_CTRL_G */
-
#define UNBLOCK_INPUT_RESIGNAL UNBLOCK_INPUT
/* In critical section ? */
diff --git a/src/keyboard.c b/src/keyboard.c
index f3ebf9fdc96..e5d08961001 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -11125,8 +11125,17 @@ handle_interrupt ()
Vquit_flag = Qt;
}
+/* TODO: The longjmp in this call throws the NS event loop integration off,
+ and it seems to do fine without this. Probably some attention
+ needs to be paid to the setting of waiting_for_input in
+ wait_reading_process_output() under HAVE_NS because of the call
+ to ns_select there (needed because otherwise events aren't picked up
+ outside of polling since we don't get SIGIO like X and we don't have a
+ separate event loop thread like W32. */
+#ifndef HAVE_NS
if (waiting_for_input && !echoing)
quit_throw_to_read_char ();
+#endif
}
/* Handle a C-g by making read_char return C-g. */
@@ -11183,7 +11192,7 @@ See also `current-input-mode'. */)
#endif /* NO_SOCK_SIGIO */
}
else
-#endif
+#endif /* HAVE_X_WINDOWS */
new_interrupt_input = !NILP (interrupt);
#else /* not SIGIO */
new_interrupt_input = 0;
diff --git a/src/nsterm.m b/src/nsterm.m
index f41aeee2c93..b9902fbe774 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -3131,15 +3131,22 @@ ns_read_socket (struct terminal *terminal, int expected,
struct input_event ev;
int nevents;
static NSDate *lastCheck = nil;
+
/* NSTRACE (ns_read_socket); */
if (interrupt_input_blocked)
{
interrupt_input_pending = 1;
+#ifdef SYNC_INPUT
+ pending_signals = 1;
+#endif
return -1;
}
interrupt_input_pending = 0;
+#ifdef SYNC_INPUT
+ pending_signals = pending_atimers;
+#endif
BLOCK_INPUT;
#ifdef COCOA_EXPERIMENTAL_CTRL_G
@@ -3181,15 +3188,15 @@ ns_read_socket (struct terminal *terminal, int expected,
to ourself, otherwise [NXApp run] will never exit. */
send_appdefined = YES;
- /* TODO: from termhooks.h: */
- /* XXX Please note that a non-zero value of EXPECTED only means that
- there is available input on at least one of the currently opened
- terminal devices -- but not necessarily on this device.
- Therefore, in most cases EXPECTED should be simply ignored. */
- /* However, if in ns_select, this is called from gobble_input, which
- appears to set it correctly for our purposes, and always assuming
- !expected causes 100% CPU usage. */
- if (!inNsSelect || !expected)
+ /* If called via ns_select, this is called once with expected=1,
+ because we expect either the timeout or file descriptor activity.
+ In this case the first event through will either be real input or
+ one of these. read_avail_input() then calls once more with expected=0
+ and in that case we need to return quickly if there is nothing.
+ If we're being called outside of that, it's also OK to return quickly
+ after one iteration through the event loop, since other terms do
+ this and emacs expects it. */
+ if (!(inNsSelect && expected)) // (!inNsSelect || !expected)
{
/* Post an application defined event on the event queue. When this is
received the [NXApp run] will return, thus having processed all
@@ -3208,6 +3215,7 @@ ns_read_socket (struct terminal *terminal, int expected,
--handling_signal;
#endif
UNBLOCK_INPUT;
+
return nevents;
}
@@ -3267,9 +3275,13 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds,
retain];
/* Let Application dispatch events until it receives an event of the type
- NX_APPDEFINED, which should only be sent by timeout_handler. */
+ NX_APPDEFINED, which should only be sent by timeout_handler.
+ We tell read_avail_input() that input is "expected" because we do expect
+ either the timeout or fd handler to fire, and if they don't, the original
+ call from process.c that got us here expects us to wait until some input
+ comes. */
inNsSelect = 1;
- gobble_input (timeout ? 1 : 0);
+ gobble_input (1);
ev = last_appdefined_event;
inNsSelect = 0;