projects
/
u
/
mdw
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Increase the size of the `font' buffer in the Config structure, for
[u/mdw/putty]
/
mac
/
macterm.c
diff --git
a/mac/macterm.c
b/mac/macterm.c
index
2b0c0fe
..
299debf
100644
(file)
--- a/
mac/macterm.c
+++ b/
mac/macterm.c
@@
-1,4
+1,4
@@
-/* $Id: macterm.c,v 1.
5 2002/11/20 00:33:44
ben Exp $ */
+/* $Id: macterm.c,v 1.
12 2002/11/26 01:32:51
ben Exp $ */
/*
* Copyright (c) 1999 Simon Tatham
* Copyright (c) 1999, 2002 Ben Harris
/*
* 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->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);
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);
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);
ldisc_send(s->ldisc, NULL, 0, 0);/* cause ldisc to notice changes */
mac_initfont(s);
@@
-228,6
+228,8
@@
static void mac_adjustsize(Session *s, int newrows, int newcols) {
static void mac_initpalette(Session *s) {
int i;
static void mac_initpalette(Session *s) {
int i;
+ if (!HAVE_COLOR_QD())
+ return;
/*
* Most colours should be inhibited on 2bpp displays.
* Palette manager documentation suggests inhibiting all tolerant colours
/*
* Most colours should be inhibited on 2bpp displays.
* Palette manager documentation suggests inhibiting all tolerant colours
@@
-554,7
+556,11
@@
void mac_keyterm(WindowPtr window, EventRecord *event) {
s = (Session *)GetWRefCon(window);
len = mac_keytrans(s, event, buf);
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,
}
static int mac_keytrans(Session *s, EventRecord *event,
@@
-787,7
+793,6
@@
static void mac_drawgrowicon(Session *s) {
struct do_text_args {
Session *s;
Rect textrect;
struct do_text_args {
Session *s;
Rect textrect;
- Rect leadrect;
char *text;
int len;
unsigned long attr;
char *text;
int len;
unsigned long attr;
@@
-821,12
+826,6
@@
void do_text(Context ctx, int x, int y, char *text, int len,
a.len = len;
a.attr = attr;
a.lattr = lattr;
a.len = len;
a.attr = attr;
a.lattr = lattr;
- if (s->font_leading > 0)
- SetRect(&a.leadrect,
- a.textrect.left, a.textrect.bottom - s->font_leading,
- a.textrect.right, a.textrect.bottom);
- else
- SetRect(&a.leadrect, 0, 0, 0, 0);
SetPort(s->window);
TextFont(s->fontnum);
if (s->cfg.fontisbold || (attr & ATTR_BOLD) && !s->cfg.bold_colour)
SetPort(s->window);
TextFont(s->fontnum);
if (s->cfg.fontisbold || (attr & ATTR_BOLD) && !s->cfg.bold_colour)
@@
-835,6
+834,7
@@
void do_text(Context ctx, int x, int y, char *text, int len,
style |= underline;
TextFace(style);
TextSize(s->cfg.fontheight);
style |= underline;
TextFace(style);
TextSize(s->cfg.fontheight);
+ TextMode(srcOr);
SetFractEnable(FALSE); /* We want characters on pixel boundaries */
if (HAVE_COLOR_QD())
if (style & bold) {
SetFractEnable(FALSE); /* We want characters on pixel boundaries */
if (HAVE_COLOR_QD())
if (style & bold) {
@@
-858,55
+858,53
@@
void do_text(Context ctx, int x, int y, char *text, int len,
static pascal void do_text_for_device(short depth, short devflags,
GDHandle device, long cookie) {
struct do_text_args *a;
static pascal void do_text_for_device(short depth, short devflags,
GDHandle device, long cookie) {
struct do_text_args *a;
- int bgcolour, fgcolour, bright;
+ int bgcolour, fgcolour, bright
, reverse, tmp
;
a = (struct do_text_args *)cookie;
bright = (a->attr & ATTR_BOLD) && a->s->cfg.bold_colour;
a = (struct do_text_args *)cookie;
bright = (a->attr & ATTR_BOLD) && a->s->cfg.bold_colour;
+ reverse = a->attr & ATTR_REVERSE;
- TextMode(a->attr & ATTR_REVERSE ? notSrcCopy : srcCopy);
+ if (depth == 1 && (a->attr & TATTR_ACTCURS))
+ reverse = !reverse;
- switch (depth) {
- case 1:
- /* XXX This should be done with a _little_ more configurability */
- ForeColor(whiteColor);
- BackColor(blackColor);
- if (a->attr & TATTR_ACTCURS)
- TextMode(a->attr & ATTR_REVERSE ? srcCopy : notSrcCopy);
- break;
- case 2:
- if (a->attr & TATTR_ACTCURS) {
- PmForeColor(CURSOR_FG);
- PmBackColor(CURSOR_BG);
- TextMode(srcCopy);
+ if (HAVE_COLOR_QD()) {
+ if (depth > 2) {
+ fgcolour = ((a->attr & ATTR_FGMASK) >> ATTR_FGSHIFT) * 2;
+ bgcolour = ((a->attr & ATTR_BGMASK) >> ATTR_BGSHIFT) * 2;
} else {
} else {
- PmForeColor(bright ? DEFAULT_FG_BOLD : DEFAULT_FG);
- PmBackColor(DEFAULT_BG);
+ /*
+ * NB: bold reverse in 2bpp breaks with the usual PuTTY model and
+ * boldens the background, because that's all we can do.
+ */
+ fgcolour = bright ? DEFAULT_FG_BOLD : DEFAULT_FG;
+ bgcolour = DEFAULT_BG;
}
}
- break;
- default:
- if (a->attr & TATTR_ACTCURS) {
+ if (reverse) {
+ tmp = fgcolour;
+ fgcolour = bgcolour;
+ bgcolour = tmp;
+ }
+ if (bright && depth > 2)
+ fgcolour++;
+ if ((a->attr & TATTR_ACTCURS) && depth > 1) {
fgcolour = CURSOR_FG;
bgcolour = CURSOR_BG;
fgcolour = CURSOR_FG;
bgcolour = CURSOR_BG;
- TextMode(srcCopy);
- } else {
- fgcolour = ((a->attr & ATTR_FGMASK) >> ATTR_FGSHIFT) * 2;
- bgcolour = ((a->attr & ATTR_BGMASK) >> ATTR_BGSHIFT) * 2;
- if (bright)
- if (a->attr & ATTR_REVERSE)
- bgcolour++;
- else
- fgcolour++;
}
PmForeColor(fgcolour);
PmBackColor(bgcolour);
}
PmForeColor(fgcolour);
PmBackColor(bgcolour);
- break;
+ } else { /* No Color Quickdraw */
+ /* XXX This should be done with a _little_ more configurability */
+ if (reverse) {
+ ForeColor(blackColor);
+ BackColor(whiteColor);
+ } else {
+ ForeColor(whiteColor);
+ BackColor(blackColor);
+ }
}
}
- if (a->attr & ATTR_REVERSE)
- PaintRect(&a->leadrect);
- else
- EraseRect(&a->leadrect);
+ EraseRect(&a->textrect);
MoveTo(a->textrect.left, a->textrect.top + a->s->font_ascent);
/* FIXME: Sort out bold width adjustments on Original QuickDraw. */
DrawText(a->text, 0, a->len);
MoveTo(a->textrect.left, a->textrect.top + a->s->font_ascent);
/* FIXME: Sort out bold width adjustments on Original QuickDraw. */
DrawText(a->text, 0, a->len);
@@
-1203,8
+1201,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;
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);
}
SetEntryColor(s->palette, n, &col);
}
@@
-1269,10
+1265,9
@@
void do_scroll(void *frontend, int topline, int botline, int lines) {
/* FIXME: This is seriously broken on Original QuickDraw. No idea why. */
SetPort(s->window);
/* FIXME: This is seriously broken on Original QuickDraw. No idea why. */
SetPort(s->window);
+ PenNormal();
if (HAVE_COLOR_QD())
PmBackColor(DEFAULT_BG);
if (HAVE_COLOR_QD())
PmBackColor(DEFAULT_BG);
- else
- BackColor(blackColor);
update = NewRgn();
SetRect(&r, 0, topline * s->font_height,
s->term->cols * s->font_width, (botline + 1) * s->font_height);
update = NewRgn();
SetRect(&r, 0, topline * s->font_height,
s->term->cols * s->font_width, (botline + 1) * s->font_height);