mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-25 01:02:24 +00:00
Start of a Mac front-end to the terminal emulator.
[originally from svn r54]
This commit is contained in:
parent
29f26a1050
commit
a7fd167471
46
macterm.c
Normal file
46
macterm.c
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* macterm.c -- Macintosh terminal front-end
|
||||
*/
|
||||
|
||||
#include <MacWindows.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#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);
|
||||
}
|
Loading…
Reference in New Issue
Block a user