Slight improvement to cursor blink timing: since the cursor doesn't
[u/mdw/putty] / mac / macterm.c
index 7766c7b..f308808 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: macterm.c,v 1.76 2004/06/20 17:07:37 jacob Exp $ */
+/* $Id$ */
 /*
  * Copyright (c) 1999 Simon Tatham
  * Copyright (c) 1999, 2002 Ben Harris
@@ -314,7 +314,6 @@ void mac_pollterm(void)
     Session *s;
 
     for (s = sesslist; s != NULL; s = s->next) {
-       term_out(s->term);
        term_update(s->term);
     }
 }
@@ -1043,7 +1042,7 @@ static void mac_activateterm(WindowPtr window, EventRecord *event)
     Boolean active = (event->modifiers & activeFlag) != 0;
 
     s = mac_windowsession(window);
-    s->term->has_focus = active;
+    term_set_focus(s->term, active);
     term_update(s->term);
     if (active)
        ShowControl(s->scrollbar);
@@ -1139,7 +1138,7 @@ struct do_text_args {
  *
  * x and y are text row and column (zero-based)
  */
-void do_text(Context ctx, int x, int y, char *text, int len,
+void do_text(Context ctx, int x, int y, wchar_t *text, int len,
             unsigned long attr, int lattr)
 {
     Session *s = ctx;
@@ -1150,7 +1149,6 @@ void do_text(Context ctx, int x, int y, char *text, int len,
     RgnHandle visrgn;
 #endif
     char mactextbuf[1024];
-    UniChar unitextbuf[1024];
     wchar_t *unitextptr;
     int i, fontwidth;
     ByteCount iread, olen;
@@ -1159,6 +1157,11 @@ void do_text(Context ctx, int x, int y, char *text, int len,
 
     assert(len <= 1024);
 
+    /* SGT, 2004-10-14: I don't know how to support combining characters
+     * on the Mac. Hopefully the first person to fail this assertion will
+     * know how to do it better than me... */
+    assert(!(attr & TATTR_COMBINING));
+
     SetPort((GrafPtr)GetWindowPort(s->window));
 
     fontwidth = s->font_width;
@@ -1185,20 +1188,16 @@ void do_text(Context ctx, int x, int y, char *text, int len,
        return;
 #endif
 
-    /* Unpack Unicode from the mad format we get passed */
-    for (i = 0; i < len; i++)
-       unitextbuf[i] = (unsigned char)text[i] | (attr & CSET_MASK);
-
     if (s->uni_to_font != NULL) {
        err = ConvertFromUnicodeToText(s->uni_to_font, len * sizeof(UniChar),
-                                      unitextbuf, kUnicodeUseFallbacksMask,
+                                      text, kUnicodeUseFallbacksMask,
                                       0, NULL, NULL, NULL,
                                       1024, &iread, &olen, mactextbuf);
        if (err != noErr && err != kTECUsedFallbacksStatus)
            olen = 0;
     } else  if (s->font_charset != CS_NONE) {
        /* XXX this is bogus if wchar_t and UniChar are different sizes. */
-       unitextptr = (wchar_t *)unitextbuf;
+       unitextptr = (wchar_t *)text;
        olen = charset_from_unicode(&unitextptr, &len, mactextbuf, 1024,
                                    s->font_charset, NULL, ".", 1);
     } else