changeset: 4363:6b1bb95ecefee01bb3783163a737b18bba59973a
tag: tip
user: Aidan Kehoe <kehoea(a)parhasard.net>
date: Wed Dec 26 21:14:38 2007 +0100
files: src/ChangeLog.carbon2 src/event-carbon.c src/event-stream.c
description:
Make TTY frames work on Carbon; make non-TTY Carbon builds run with -batch.
2007-12-26 Aidan Kehoe <kehoea(a)parhasard.net>
* event-carbon.c (get_process_events): Removed.
* event-carbon.c (get_tty_and_process_events): New.
This was get_process_events, but it also now reads TTY input when
that's appropriate.
* event-carbon.c:
Generally read events from the TTY if it's available. This is
still unreasonably slow, but at least gnuclient -nw works.
* event-stream.c (init_event_stream):
If we're a carbon build without TTY support running
non-interactively, the stream console needs the carbon event
stream. Provide it.
diff -r 600b94a559b0b289127e224ce93d7f4a783a72a7 -r
6b1bb95ecefee01bb3783163a737b18bba59973a src/ChangeLog.carbon2
--- a/src/ChangeLog.carbon2 Tue Dec 25 16:59:41 2007 +0100
+++ b/src/ChangeLog.carbon2 Wed Dec 26 21:14:38 2007 +0100
@@ -1,3 +1,18 @@ 2007-12-25 Aidan Kehoe <kehoea@parhasa
+2007-12-26 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * event-carbon.c (get_process_events): Removed.
+ * event-carbon.c (get_tty_and_process_events): New.
+ This was get_process_events, but it also now reads TTY input when
+ that's appropriate.
+ * event-carbon.c:
+ Generally read events from the TTY if it's available. This is
+ still unreasonably slow, but at least gnuclient -nw works.
+
+ * event-stream.c (init_event_stream):
+ If we're a carbon build without TTY support running
+ non-interactively, the stream console needs the carbon event
+ stream. Provide it.
+
2007-12-25 Aidan Kehoe <kehoea(a)parhasard.net>
glyphs-carbon.c:
diff -r 600b94a559b0b289127e224ce93d7f4a783a72a7 -r
6b1bb95ecefee01bb3783163a737b18bba59973a src/event-carbon.c
--- a/src/event-carbon.c Tue Dec 25 16:59:41 2007 +0100
+++ b/src/event-carbon.c Wed Dec 26 21:14:38 2007 +0100
@@ -34,7 +34,7 @@ EXFUN (Funicode_to_char, 2); /* In unic
extern Lisp_Object Qcarbon_unicode; /* From intl-carbon.c. */
-extern SELECT_TYPE process_only_mask; /* From event-unixoid.c. */
+extern SELECT_TYPE non_fake_input_wait_mask, tty_only_mask;
extern int track_mouse_down_on_scrollbar (void); /* from scrollbar-carbon.c. */
static struct event_stream *carbon_event_stream;
@@ -573,11 +573,11 @@ get_carbon_events (int can_block_p)
}
static void
-get_process_events (void)
+get_tty_and_process_events (void)
{
int ndesc;
int i;
- SELECT_TYPE temp_mask = process_only_mask;
+ SELECT_TYPE temp_mask = non_fake_input_wait_mask;
EMACS_TIME polling_block_time;
EMACS_SELECT_TIME polling_block_select_time;
@@ -588,7 +588,30 @@ get_process_events (void)
EMACS_TIME_TO_SELECT_TIME (polling_block_time, polling_block_select_time);
ndesc = select (MAXDESC, &temp_mask, 0, 0, &polling_block_select_time);
-
+
+#ifdef HAVE_TTY
+ for (i = 0; i < MAXDESC; i++)
+ {
+ /* To avoid race conditions (among other things, an infinite
+ loop when called from Fdiscard_input()), we must return
+ user events ahead of process events. */
+ if (FD_ISSET (i, &temp_mask) && FD_ISSET (i, &tty_only_mask))
+ {
+ struct console *c =
+ find_tty_or_stream_console_from_fd (i);
+ Lisp_Object emacs_event = Fmake_event (Qnil, Qnil);
+ Lisp_Event *event = XEVENT (emacs_event);
+
+ assert (c);
+ if (read_event_from_tty_or_stream_desc (event, c))
+ {
+ enqueue_dispatch_event (emacs_event);
+ return;
+ }
+ }
+ }
+#endif
+
for (i = 0; i < MAXDESC; i++)
{
if (FD_ISSET (i, &temp_mask))
@@ -612,7 +635,7 @@ get_events (int can_block_p)
get_events (int can_block_p)
{
get_carbon_events (can_block_p);
- get_process_events ();
+ get_tty_and_process_events ();
}
static void emacs_carbon_drain_queue (void);
@@ -624,7 +647,10 @@ emacs_carbon_event_pending_p (int how_ma
if (!how_many)
{
- return !NILP (carbon_user_event_queue) || !NILP (carbon_timer_event_queue) || !NILP
(carbon_process_event_queue);
+ return !NILP (carbon_user_event_queue)
+ || !NILP (carbon_timer_event_queue)
+ || !NILP (carbon_process_event_queue)
+ || !NILP (dispatch_event_queue);
}
else
{
@@ -640,7 +666,9 @@ emacs_carbon_next_event (struct Lisp_Eve
while (1)
{
- if (!NILP (carbon_user_event_queue))
+ if (!NILP (dispatch_event_queue))
+ event = dequeue_dispatch_event();
+ else if (!NILP (carbon_user_event_queue))
event = carbon_dequeue_user_event ();
else if (!NILP (carbon_timer_event_queue))
event = carbon_dequeue_timer_event ();
@@ -825,6 +853,10 @@ emacs_carbon_drain_queue (void)
while (!NILP (carbon_process_event_queue))
enqueue_dispatch_event (carbon_dequeue_process_event ());
+
+#ifdef HAVE_TTY
+ drain_tty_devices ();
+#endif
}
static void
diff -r 600b94a559b0b289127e224ce93d7f4a783a72a7 -r
6b1bb95ecefee01bb3783163a737b18bba59973a src/event-stream.c
--- a/src/event-stream.c Tue Dec 25 16:59:41 2007 +0100
+++ b/src/event-stream.c Wed Dec 26 21:14:38 2007 +0100
@@ -5338,7 +5338,9 @@ init_event_stream (void)
init_event_Xt_late ();
#elif defined (HAVE_TTY)
init_event_tty_late ();
-#endif
+#elif defined (HAVE_CARBON)
+ init_event_carbon_late ();
+#endif
}
init_interrupts_late ();
}
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches