~mdw
/
sgt
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add a "Config *" argument to term_init(), and use that instead of the global
[sgt/putty]
/
mac
/
macterm.c
diff --git
a/mac/macterm.c
b/mac/macterm.c
index
86a11fc
..
e2e33de
100644
(file)
--- a/
mac/macterm.c
+++ b/
mac/macterm.c
@@
-1,4
+1,4
@@
-/* $Id: macterm.c,v 1.
2 2002/11/19 22:05:48
ben Exp $ */
+/* $Id: macterm.c,v 1.
8 2002/11/23 19:01:01
ben Exp $ */
/*
* Copyright (c) 1999 Simon Tatham
* Copyright (c) 1999, 2002 Ben Harris
/*
* 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 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)
#define PTOCC(x) ((x) < 0 ? -(-(x - s->font_width - 1) / s->font_width) : \
(x) / s->font_width)
@@
-154,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);
@@
-235,8
+233,8
@@
static void mac_initpalette(Session *s) {
* Palette manager documentation suggests inhibiting all tolerant colours
* on greyscale displays.
*/
* 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)
#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);
PM_NORMAL &~ pmInhibitC2, PM_TOLERANCE);
SetEntryUsage(s->palette, DEFAULT_FG_BOLD,
PM_NORMAL &~ pmInhibitC2, PM_TOLERANCE);
- SetEntryUsage(s->palette, CURSOR_
F
G,
+ SetEntryUsage(s->palette, CURSOR_
B
G,
PM_NORMAL &~ pmInhibitC2, PM_TOLERANCE);
palette_reset(s);
}
PM_NORMAL &~ pmInhibitC2, PM_TOLERANCE);
palette_reset(s);
}
@@
-556,7
+554,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,
@@
-731,7
+733,7
@@
void mac_activateterm(WindowPtr window, Boolean active) {
Session *s;
s = (Session *)GetWRefCon(window);
Session *s;
s = (Session *)GetWRefCon(window);
- s->has_focus = active;
+ s->
term->
has_focus = active;
term_update(s->term);
if (active)
ShowControl(s->scrollbar);
term_update(s->term);
if (active)
ShowControl(s->scrollbar);
@@
-807,20
+809,9
@@
void do_text(Context ctx, int x, int y, char *text, int len,
int style = 0;
struct do_text_args a;
RgnHandle textrgn;
int style = 0;
struct do_text_args a;
RgnHandle textrgn;
-#if 0
- int i;
-#endif
SetPort(s->window);
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;
/* First check this text is relevant */
a.textrect.top = y * s->font_height;
a.textrect.bottom = (y + 1) * s->font_height;
@@
-889,7
+880,7
@@
static pascal void do_text_for_device(short depth, short devflags,
break;
case 2:
if (a->attr & TATTR_ACTCURS) {
break;
case 2:
if (a->attr & TATTR_ACTCURS) {
- PmForeColor(
bright ? CURSOR_FG_BOLD :
CURSOR_FG);
+ PmForeColor(CURSOR_FG);
PmBackColor(CURSOR_BG);
TextMode(srcCopy);
} else {
PmBackColor(CURSOR_BG);
TextMode(srcCopy);
} else {
@@
-899,7
+890,7
@@
static pascal void do_text_for_device(short depth, short devflags,
break;
default:
if (a->attr & TATTR_ACTCURS) {
break;
default:
if (a->attr & TATTR_ACTCURS) {
- fgcolour =
bright ? CURSOR_FG_BOLD :
CURSOR_FG;
+ fgcolour = CURSOR_FG;
bgcolour = CURSOR_BG;
TextMode(srcCopy);
} else {
bgcolour = CURSOR_BG;
TextMode(srcCopy);
} else {
@@
-942,7
+933,7
@@
void do_cursor(Context ctx, int x, int y, char *text, int len,
unsigned long attr, int lattr)
{
unsigned long attr, int lattr)
{
- /* FIXME: Should do something here! */
+ do_text(ctx, x, y, text, len, attr, lattr);
}
/*
}
/*
@@
-1216,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;
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);
}
@@
-1229,13
+1218,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,
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, 2
2
+ 16, 17, 18, 20, 2
1
};
if (!HAVE_COLOR_QD())
return;
real_palette_set(s, first[n], r, g, b);
};
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);
real_palette_set(s, first[n]+1, r, g, b);
if (first[n] == DEFAULT_BG)
mac_adjustwinbg(s);