Other ways in which the port is currently unfinished include:
- - terminal display is horribly slow
+Missing terminal window features
+--------------------------------
- - fatal errors are currently output via printf, which is obviously
- wrong for a GUI application
+ - terminal display is horribly slow
- fonts aren't configurable
starting position, plus remembering previous window positions per
the Apple HIG) is not implemented
- - close-on-exit isn't implemented
+Missing alert box features
+--------------------------
- warn-on-close isn't implemented
- - SessionWindow's dealloc method does nothing yet, so leaks memory
+Missing input features
+----------------------
- use of Alt+numberpad to enter arbitrary numeric character codes
is not yet supported
- cut and paste isn't supported
- - there's no Meta key yet. (I think it will have to be Command
- rather than Option since the latter is necessary to send some
- characters, including the rather important # on Apple UK
- keyboards; but trapping Command-<key> and sending it to the
- window rather than the application menu requires me to make a
- positive effort of some sort and I haven't got round to it yet.)
+ - there's no Meta key yet. (I'd like to at least have the
+ possibility of using Command rather than Option as the Meta key,
+ since the latter is necessary to send some characters, including
+ the rather important # on Apple UK keyboards; but trapping
+ Command-<key> and sending it to the window rather than the
+ application menu requires me to make a positive effort of some
+ sort and I haven't got round to it yet. For those Mac users who
+ consider their Command key sacrosanct, don't worry, this option
+ _will_ be configurable and _will_ be off by default.)
- there's no specials menu
+Missing terminal emulation features
+-----------------------------------
+
- currently no support for server-side window management requests
(i.e. escape sequences to minimise or maximise the window,
request or change its position and size, change its title etc)
- window title is currently fixed
+Other missing features
+----------------------
+
+ - SessionWindow's dealloc method does nothing yet, so leaks memory
+
- no Event Log
- no mid-session Change Settings
void *ldisc;
Backend *back;
void *backhandle;
+ int exited;
/*
* The following two members relate to the currently active
* alert sheet, if any. They are NULL if there isn't one.
- (int)fromBackend:(const char *)data len:(int)len isStderr:(int)is_stderr;
- (void)startAlert:(NSAlert *)alert
withCallback:(void (*)(void *, int))callback andCtx:(void *)ctx;
+- (void)endSession:(int)clean;
+- (void)notifyRemoteExit;
@end
/*
*/
}
-void about_box(void *window)
+static void connection_fatal_callback(void *ctx, int result)
{
- /* FIXME */
+ SessionWindow *win = (SessionWindow *)ctx;
+
+ [win endSession:FALSE];
+}
+
+void connection_fatal(void *frontend, char *p, ...)
+{
+ SessionWindow *win = (SessionWindow *)frontend;
+ va_list ap;
+ char *msg;
+ NSAlert *alert;
+
+ va_start(ap, p);
+ msg = dupvprintf(p, ap);
+ va_end(ap);
+
+ alert = [[NSAlert alloc] init];
+ [alert setInformativeText:[NSString stringWithCString:msg]];
+ [alert addButtonWithTitle:@"Proceed"];
+ [win startAlert:alert withCallback:connection_fatal_callback
+ andCtx:win];
}
return NULL; /* this is a stub */
}
-void modalfatalbox(char *p, ...)
+static void commonfatalbox(char *p, va_list ap)
+{
+ char errorbuf[2048];
+ NSAlert *alert;
+
+ /*
+ * We may have come here because we ran out of memory, in which
+ * case it's entirely likely that that further memory
+ * allocations will fail. So (a) we use vsnprintf to format the
+ * error message rather than the usual dupvprintf; and (b) we
+ * have a fallback way to get the message out via stderr if
+ * even creating an NSAlert fails.
+ */
+ vsnprintf(errorbuf, lenof(errorbuf), p, ap);
+
+ alert = [NSAlert alloc];
+ if (!alert) {
+ fprintf(stderr, "fatal error (and NSAlert failed): %s\n", errorbuf);
+ } else {
+ alert = [[alert init] autorelease];
+ [alert addButtonWithTitle:@"Terminate"];
+ [alert setInformativeText:[NSString stringWithCString:errorbuf]];
+ [alert runModal];
+ }
+ exit(1);
+}
+
+void fatalbox(char *p, ...)
{
- /* FIXME: proper OS X GUI stuff */
va_list ap;
- fprintf(stderr, "FATAL ERROR: ");
va_start(ap, p);
- vfprintf(stderr, p, ap);
+ commonfatalbox(p, ap);
va_end(ap);
- fputc('\n', stderr);
- exit(1);
}
-void fatalbox(char *p, ...)
+void modalfatalbox(char *p, ...)
{
- /* FIXME: proper OS X GUI stuff */
va_list ap;
- fprintf(stderr, "FATAL ERROR: ");
va_start(ap, p);
- vfprintf(stderr, p, ap);
+ commonfatalbox(p, ap);
va_end(ap);
- fputc('\n', stderr);
- exit(1);
}
void cmdline_error(char *p, ...)
*/
[self center]; /* :-) */
+ exited = FALSE;
+
return self;
}
* Do so.
*/
sfree(alert_ctx);
+ if (term)
+ term_free(term);
+ if (logctx)
+ log_free(logctx);
+ if (back)
+ back->free(backhandle);
+ if (ldisc)
+ ldisc_free(ldisc);
[super dealloc];
}
char coutput[32];
int use_coutput = FALSE, special = FALSE, start, end;
-printf("n=%d c=U+%04x cm=U+%04x m=%08x\n", n, c, cm, m);
+//printf("n=%d c=U+%04x cm=U+%04x m=%08x\n", n, c, cm, m);
/*
* FIXME: Alt+numberpad codes.
}
}
+- (void)notifyRemoteExit
+{
+ int exitcode;
+
+ if (!exited && (exitcode = back->exitcode(backhandle)) >= 0)
+ [self endSession:(exitcode == 0)];
+}
+
+- (void)endSession:(int)clean
+{
+ exited = TRUE;
+ if (ldisc) {
+ ldisc_free(ldisc);
+ ldisc = NULL;
+ }
+ if (back) {
+ back->free(backhandle);
+ backhandle = NULL;
+ back = NULL;
+ //FIXME: update specials menu;
+ }
+ if (cfg.close_on_exit == FORCE_ON ||
+ (cfg.close_on_exit == AUTO && clean))
+ [self close];
+ // FIXME: else show restart menu item
+}
+
@end
int from_backend(void *frontend, int is_stderr, const char *data, int len)
/* FIXME */
}
-void connection_fatal(void *frontend, char *p, ...)
-{
- //SessionWindow *win = (SessionWindow *)frontend;
- /* FIXME: proper OS X GUI stuff */
- va_list ap;
- fprintf(stderr, "FATAL ERROR: ");
- va_start(ap, p);
- vfprintf(stderr, p, ap);
- va_end(ap);
- fputc('\n', stderr);
- exit(1);
-}
-
void notify_remote_exit(void *frontend)
{
- //SessionWindow *win = (SessionWindow *)frontend;
- /* FIXME */
+ SessionWindow *win = (SessionWindow *)frontend;
+
+ [win notifyRemoteExit];
}
void ldisc_update(void *frontend, int echo, int edit)