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

Backends now seem to work. Pasting still doesn't.

macterm.c now uses UPPs for a few things so that it should work if compiled
natively for the PowerPC.  Not tested it yet though.

[originally from svn r122]
This commit is contained in:
Ben Harris 1999-03-18 00:04:34 +00:00
parent 6b3cebe59a
commit 986977ac9e
2 changed files with 26 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $Id: macterm.c,v 1.1.2.25 1999/03/16 20:27:31 ben Exp $ */ /* $Id: macterm.c,v 1.1.2.26 1999/03/18 00:04:34 ben Exp $ */
/* /*
* Copyright (c) 1999 Ben Harris * Copyright (c) 1999 Ben Harris
* All rights reserved. * All rights reserved.
@ -35,6 +35,7 @@
#include <Gestalt.h> #include <Gestalt.h>
#include <MacMemory.h> #include <MacMemory.h>
#include <MacWindows.h> #include <MacWindows.h>
#include <MixedMode.h>
#include <Palettes.h> #include <Palettes.h>
#include <Quickdraw.h> #include <Quickdraw.h>
#include <QuickdrawText.h> #include <QuickdrawText.h>
@ -86,6 +87,22 @@ static pascal void mac_set_attr_mask(short, short, GDHandle, long);
static int mac_keytrans(struct mac_session *, EventRecord *, unsigned char *); static int mac_keytrans(struct mac_session *, EventRecord *, unsigned char *);
static void text_click(struct mac_session *, EventRecord *); static void text_click(struct mac_session *, EventRecord *);
#ifdef USES_ROUTINE_DESCRIPTORS
static RoutineDescriptor mac_scrolltracker_upp =
BUILD_ROUTINE_DESCRIPTOR(uppControlActionProcInfo,
(ProcPtr)mac_scrolltracker);
static RoutineDescriptor do_text_for_device_upp =
BUILD_ROUTINE_DESCRIPTOR(uppDeviceLoopDrawingProcInfo,
(ProcPtr)do_text_for_device);
static RoutineDescriptor mac_set_attr_mask_upp =
BUILD_ROUTINE_DESCRIPTOR(uppDeviceLoopDrawingProcInfo,
(ProcPtr)mac_set_attr_mask);
#else /* not USES_ROUTINE_DESCRIPTORS */
#define mac_scrolltracker_upp mac_scrolltracker
#define do_text_for_device_upp do_text_for_device
#define mac_set_attr_mask_upp mac_set_attr_mask
#endif /* not USES_ROUTINE_DESCRIPTORS */
/* /*
* Temporary hack till I get the terminal emulator supporting multiple * Temporary hack till I get the terminal emulator supporting multiple
* sessions * sessions
@ -131,7 +148,7 @@ void mac_newsession(void) {
/* This should obviously be initialised by other means */ /* This should obviously be initialised by other means */
mac_loadconfig(&cfg); mac_loadconfig(&cfg);
/* back = &loop_backend; */ back = &loop_backend;
s = smalloc(sizeof(*s)); s = smalloc(sizeof(*s));
memset(s, 0, sizeof(*s)); memset(s, 0, sizeof(*s));
onlysession = s; onlysession = s;
@ -285,7 +302,7 @@ void mac_clickterm(WindowPtr window, EventRecord *event) {
case kControlDownButtonPart: case kControlDownButtonPart:
case kControlPageUpPart: case kControlPageUpPart:
case kControlPageDownPart: case kControlPageDownPart:
TrackControl(control, mouse, mac_scrolltracker); TrackControl(control, mouse, &mac_scrolltracker_upp);
break; break;
} }
} else { } else {
@ -434,10 +451,7 @@ void mac_keyterm(WindowPtr window, EventRecord *event) {
s = (struct mac_session *)GetWRefCon(window); s = (struct mac_session *)GetWRefCon(window);
len = mac_keytrans(s, event, buf); len = mac_keytrans(s, event, buf);
/* XXX: I can't get the loopback backend to link, so we'll do this: */ back->send((char *)buf, len);
/* back->send((char *)buf, len); */
for (i = 0; i < len; i++)
inbuf_putc(buf[i]);
term_out(); term_out();
term_update(); term_update();
} }
@ -687,7 +701,7 @@ void do_text(struct mac_session *s, int x, int y, char *text, int len,
SetFractEnable(FALSE); /* We want characters on pixel boundaries */ SetFractEnable(FALSE); /* We want characters on pixel boundaries */
textrgn = NewRgn(); textrgn = NewRgn();
RectRgn(textrgn, &a.textrect); RectRgn(textrgn, &a.textrect);
DeviceLoop(textrgn, do_text_for_device, (long)&a, 0); DeviceLoop(textrgn, &do_text_for_device_upp, (long)&a, 0);
DisposeRgn(textrgn); DisposeRgn(textrgn);
/* Tell the window manager about it in case this isn't an update */ /* Tell the window manager about it in case this isn't an update */
ValidRect(&a.textrect); ValidRect(&a.textrect);
@ -766,7 +780,7 @@ struct mac_session *get_ctx(void) {
struct mac_session *s = onlysession; struct mac_session *s = onlysession;
attr_mask = ATTR_INVALID; attr_mask = ATTR_INVALID;
DeviceLoop(s->window->visRgn, mac_set_attr_mask, (long)s, 0); DeviceLoop(s->window->visRgn, &mac_set_attr_mask_upp, (long)s, 0);
return s; return s;
} }

View File

@ -1,4 +1,4 @@
/* $Id: testback.c,v 1.1.2.1 1999/03/07 23:23:38 ben Exp $ */ /* $Id: testback.c,v 1.1.2.2 1999/03/18 00:04:34 ben Exp $ */
/* /*
* Copyright (c) 1999 Simon Tatham * Copyright (c) 1999 Simon Tatham
* Copyright (c) 1999 Ben Harris * Copyright (c) 1999 Ben Harris
@ -35,7 +35,7 @@
static char *null_init(char *, int, char **); static char *null_init(char *, int, char **);
static int null_msg(void); static int null_msg(void);
static void null_send(char *, int); static void null_send(char *, int);
static void loop_send(*char *, int); static void loop_send(char *, int);
static void null_size(void); static void null_size(void);
static void null_special(Telnet_Special); static void null_special(Telnet_Special);
@ -61,7 +61,7 @@ static void null_send(char *buf, int len) {
} }
static void lo_send (char *buf, int len) { static void loop_send (char *buf, int len) {
while (len--) { while (len--) {
int new_head = (inbuf_head + 1) & INBUF_MASK; int new_head = (inbuf_head + 1) & INBUF_MASK;
int c = (unsigned char) *buf; int c = (unsigned char) *buf;