Skip to content
This repository was archived by the owner on Feb 5, 2025. It is now read-only.

MacOSX updates and Xcode project file #2

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
xcuserdata
build
4,018 changes: 4,018 additions & 0 deletions charset/sbcsdat.c

Large diffs are not rendered by default.

656 changes: 656 additions & 0 deletions macosx/PuTTY.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 20 additions & 2 deletions macosx/info.plist
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDocumentTypes</key>
<array/>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>PuTTY.icns</string>
<string>putty.icns</string>
<key>CFBundleIdentifier</key>
<string>albertzeyer.PuTTY</string>
<key>CFBundleShortVersionString</key>
<string>1</string>
<key>CFBundleURLTypes</key>
<array/>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSServices</key>
<array/>
<key>UTExportedTypeDeclarations</key>
<array/>
<key>UTImportedTypeDeclarations</key>
<array/>
</dict>
</plist>
14 changes: 7 additions & 7 deletions macosx/osxclass.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
}
- (void)newSessionConfig:(id)sender;
- (void)newTerminal:(id)sender;
- (void)newSessionWithConfig:(id)cfg;
- (void)newSessionWithConfig:(NSValue*)cfg;
- (void)setTimer:(long)next;
@end
extern AppController *controller;
Expand All @@ -43,7 +43,7 @@ struct alert_queue {
TerminalView *termview;
struct unicode_data ucsdata;
void *logctx;
Config cfg;
Conf* cfg;
void *ldisc;
Backend *back;
void *backhandle;
Expand All @@ -57,10 +57,10 @@ struct alert_queue {
/* This queues future alerts that need to be shown. */
struct alert_queue *alert_qhead, *alert_qtail;
}
- (id)initWithConfig:(Config)cfg;
- (id)initWithConfig:(Conf*)cfg;
- (void)drawStartFinish:(BOOL)start;
- (void)setColour:(int)n r:(float)r g:(float)g b:(float)b;
- (Config *)cfg;
- (Conf *)cfg;
- (void)doText:(wchar_t *)text len:(int)len x:(int)x y:(int)y
attr:(unsigned long)attr lattr:(int)lattr;
- (int)fromBackend:(const char *)data len:(int)len isStderr:(int)is_stderr;
Expand All @@ -83,9 +83,9 @@ struct alert_queue {
NSOutlineView *treeview;
struct controlbox *ctrlbox;
void *dv;
Config cfg;
Conf* cfg;
}
- (id)initWithConfig:(Config)cfg;
- (id)initWithConfig:(Conf*)cfg;
@end

/*
Expand All @@ -96,7 +96,7 @@ struct alert_queue {
#define HSPACING 12 /* needed in osxdlg.m and osxctrls.m */
#define VSPACING 8

void *fe_dlg_init(void *data, NSWindow *window, NSObject *target, SEL action);
void *fe_dlg_init(Conf *data, NSWindow *window, NSObject *target, SEL action);
void fe_dlg_free(void *dv);
void create_ctrls(void *dv, NSView *parent, struct controlset *s,
int *minw, int *minh);
Expand Down
15 changes: 9 additions & 6 deletions macosx/osxctrls.m
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ - (id)tableView:(NSTableView *)aTableView
tree234 *byctrl;
tree234 *bywidget;
tree234 *boxes;
void *data; /* passed to portable side */
Conf *data; /* passed to portable side */
Receiver *rec;
};

Expand Down Expand Up @@ -394,7 +394,7 @@ static void add_widget(struct fe_dlg *d, struct fe_ctrl *c, id widget)
return b ? b->c : NULL;
}

void *fe_dlg_init(void *data, NSWindow *window, NSObject *target, SEL action)
void *fe_dlg_init(Conf *data, NSWindow *window, NSObject *target, SEL action)
{
struct fe_dlg *d;

Expand Down Expand Up @@ -698,8 +698,11 @@ void create_ctrls(void *dv, NSView *parent, struct controlset *s,
[tf setSelectable:NO];
[tf setBordered:NO];
[tf setDrawsBackground:NO];
[tf setStringValue:[NSString
stringWithCString:ctrl->generic.label]];
if(ctrl->generic.label)
[tf setStringValue:[NSString stringWithCString:ctrl->generic.label]];
else
// WARNING: is this valid?
[tf setStringValue:@"?unnamed?"];
[tf sizeToFit];
rect = [tf frame];
[parent addSubview:tf];
Expand Down Expand Up @@ -1564,7 +1567,7 @@ void dlg_editbox_set(union control *ctrl, void *dv, char const *text)
}
}

void dlg_editbox_get(union control *ctrl, void *dv, char *buffer, int length)
char* dlg_editbox_get(union control *ctrl, void *dv)
{
struct fe_dlg *d = (struct fe_dlg *)dv;
struct fe_ctrl *c = fe_ctrl_byctrl(d, ctrl);
Expand All @@ -1580,7 +1583,7 @@ void dlg_editbox_get(union control *ctrl, void *dv, char *buffer, int length)
str = @"";

/* The length parameter to this method doesn't include a trailing NUL */
[str getCString:buffer maxLength:length-1];
return strdup([str UTF8String]);
}

void dlg_listbox_clear(union control *ctrl, void *dv)
Expand Down
10 changes: 5 additions & 5 deletions macosx/osxdlg.m
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ - (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTabl
@end

@implementation ConfigWindow
- (id)initWithConfig:(Config)aCfg
- (id)initWithConfig:(Conf*)aCfg
{
NSScrollView *scrollview;
NSTableColumn *col;
Expand All @@ -124,9 +124,9 @@ - (id)initWithConfig:(Config)aCfg
int panelht = 0;

ctrlbox = ctrl_new_box();
setup_config_box(ctrlbox, FALSE /*midsession*/, aCfg.protocol,
setup_config_box(ctrlbox, FALSE /*midsession*/, conf_get_int(aCfg, CONF_protocol),
0 /* protcfginfo */);
unix_setup_config_box(ctrlbox, FALSE /*midsession*/, aCfg.protocol);
unix_setup_config_box(ctrlbox, FALSE /*midsession*/, conf_get_int(aCfg, CONF_protocol));

cfg = aCfg; /* structure copy */

Expand All @@ -139,7 +139,7 @@ - (id)initWithConfig:(Config)aCfg

[self setIgnoresMouseEvents:NO];

dv = fe_dlg_init(&cfg, self, self, @selector(configBoxFinished:));
dv = fe_dlg_init(cfg, self, self, @selector(configBoxFinished:));

scrollview = [[NSScrollView alloc] initWithFrame:NSMakeRect(20,20,10,10)];
treeview = [[NSOutlineView alloc] initWithFrame:[scrollview frame]];
Expand Down Expand Up @@ -283,7 +283,7 @@ - (void)configBoxFinished:(id)object
if (ret) {
[controller performSelectorOnMainThread:
@selector(newSessionWithConfig:)
withObject:[NSData dataWithBytes:&cfg length:sizeof(cfg)]
withObject:[NSValue value:&cfg withObjCType:@encode(Conf*)]
waitUntilDone:NO];
}
[self close];
Expand Down
18 changes: 7 additions & 11 deletions macosx/osxmain.m
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,11 @@ - (id)init
- (void)newTerminal:(id)sender
{
id win;
Config cfg;
Conf* cfg = conf_new();

do_defaults(NULL, &cfg);
do_defaults(NULL, cfg);

cfg.protocol = -1; /* PROT_TERMINAL */
conf_set_int(cfg, CONF_protocol, default_protocol); /* Note: was -1 (PROT_TERMINAL) before */

win = [[SessionWindow alloc] initWithConfig:cfg];
[win makeKeyAndOrderFront:self];
Expand All @@ -248,22 +248,18 @@ - (void)newTerminal:(id)sender
- (void)newSessionConfig:(id)sender
{
id win;
Config cfg;
Conf* cfg = conf_new();

do_defaults(NULL, &cfg);
do_defaults(NULL, cfg);

win = [[ConfigWindow alloc] initWithConfig:cfg];
[win makeKeyAndOrderFront:self];
}

- (void)newSessionWithConfig:(id)vdata
- (void)newSessionWithConfig:(NSValue*)vdata
{
id win;
Config cfg;
NSData *data = (NSData *)vdata;

assert([data length] == sizeof(cfg));
[data getBytes:&cfg];
Conf* cfg = [vdata pointerValue];

win = [[SessionWindow alloc] initWithConfig:cfg];
[win makeKeyAndOrderFront:self];
Expand Down
Loading