X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/d082ac49971a1c1a9e84c5b201c30aab675f154f..3b0f5318af1501efe93f77b75598480f5e726648:/mac/macterm.c diff --git a/mac/macterm.c b/mac/macterm.c index ebbc8c71..30a89525 100644 --- a/mac/macterm.c +++ b/mac/macterm.c @@ -1,4 +1,4 @@ -/* $Id: macterm.c,v 1.1 2002/11/19 02:13:46 ben Exp $ */ +/* $Id: macterm.c,v 1.6 2002/11/23 13:16:36 ben Exp $ */ /* * Copyright (c) 1999 Simon Tatham * Copyright (c) 1999, 2002 Ben Harris @@ -66,9 +66,7 @@ #define DEFAULT_BG 18 #define DEFAULT_BG_BOLD 19 #define CURSOR_FG 20 -#define CURSOR_FG_BOLD 21 -#define CURSOR_BG 22 -#define CURSOR_BG_BOLD 23 +#define CURSOR_BG 21 #define PTOCC(x) ((x) < 0 ? -(-(x - s->font_width - 1) / s->font_width) : \ (x) / s->font_width) @@ -235,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) @@ -248,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); } @@ -731,7 +729,7 @@ void mac_activateterm(WindowPtr window, Boolean active) { Session *s; s = (Session *)GetWRefCon(window); - s->has_focus = active; + s->term->has_focus = active; term_update(s->term); if (active) ShowControl(s->scrollbar); @@ -753,10 +751,10 @@ void mac_updateterm(WindowPtr window) { BeginUpdate(window); pre_paint(s); term_paint(s->term, s, - (*window->visRgn)->rgnBBox.left, - (*window->visRgn)->rgnBBox.top, - (*window->visRgn)->rgnBBox.right, - (*window->visRgn)->rgnBBox.bottom, 1); + PTOCC((*window->visRgn)->rgnBBox.left), + PTOCR((*window->visRgn)->rgnBBox.top), + PTOCC((*window->visRgn)->rgnBBox.right), + PTOCR((*window->visRgn)->rgnBBox.bottom), 1); /* Restore default colours in case the Window Manager uses them */ if (HAVE_COLOR_QD()) { PmForeColor(DEFAULT_FG); @@ -807,20 +805,9 @@ void do_text(Context ctx, int x, int y, char *text, int len, int style = 0; struct do_text_args a; RgnHandle textrgn; -#if 0 - int i; -#endif SetPort(s->window); -#if 0 - fprintf(stderr, "printing at (%d,%d) %d chars (attr=%x, lattr=%x):\n", - x, y, len, attr, lattr); - for (i = 0; i < len; i++) - fprintf(stderr, "%c", text[i]); - fprintf(stderr, "\n"); -#endif - /* First check this text is relevant */ a.textrect.top = y * s->font_height; a.textrect.bottom = (y + 1) * s->font_height; @@ -889,7 +876,7 @@ static pascal void do_text_for_device(short depth, short devflags, break; case 2: if (a->attr & TATTR_ACTCURS) { - PmForeColor(bright ? CURSOR_FG_BOLD : CURSOR_FG); + PmForeColor(CURSOR_FG); PmBackColor(CURSOR_BG); TextMode(srcCopy); } else { @@ -899,7 +886,7 @@ static pascal void do_text_for_device(short depth, short devflags, break; default: if (a->attr & TATTR_ACTCURS) { - fgcolour = bright ? CURSOR_FG_BOLD : CURSOR_FG; + fgcolour = CURSOR_FG; bgcolour = CURSOR_BG; TextMode(srcCopy); } else { @@ -942,7 +929,7 @@ void do_cursor(Context ctx, int x, int y, char *text, int len, unsigned long attr, int lattr) { - /* FIXME: Should do something here! */ + do_text(ctx, x, y, text, len, attr, lattr); } /* @@ -1216,8 +1203,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); } @@ -1229,13 +1214,13 @@ void palette_set(void *frontend, int n, int r, int g, int b) { static const int first[21] = { 0, 2, 4, 6, 8, 10, 12, 14, 1, 3, 5, 7, 9, 11, 13, 15, - 16, 17, 18, 20, 22 + 16, 17, 18, 20, 21 }; if (!HAVE_COLOR_QD()) return; real_palette_set(s, first[n], r, g, b); - if (first[n] >= 18) + if (first[n] == 18) real_palette_set(s, first[n]+1, r, g, b); if (first[n] == DEFAULT_BG) mac_adjustwinbg(s);