-/* $Id: mac.c,v 1.1.2.11 1999/03/03 22:03:54 ben Exp $ */
+/* $Id: mac.c,v 1.1.2.14 1999/03/11 21:40:31 ben Exp $ */
/*
* Copyright (c) 1999 Ben Harris
* All rights reserved.
#include <limits.h>
#include <stdarg.h>
#include <stdlib.h> /* putty.h needs size_t */
+#include <stdio.h> /* for vsprintf */
#define PUTTY_DO_GLOBALS
static void mac_newsession(void);
+struct mac_windows {
+ WindowPtr terminal; /* XXX: Temporary */
+ WindowPtr about;
+ WindowPtr licence;
+};
+
+struct mac_windows windows;
+
int main (int argc, char **argv) {
mac_startup();
mac_adjustmenus();
DrawMenuBar();
InitCursor();
+ windows.terminal = NULL;
+ windows.about = NULL;
+ windows.licence = NULL;
}
static void mac_eventloop(void) {
static void mac_activatewindow(WindowPtr window, Boolean active) {
+ mac_adjustmenus();
switch (mac_windowtype(window)) {
case wTerminal:
mac_activateterm(window, active);
*/
static void mac_keypress(EventRecord *event) {
char key;
+ WindowPtr window;
if (event->what == keyDown && (event->modifiers & cmdKey)) {
mac_adjustmenus();
mac_menucommand(MenuKey(event->message & charCodeMask));
- }
+ } else {
+ window = FrontWindow();
+ switch (mac_windowtype(window)) {
+ case wTerminal:
+ mac_keyterm(window, event);
+ break;
+ }
+ }
}
static void mac_menucommand(long result) {
* Make the menus look right before the user gets to see them.
*/
static void mac_adjustmenus(void) {
+ WindowPtr window;
+ MenuHandle menu;
+
+ window = FrontWindow();
+ menu = GetMenuHandle(mApple);
+ EnableItem(menu, 0);
+ EnableItem(menu, iAbout);
+
+ menu = GetMenuHandle(mFile);
+ EnableItem(menu, 0);
+ EnableItem(menu, iNew);
+ EnableItem(menu, iQuit);
+ switch (mac_windowtype(window)) {
+ case wTerminal:
+ mac_adjusttermmenus(window);
+ break;
+ default:
+ menu = GetMenuHandle(mEdit);
+ DisableItem(menu, 0);
+ break;
+ }
+ DrawMenuBar();
}
/*
SetCursor(&qd.arrow);
}
+void write_clip(void *data, int len) {
+
+ /* XXX: do something */
+}
+
+void get_clip(void **p, int *lenp) {
+
+ /* XXX: do something */
+}
+
static void mac_shutdown(void) {
exit(0);
StopAlert(128, nil);
exit(1);
}
+
+/*
+ * Local Variables:
+ * c-file-style: "simon"
+ * End:
+ */