projects
/
u
/
mdw
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove another `please pester ssh.com for their agent protocol' bit.
[u/mdw/putty]
/
mac
/
macterm.c
diff --git
a/mac/macterm.c
b/mac/macterm.c
index
51ecb09
..
fbf9412
100644
(file)
--- a/
mac/macterm.c
+++ b/
mac/macterm.c
@@
-1,4
+1,4
@@
-/* $Id: macterm.c,v 1.6
6 2003/02/04 02:03:53
ben Exp $ */
+/* $Id: macterm.c,v 1.6
9 2003/02/07 01:38:12
ben Exp $ */
/*
* Copyright (c) 1999 Simon Tatham
* Copyright (c) 1999, 2002 Ben Harris
/*
* Copyright (c) 1999 Simon Tatham
* Copyright (c) 1999, 2002 Ben Harris
@@
-98,6
+98,7
@@
void mac_startsession(Session *s)
{
char *errmsg;
int i;
{
char *errmsg;
int i;
+ WinInfo *wi;
init_ucs(s);
init_ucs(s);
@@
-119,7
+120,10
@@
void mac_startsession(Session *s)
s->window = GetNewCWindow(wTerminal, NULL, (WindowPtr)-1);
else
s->window = GetNewWindow(wTerminal, NULL, (WindowPtr)-1);
s->window = GetNewCWindow(wTerminal, NULL, (WindowPtr)-1);
else
s->window = GetNewWindow(wTerminal, NULL, (WindowPtr)-1);
- SetWRefCon(s->window, (long)s);
+ wi = smalloc(sizeof(*wi));
+ wi->s = s;
+ wi->wtype = wTerminal;
+ SetWRefCon(s->window, (long)wi);
s->scrollbar = GetNewControl(cVScroll, s->window);
s->term = term_init(&s->cfg, &s->ucsdata, s);
s->scrollbar = GetNewControl(cVScroll, s->window);
s->term = term_init(&s->cfg, &s->ucsdata, s);
@@
-131,7
+135,7
@@
void mac_startsession(Session *s)
ActivatePalette(s->window);
}
ActivatePalette(s->window);
}
- s->logctx = log_init(s, &s->cfg);
+ s->logctx = log_init(s
->term
, &s->cfg);
term_provide_logctx(s->term, s->logctx);
errmsg = s->back->init(s->term, &s->backhandle, &s->cfg, s->cfg.host,
term_provide_logctx(s->term, s->logctx);
errmsg = s->back->init(s->term, &s->backhandle, &s->cfg, s->cfg.host,
@@
-385,7
+389,7
@@
void mac_adjusttermcursor(WindowPtr window, Point mouse, RgnHandle cursrgn) {
#endif
SetPort((GrafPtr)GetWindowPort(window));
#endif
SetPort((GrafPtr)GetWindowPort(window));
- s =
(Session *)GetWRefC
on(window);
+ s =
mac_windowsessi
on(window);
GlobalToLocal(&mouse);
part = FindControl(mouse, window, &control);
if (control == s->scrollbar) {
GlobalToLocal(&mouse);
part = FindControl(mouse, window, &control);
if (control == s->scrollbar) {
@@
-435,7
+439,7
@@
void mac_adjusttermmenus(WindowPtr window) {
long offset;
#endif
long offset;
#endif
- s =
(Session *)GetWRefC
on(window);
+ s =
mac_windowsessi
on(window);
menu = GetMenuHandle(mFile);
DisableItem(menu, iSave); /* XXX enable if modified */
EnableItem(menu, iSaveAs);
menu = GetMenuHandle(mFile);
DisableItem(menu, iSave); /* XXX enable if modified */
EnableItem(menu, iSaveAs);
@@
-451,19
+455,22
@@
void mac_adjusttermmenus(WindowPtr window) {
#if TARGET_API_MAC_CARBON
if (1)
#else
#if TARGET_API_MAC_CARBON
if (1)
#else
- if (GetScrap(NULL,
'TEXT'
, &offset) == noTypeErr)
+ if (GetScrap(NULL,
kScrapFlavorTypeText
, &offset) == noTypeErr)
#endif
DisableItem(menu, iPaste);
else
EnableItem(menu, iPaste);
DisableItem(menu, iClear);
EnableItem(menu, iSelectAll);
#endif
DisableItem(menu, iPaste);
else
EnableItem(menu, iPaste);
DisableItem(menu, iClear);
EnableItem(menu, iSelectAll);
+ menu = GetMenuHandle(mWindow);
+ EnableItem(menu, 0);
+ EnableItem(menu, iShowEventLog);
}
void mac_menuterm(WindowPtr window, short menu, short item) {
Session *s;
}
void mac_menuterm(WindowPtr window, short menu, short item) {
Session *s;
- s =
(Session *)GetWRefC
on(window);
+ s =
mac_windowsessi
on(window);
switch (menu) {
case mEdit:
switch (item) {
switch (menu) {
case mEdit:
switch (item) {
@@
-474,6
+481,14
@@
void mac_menuterm(WindowPtr window, short menu, short item) {
term_do_paste(s->term);
break;
}
term_do_paste(s->term);
break;
}
+ break;
+ case mWindow:
+ switch(item) {
+ case iShowEventLog:
+ mac_showeventlog(s);
+ break;
+ }
+ break;
}
}
}
}
@@
-484,7
+499,7
@@
void mac_clickterm(WindowPtr window, EventRecord *event) {
int part;
static ControlActionUPP mac_scrolltracker_upp = NULL;
int part;
static ControlActionUPP mac_scrolltracker_upp = NULL;
- s =
(Session *)GetWRefC
on(window);
+ s =
mac_windowsessi
on(window);
SetPort((GrafPtr)GetWindowPort(window));
mouse = event->where;
GlobalToLocal(&mouse);
SetPort((GrafPtr)GetWindowPort(window));
mouse = event->where;
GlobalToLocal(&mouse);
@@
-579,7
+594,7
@@
void write_clip(void *cookie, wchar_t *data, int len, int must_deselect)
*/
if (ZeroScrap() != noErr)
return;
*/
if (ZeroScrap() != noErr)
return;
- PutScrap(len * sizeof(*data),
'utxt'
, data);
+ PutScrap(len * sizeof(*data),
kScrapFlavorTypeUnicode
, data);
/* Replace LINE SEPARATORs with CR for TEXT output. */
for (i = 0; i < len; i++)
/* Replace LINE SEPARATORs with CR for TEXT output. */
for (i = 0; i < len; i++)
@@
-601,7
+616,7
@@
void write_clip(void *cookie, wchar_t *data, int len, int must_deselect)
s->font_charset, NULL, ".", 1);
} else
return;
s->font_charset, NULL, ".", 1);
} else
return;
- PutScrap(olen,
'TEXT'
, mactextbuf);
+ PutScrap(olen,
kScrapFlavorTypeText
, mactextbuf);
sfree(mactextbuf);
stsz = offsetof(StScrpRec, scrpStyleTab) + sizeof(ScrpSTElement);
sfree(mactextbuf);
stsz = offsetof(StScrpRec, scrpStyleTab) + sizeof(ScrpSTElement);
@@
-616,7
+631,7
@@
void write_clip(void *cookie, wchar_t *data, int len, int must_deselect)
stsc->scrpStyleTab[0].scrpColor.red = 0;
stsc->scrpStyleTab[0].scrpColor.green = 0;
stsc->scrpStyleTab[0].scrpColor.blue = 0;
stsc->scrpStyleTab[0].scrpColor.red = 0;
stsc->scrpStyleTab[0].scrpColor.green = 0;
stsc->scrpStyleTab[0].scrpColor.blue = 0;
- PutScrap(stsz,
'styl'
, stsc);
+ PutScrap(stsz,
kScrapFlavorTypeTextStyle
, stsc);
sfree(stsc);
#endif
}
sfree(stsc);
#endif
}
@@
-647,15
+662,16
@@
void get_clip(void *frontend, wchar_t **p, int *lenp) {
sfree(data);
data = NULL;
} else {
sfree(data);
data = NULL;
} else {
- if (GetScrap(NULL,
'utxt'
, &offset) > 0) {
+ if (GetScrap(NULL,
kScrapFlavorTypeUnicode
, &offset) > 0) {
if (h == NULL)
h = NewHandle(0);
if (h == NULL)
h = NewHandle(0);
- *lenp = GetScrap(h, 'utxt', &offset) / sizeof(**p);
+ *lenp =
+ GetScrap(h, kScrapFlavorTypeUnicode, &offset) / sizeof(**p);
HLock(h);
*p = (wchar_t *)*h;
HLock(h);
*p = (wchar_t *)*h;
- } else if (GetScrap(NULL,
'TEXT'
, &offset) > 0) {
+ } else if (GetScrap(NULL,
kScrapFlavorTypeText
, &offset) > 0) {
texth = NewHandle(0);
texth = NewHandle(0);
- textlen = GetScrap(texth,
'TEXT'
, &offset);
+ textlen = GetScrap(texth,
kScrapFlavorTypeText
, &offset);
HLock(texth);
data = smalloc(textlen * 2);
/* XXX should use 'styl' scrap if it's there. */
HLock(texth);
data = smalloc(textlen * 2);
/* XXX should use 'styl' scrap if it's there. */
@@
-704,9
+720,9
@@
static pascal void mac_scrolltracker(ControlHandle control, short part) {
Session *s;
#if TARGET_API_MAC_CARBON
Session *s;
#if TARGET_API_MAC_CARBON
- s =
(Session *)GetWRefC
on(GetControlOwner(control));
+ s =
mac_windowsessi
on(GetControlOwner(control));
#else
#else
- s =
(Session *)GetWRefC
on((*control)->contrlOwner);
+ s =
mac_windowsessi
on((*control)->contrlOwner);
#endif
switch (part) {
case kControlUpButtonPart:
#endif
switch (part) {
case kControlUpButtonPart:
@@
-725,7
+741,7
@@
static pascal void mac_scrolltracker(ControlHandle control, short part) {
}
void mac_keyterm(WindowPtr window, EventRecord *event) {
}
void mac_keyterm(WindowPtr window, EventRecord *event) {
- Session *s =
(Session *)GetWRefC
on(window);
+ Session *s =
mac_windowsessi
on(window);
Key_Sym keysym = PK_NULL;
unsigned int mods = 0, flags = PKF_NUMLOCK;
UniChar utxt[1];
Key_Sym keysym = PK_NULL;
unsigned int mods = 0, flags = PKF_NUMLOCK;
UniChar utxt[1];
@@
-895,7
+911,7
@@
void mac_growterm(WindowPtr window, EventRecord *event) {
FontInfo fi;
#endif
FontInfo fi;
#endif
- s =
(Session *)GetWRefC
on(window);
+ s =
mac_windowsessi
on(window);
#if !TARGET_API_MAC_CARBON
draghooksave = LMGetDragHook();
#if !TARGET_API_MAC_CARBON
draghooksave = LMGetDragHook();
@@
-969,7
+985,7
@@
static pascal void mac_growtermdraghook(void)
void mac_closeterm(WindowPtr window)
{
void mac_closeterm(WindowPtr window)
{
- Session *s =
(Session *)GetWRefC
on(window);
+ Session *s =
mac_windowsessi
on(window);
/* XXX warn on close */
HideWindow(s->window);
/* XXX warn on close */
HideWindow(s->window);
@@
-981,6
+997,8
@@
void mac_closeterm(WindowPtr window)
if (s->uni_to_font != NULL)
DisposeUnicodeToTextInfo(&s->uni_to_font);
term_free(s->term);
if (s->uni_to_font != NULL)
DisposeUnicodeToTextInfo(&s->uni_to_font);
term_free(s->term);
+ mac_freeeventlog(s);
+ sfree((WinInfo *)GetWRefCon(s->window));
DisposeWindow(s->window);
DisposePalette(s->palette);
sfree(s);
DisposeWindow(s->window);
DisposePalette(s->palette);
sfree(s);
@@
-989,7
+1007,7
@@
void mac_closeterm(WindowPtr window)
void mac_activateterm(WindowPtr window, Boolean active) {
Session *s;
void mac_activateterm(WindowPtr window, Boolean active) {
Session *s;
- s =
(Session *)GetWRefC
on(window);
+ s =
mac_windowsessi
on(window);
s->term->has_focus = active;
term_update(s->term);
if (active)
s->term->has_focus = active;
term_update(s->term);
if (active)
@@
-1011,7
+1029,7
@@
void mac_updateterm(WindowPtr window) {
RgnHandle visrgn;
#endif
RgnHandle visrgn;
#endif
- s =
(Session *)GetWRefC
on(window);
+ s =
mac_windowsessi
on(window);
SetPort((GrafPtr)GetWindowPort(window));
BeginUpdate(window);
pre_paint(s);
SetPort((GrafPtr)GetWindowPort(window));
BeginUpdate(window);
pre_paint(s);
@@
-1723,11
+1741,6
@@
void do_scroll(Context ctx, int topline, int botline, int lines) {
DisposeRgn(update);
}
DisposeRgn(update);
}
-void logevent(void *frontend, char *str) {
-
- fprintf(stderr, "%s\n", str);
-}
-
/* Dummy routine, only required in plink. */
void ldisc_update(void *frontend, int echo, int edit)
{
/* Dummy routine, only required in plink. */
void ldisc_update(void *frontend, int echo, int edit)
{