Add a Config * argument to ldisc_create(), and use it in place of the global
[u/mdw/putty] / mac / macterm.c
index 51e732f..1bc4324 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: macterm.c,v 1.4 2002/11/20 00:11:05 ben Exp $ */
+/* $Id: macterm.c,v 1.9 2002/11/23 20:02:38 ben Exp $ */
 /*
  * Copyright (c) 1999 Simon Tatham
  * Copyright (c) 1999, 2002 Ben Harris
@@ -152,7 +152,7 @@ void mac_newsession(void) {
        s->window = GetNewWindow(wTerminal, NULL, (WindowPtr)-1);
     SetWRefCon(s->window, (long)s);
     s->scrollbar = GetNewControl(cVScroll, s->window);
-    s->term = term_init(s);
+    s->term = term_init(&s->cfg, s);
 
     s->logctx = log_init(s);
     term_provide_logctx(s->term, s->logctx);
@@ -165,7 +165,7 @@ void mac_newsession(void) {
     mac_adjustsize(s, s->cfg.height, s->cfg.width);
     term_size(s->term, s->cfg.height, s->cfg.width, s->cfg.savelines);
 
-    s->ldisc = ldisc_create(s->term, s->back, s->backhandle, s);
+    s->ldisc = ldisc_create(&s->cfg, s->term, s->back, s->backhandle, s);
     ldisc_send(s->ldisc, NULL, 0, 0);/* cause ldisc to notice changes */
 
     mac_initfont(s);
@@ -233,8 +233,8 @@ static void mac_initpalette(Session *s) {
      * Palette manager documentation suggests inhibiting all tolerant colours
      * on greyscale displays.
      */
-#define PM_NORMAL      pmTolerant | pmInhibitC2 |                      \
-                       pmInhibitG2 | pmInhibitG4 | pmInhibitG8 | pmInhibitC2
+#define PM_NORMAL      ( pmTolerant | pmInhibitC2 |                    \
+                         pmInhibitG2 | pmInhibitG4 | pmInhibitG8 )
 #define PM_TOLERANCE   0x2000
     s->palette = NewPalette(22, NULL, PM_NORMAL, PM_TOLERANCE);
     if (s->palette == NULL)
@@ -246,7 +246,7 @@ static void mac_initpalette(Session *s) {
                  PM_NORMAL &~ pmInhibitC2, PM_TOLERANCE);
     SetEntryUsage(s->palette, DEFAULT_FG_BOLD,
                  PM_NORMAL &~ pmInhibitC2, PM_TOLERANCE);
-    SetEntryUsage(s->palette, CURSOR_FG,
+    SetEntryUsage(s->palette, CURSOR_BG,
                  PM_NORMAL &~ pmInhibitC2, PM_TOLERANCE);
     palette_reset(s);
 }
@@ -554,7 +554,11 @@ void mac_keyterm(WindowPtr window, EventRecord *event) {
 
     s = (Session *)GetWRefCon(window);
     len = mac_keytrans(s, event, buf);
-    s->back->send(s, (char *)buf, len);
+    ldisc_send(s->ldisc, (char *)buf, len, 1);
+    ObscureCursor();
+    term_seen_key_event(s->term);
+    term_out(s->term);
+    term_update(s->term);
 }
 
 static int mac_keytrans(Session *s, EventRecord *event,
@@ -1203,8 +1207,6 @@ static void real_palette_set(Session *s, int n, int r, int g, int b)
     col.red   = r * 0x0101;
     col.green = g * 0x0101;
     col.blue  = b * 0x0101;
-    fprintf(stderr, "p%d <- (0x%x, 0x%x, 0x%x)\n", n, col.red, col.green,
-           col.blue);
     SetEntryColor(s->palette, n, &col);
 }