1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 18:07:59 +00:00

Fix various breakages my Carbonisation caused in the Classic build, notably

that outside Carbon, CGrafPtr and GrafPtr are different types, even though
they're mostly interchangeable, so we need to interpose a cast between
GetWindowPort and SetPort.

[originally from svn r2790]
This commit is contained in:
Ben Harris 2003-02-04 02:03:53 +00:00
parent 13feddf9ea
commit 16f40e8bcc

View File

@ -1,4 +1,4 @@
/* $Id: macterm.c,v 1.65 2003/02/04 01:53:50 ben Exp $ */ /* $Id: macterm.c,v 1.66 2003/02/04 02:03:53 ben Exp $ */
/* /*
* Copyright (c) 1999 Simon Tatham * Copyright (c) 1999 Simon Tatham
* Copyright (c) 1999, 2002 Ben Harris * Copyright (c) 1999, 2002 Ben Harris
@ -204,7 +204,7 @@ static void mac_initfont(Session *s) {
TextEncoding enc; TextEncoding enc;
OptionBits fbflags; OptionBits fbflags;
SetPort(GetWindowPort(s->window)); SetPort((GrafPtr)GetWindowPort(s->window));
GetFNum(s->cfg.font.name, &s->fontnum); GetFNum(s->cfg.font.name, &s->fontnum);
TextFont(s->fontnum); TextFont(s->fontnum);
TextFace(s->cfg.font.face); TextFace(s->cfg.font.face);
@ -384,7 +384,7 @@ void mac_adjusttermcursor(WindowPtr window, Point mouse, RgnHandle cursrgn) {
RgnHandle visrgn; RgnHandle visrgn;
#endif #endif
SetPort(GetWindowPort(window)); SetPort((GrafPtr)GetWindowPort(window));
s = (Session *)GetWRefCon(window); s = (Session *)GetWRefCon(window);
GlobalToLocal(&mouse); GlobalToLocal(&mouse);
part = FindControl(mouse, window, &control); part = FindControl(mouse, window, &control);
@ -485,7 +485,7 @@ void mac_clickterm(WindowPtr window, EventRecord *event) {
static ControlActionUPP mac_scrolltracker_upp = NULL; static ControlActionUPP mac_scrolltracker_upp = NULL;
s = (Session *)GetWRefCon(window); s = (Session *)GetWRefCon(window);
SetPort(GetWindowPort(window)); SetPort((GrafPtr)GetWindowPort(window));
mouse = event->where; mouse = event->where;
GlobalToLocal(&mouse); GlobalToLocal(&mouse);
part = FindControl(mouse, window, &control); part = FindControl(mouse, window, &control);
@ -518,7 +518,7 @@ static void text_click(Session *s, EventRecord *event) {
static int lastrow = -1, lastcol = -1; static int lastrow = -1, lastcol = -1;
static Mouse_Action lastact = MA_NOTHING; static Mouse_Action lastact = MA_NOTHING;
SetPort(GetWindowPort(s->window)); SetPort((GrafPtr)GetWindowPort(s->window));
localwhere = event->where; localwhere = event->where;
GlobalToLocal(&localwhere); GlobalToLocal(&localwhere);
@ -1012,7 +1012,7 @@ void mac_updateterm(WindowPtr window) {
#endif #endif
s = (Session *)GetWRefCon(window); s = (Session *)GetWRefCon(window);
SetPort(GetWindowPort(window)); SetPort((GrafPtr)GetWindowPort(window));
BeginUpdate(window); BeginUpdate(window);
pre_paint(s); pre_paint(s);
#if TARGET_API_MAC_CARBON #if TARGET_API_MAC_CARBON
@ -1050,7 +1050,7 @@ static void mac_drawgrowicon(Session *s) {
Rect clip; Rect clip;
RgnHandle savergn; RgnHandle savergn;
SetPort(GetWindowPort(s->window)); SetPort((GrafPtr)GetWindowPort(s->window));
/* /*
* Stop DrawGrowIcon giving us space for a horizontal scrollbar * Stop DrawGrowIcon giving us space for a horizontal scrollbar
* See Tech Note TB575 for details. * See Tech Note TB575 for details.
@ -1103,7 +1103,7 @@ void do_text(Context ctx, int x, int y, char *text, int len,
assert(len <= 1024); assert(len <= 1024);
SetPort(GetWindowPort(s->window)); SetPort((GrafPtr)GetWindowPort(s->window));
fontwidth = s->font_width; fontwidth = s->font_width;
if ((lattr & LATTR_MODE) != LATTR_NORM) if ((lattr & LATTR_MODE) != LATTR_NORM)
@ -1171,7 +1171,7 @@ void do_text(Context ctx, int x, int y, char *text, int len,
a.denom = s->font_bigdenom; a.denom = s->font_bigdenom;
break; break;
} }
SetPort(GetWindowPort(s->window)); SetPort((GrafPtr)GetWindowPort(s->window));
TextFont(s->fontnum); TextFont(s->fontnum);
style = s->cfg.font.face; style = s->cfg.font.face;
if ((attr & ATTR_BOLD) && !s->cfg.bold_colour) if ((attr & ATTR_BOLD) && !s->cfg.bold_colour)
@ -1213,7 +1213,7 @@ void do_text(Context ctx, int x, int y, char *text, int len,
static pascal void do_text_for_device(short depth, short devflags, static pascal void do_text_for_device(short depth, short devflags,
GDHandle device, long cookie) { GDHandle device, long cookie) {
struct do_text_args *a; struct do_text_args *a = (struct do_text_args *)cookie;
int bgcolour, fgcolour, bright, reverse, tmp; int bgcolour, fgcolour, bright, reverse, tmp;
#if TARGET_API_MAC_CARBON #if TARGET_API_MAC_CARBON
CQDProcsPtr gp = GetPortGrafProcs(GetWindowPort(a->s->window)); CQDProcsPtr gp = GetPortGrafProcs(GetWindowPort(a->s->window));
@ -1221,8 +1221,6 @@ static pascal void do_text_for_device(short depth, short devflags,
QDProcsPtr gp = a->s->window->grafProcs; QDProcsPtr gp = a->s->window->grafProcs;
#endif #endif
a = (struct do_text_args *)cookie;
bright = (a->attr & ATTR_BOLD) && a->s->cfg.bold_colour; bright = (a->attr & ATTR_BOLD) && a->s->cfg.bold_colour;
reverse = a->attr & ATTR_REVERSE; reverse = a->attr & ATTR_REVERSE;
@ -1321,7 +1319,7 @@ void pre_paint(Session *s) {
if (HAVE_COLOR_QD()) { if (HAVE_COLOR_QD()) {
s->term->attr_mask = 0; s->term->attr_mask = 0;
SetPort(GetWindowPort(s->window)); SetPort((GrafPtr)GetWindowPort(s->window));
#if TARGET_API_MAC_CARBON #if TARGET_API_MAC_CARBON
visrgn = NewRgn(); visrgn = NewRgn();
GetPortVisibleRegion(GetWindowPort(s->window), visrgn); GetPortVisibleRegion(GetWindowPort(s->window), visrgn);
@ -1674,7 +1672,7 @@ void do_scroll(Context ctx, int topline, int botline, int lines) {
RgnHandle update = NewRgn(); RgnHandle update = NewRgn();
Point g2l = { 0, 0 }; Point g2l = { 0, 0 };
SetPort(GetWindowPort(s->window)); SetPort((GrafPtr)GetWindowPort(s->window));
/* /*
* Work out the part of the update region that will scrolled by * Work out the part of the update region that will scrolled by