-$Id: README.mac,v 1.20 2003/01/25 17:20:54 ben Exp $
+$Id: README.mac,v 1.21 2003/01/25 19:23:03 ben Exp $
Information about PuTTY for the Mac OS
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
insists on displaying the graphic version, so I think we need a
font switch at this point. This can be seen as a special case of
the need to switch fonts to get odd characters.
+ * Pasting large blocks of text doesn't work.
Unimplemented features (should be done before release):
* TCP urgent data.
* Clipping host resize requests to screen size.
* Changing font size in reponse to resize requests.
* Full screen mode.
- * TEXT paste.
* Catching up with current keyboard mapping in other ports.
* Session configuration.
* Filename abstraction (we want to use alias records).
Wishlist (after release):
* SFTP client (GUI?)
* Carbon compatibility (requires Open Transport and Navigation Services).
- * 'styl' paste, for script codes?
+ * 'styl' paste, for script codes.
* Handle 'gurl' Apple Events.
Local Variables:
-/* $Id: macterm.c,v 1.55 2003/01/25 17:20:54 ben Exp $ */
+/* $Id: macterm.c,v 1.56 2003/01/25 19:23:03 ben Exp $ */
/*
* Copyright (c) 1999 Simon Tatham
* Copyright (c) 1999, 2002 Ben Harris
void get_clip(void *frontend, wchar_t **p, int *lenp) {
Session *s = frontend;
static Handle h = NULL;
+ static wchar_t *data = NULL;
+ Handle texth;
long offset;
+ int textlen;
+ TextEncoding enc;
+ TextToUnicodeInfo scrap_to_uni;
+ ByteCount iread, olen;
+ int charset;
+ char *tptr;
+ OSErr err;
if (p == NULL) {
/* release memory */
if (h != NULL)
DisposeHandle(h);
h = NULL;
- } else
- /* XXX Support TEXT-format scrap as well. */
+ if (data != NULL)
+ sfree(data);
+ data = NULL;
+ } else {
if (GetScrap(NULL, 'utxt', &offset) > 0) {
- h = NewHandle(0);
+ if (h == NULL)
+ h = NewHandle(0);
*lenp = GetScrap(h, 'utxt', &offset) / sizeof(**p);
HLock(h);
*p = (wchar_t *)*h;
- if (*p == NULL || *lenp <= 0)
- fatalbox("Empty scrap");
+ } else if (GetScrap(NULL, 'TEXT', &offset) > 0) {
+ texth = NewHandle(0);
+ textlen = GetScrap(texth, 'TEXT', &offset);
+ HLock(texth);
+ data = smalloc(textlen * 2);
+ /* XXX should use 'styl' scrap if it's there. */
+ if (mac_gestalts.encvvers != 0 &&
+ UpgradeScriptInfoToTextEncoding(smSystemScript,
+ kTextLanguageDontCare,
+ kTextRegionDontCare, NULL,
+ &enc) == noErr &&
+ CreateTextToUnicodeInfoByEncoding(enc, &scrap_to_uni) ==
+ noErr) {
+ err = ConvertFromTextToUnicode(scrap_to_uni, textlen,
+ *texth, 0, 0, NULL, NULL, NULL,
+ textlen * 2,
+ &iread, &olen, data);
+ DisposeTextToUnicodeInfo(&scrap_to_uni);
+ if (err == noErr) {
+ *p = data;
+ *lenp = olen / sizeof(**p);
+ } else {
+ *p = NULL;
+ *lenp = 0;
+ }
+ } else {
+ charset =
+ charset_from_macenc(GetScriptManagerVariable(smSysScript),
+ GetScriptManagerVariable(smRegionCode),
+ mac_gestalts.sysvers, NULL);
+ if (charset != CS_NONE) {
+ tptr = *texth;
+ *lenp = charset_to_unicode(&tptr, &textlen, data,
+ textlen * 2, charset, NULL,
+ NULL, 0);
+ }
+ *p = data;
+ }
+ DisposeHandle(texth);
} else {
*p = NULL;
*lenp = 0;
}
+ }
}
static pascal void mac_scrolltracker(ControlHandle control, short part) {