From a7fd167471ac60a7a480a3d4447e453a133e36e8 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Sat, 20 Feb 1999 23:57:58 +0000 Subject: [PATCH] Start of a Mac front-end to the terminal emulator. [originally from svn r54] --- macterm.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 macterm.c diff --git a/macterm.c b/macterm.c new file mode 100644 index 00000000..99102d83 --- /dev/null +++ b/macterm.c @@ -0,0 +1,46 @@ +/* + * macterm.c -- Macintosh terminal front-end + */ + +#include + +#include + +#include "macresid.h" +#include "putty.h" + +struct mac_session { + short fnum; + int fsize; +} + +void mac_newsession(void) { + WindowPtr window; + struct mac_session *s; + + /* This should obviously be initialised by other means */ + s = smalloc(sizeof(*s)); + s->fnum = GetFNum("\pMonaco"); + s->fsize = 9; + rows = 24; + cols = 80; + + /* XXX: non-Color-QuickDraw? Own storage management? */ + window = GetNewCWindow(wTerminal, NULL, (WindowPtr)-1); + SetPort(window); + mac_initfont(s); + term_init(); + term_size(rows, cols); +} + +void mac_initfont(struct mac_session *s) { + FMetricRec metrics; + + TextFont(s->fnum); + TextFace(0); + TextSize(s->fsize); + FontMetrics(&metrics); + font_width = metrics.widMax; + font_height = metrics.ascent + metrics.descent + metrics.leading; + SizeWindow(window, cols * font_width, rows * font_height, TRUE); +} -- 2.45.2