2 * osxwin.m: code to manage a session window in Mac OS X PuTTY.
5 #import <Cocoa/Cocoa.h>
10 /* Colours come in two flavours: configurable, and xterm-extended. */
11 #define NCFGCOLOURS (lenof(((Config *)0)->colours))
12 #define NEXTCOLOURS 240 /* 216 colour-cube plus 24 shades of grey */
13 #define NALLCOLOURS (NCFGCOLOURS + NEXTCOLOURS)
16 * The key component of the per-session data is the SessionWindow
17 * class. A pointer to this is used as the frontend handle, to be
18 * passed to all the platform-independent subsystems that require
22 @interface TerminalView : NSImageView
28 NSColor *colours[NALLCOLOURS];
29 float fw, fasc, fdesc, fh;
31 - (void)drawStartFinish:(BOOL)start;
32 - (void)setColour:(int)n r:(float)r g:(float)g b:(float)b;
33 - (void)doText:(wchar_t *)text len:(int)len x:(int)x y:(int)y
34 attr:(unsigned long)attr lattr:(int)lattr;
37 @implementation TerminalView
42 - (id)initWithTerminal:(Terminal *)aTerm config:(Config)aCfg
46 self = [self initWithFrame:NSMakeRect(0,0,100,100)];
52 * Initialise the fonts we're going to use.
54 * FIXME: for the moment I'm sticking with exactly one default font.
56 font = [NSFont userFixedPitchFontOfSize:0];
59 * Now determine the size of the primary font.
61 * FIXME: If we have multiple fonts, we may need to set fasc
62 * and fdesc to the _maximum_ asc and desc out of all the
63 * fonts, _before_ adding them together to get fh.
65 fw = [font widthOfString:@"A"];
66 fasc = [font ascender];
67 fdesc = -[font descender];
69 fh = (int)fh + (fh > (int)fh); /* round up, ickily */
72 * Use this to figure out the size of the terminal view.
78 * And set our size and subimage.
80 image = [[NSImage alloc] initWithSize:NSMakeSize(w,h)];
81 [image setFlipped:YES];
82 [self setImage:image];
83 [self setFrame:NSMakeRect(0,0,w,h)];
85 term_invalidate(term);
89 - (void)drawStartFinish:(BOOL)start
96 - (void)doText:(wchar_t *)text len:(int)len x:(int)x y:(int)y
97 attr:(unsigned long)attr lattr:(int)lattr
99 int nfg, nbg, rlen, widefactor;
100 float ox, oy, tw, th;
101 NSDictionary *attrdict;
103 /* FIXME: TATTR_COMBINING */
105 nfg = ((attr & ATTR_FGMASK) >> ATTR_FGSHIFT);
106 nbg = ((attr & ATTR_BGMASK) >> ATTR_BGSHIFT);
107 if (attr & ATTR_REVERSE) {
112 if (cfg.bold_colour && (attr & ATTR_BOLD)) {
113 if (nfg < 16) nfg |= 8;
114 else if (nfg >= 256) nfg |= 1;
116 if (cfg.bold_colour && (attr & ATTR_BLINK)) {
117 if (nbg < 16) nbg |= 8;
118 else if (nbg >= 256) nbg |= 1;
120 if (attr & TATTR_ACTCURS) {
125 if (attr & ATTR_WIDE) {
127 /* FIXME: what do we actually have to do about wide characters? */
132 /* FIXME: ATTR_BOLD without cfg.bold_colour */
134 if ((lattr & LATTR_MODE) != LATTR_NORM) {
138 if (x + len*2*widefactor > term->cols)
139 len = (term->cols-x)/2/widefactor;/* trim to LH half */
144 /* FIXME: how do we actually implement double-{width,height} lattrs? */
148 tw = rlen * widefactor * fw;
152 * Set the clipping rectangle.
154 [[NSGraphicsContext currentContext] saveGraphicsState];
155 [NSBezierPath clipRect:NSMakeRect(ox, oy, tw, th)];
157 attrdict = [NSDictionary dictionaryWithObjectsAndKeys:
158 colours[nfg], NSForegroundColorAttributeName,
159 colours[nbg], NSBackgroundColorAttributeName,
160 font, NSFontAttributeName, nil];
163 * Create an NSString and draw it.
165 * Annoyingly, although our input is wchar_t which is four
166 * bytes wide on OS X and terminal.c supports 32-bit Unicode,
167 * we must convert into the two-byte type `unichar' to store in
168 * NSString, so we lose display capability for extra-BMP stuff
176 utext = snewn(len, unichar);
177 for (i = 0; i < len; i++)
178 utext[i] = (text[i] >= 0x10000 ? 0xFFFD : text[i]);
180 string = [NSString stringWithCharacters:utext length:len];
181 [string drawAtPoint:NSMakePoint(ox, oy) withAttributes:attrdict];
187 * Restore the graphics state from before the clipRect: call.
189 [[NSGraphicsContext currentContext] restoreGraphicsState];
192 * And flag this area as needing display.
194 [self setNeedsDisplayInRect:NSMakeRect(ox, oy, tw, th)];
197 - (void)setColour:(int)n r:(float)r g:(float)g b:(float)b
199 assert(n >= 0 && n < lenof(colours));
200 colours[n] = [[NSColor colorWithDeviceRed:r green:g blue:b alpha:1.0]
205 @implementation SessionWindow
206 - (id)initWithConfig:(Config)aCfg
208 NSRect rect = { {0,0}, {0,0} };
212 cfg = aCfg; /* structure copy */
214 init_ucs(&ucsdata, cfg.line_codepage, cfg.utf8_override,
215 CS_UTF8, cfg.vtmode);
216 term = term_init(&cfg, &ucsdata, self);
217 logctx = log_init(self, &cfg);
218 term_provide_logctx(term, logctx);
219 term_size(term, cfg.height, cfg.width, cfg.savelines);
221 termview = [[[TerminalView alloc] initWithTerminal:term config:cfg]
225 * Now work out the size of the window.
227 rect = [termview frame];
228 rect.origin = NSMakePoint(0,0);
229 rect.size.width += 2 * cfg.window_border;
230 rect.size.height += 2 * cfg.window_border;
238 for (i = 0; backends[i].backend != NULL; i++)
239 if (backends[i].protocol == cfg.protocol) {
240 back = backends[i].backend;
247 char *realhost = NULL;
248 error = back->init(self, &backhandle, &cfg, cfg.host, cfg.port,
249 &realhost, cfg.tcp_nodelay, cfg.tcp_keepalives);
251 fatalbox("%s\n", error); /* FIXME: connection_fatal at worst */
255 sfree(realhost); /* FIXME: do something with this */
259 * Create a line discipline. (This must be done after creating
260 * the terminal _and_ the backend, since it needs to be passed
263 ldisc = ldisc_create(&cfg, term, back, backhandle, self);
266 * FIXME: Set up a scrollbar.
269 self = [super initWithContentRect:rect
270 styleMask:(NSTitledWindowMask | NSMiniaturizableWindowMask |
271 NSClosableWindowMask)
272 backing:NSBackingStoreBuffered
274 [self setTitle:@"PuTTY"];
276 [self setIgnoresMouseEvents:NO];
279 * Put the terminal view in the window.
281 rect = [termview frame];
282 rect.origin = NSMakePoint(cfg.window_border, cfg.window_border);
283 [termview setFrame:rect];
284 [[self contentView] addSubview:termview];
287 * Set up the colour palette.
292 * FIXME: Only the _first_ document window should be centred.
293 * The subsequent ones should appear down and to the right of
294 * it, probably using the cascade function provided by Cocoa.
295 * Also we're apparently required by the HIG to remember and
296 * reuse previous positions of windows, although I'm not sure
297 * how that works if the user opens more than one of the same
300 [self center]; /* :-) */
308 * FIXME: Here we must deallocate all sorts of stuff: the
309 * terminal, the backend, the ldisc, the logctx, you name it.
316 - (void)drawStartFinish:(BOOL)start
318 [termview drawStartFinish:start];
321 - (void)setColour:(int)n r:(float)r g:(float)g b:(float)b
323 [termview setColour:n r:r g:g b:b];
326 - (void)doText:(wchar_t *)text len:(int)len x:(int)x y:(int)y
327 attr:(unsigned long)attr lattr:(int)lattr
329 /* Pass this straight on to the TerminalView. */
330 [termview doText:text len:len x:x y:y attr:attr lattr:lattr];
338 - (void)keyDown:(NSEvent *)ev
340 NSString *s = [ev characters];
342 int n = [s length], c = [s characterAtIndex:0], m = [ev modifierFlags];
343 int cm = [[ev charactersIgnoringModifiers] characterAtIndex:0];
346 int use_coutput = FALSE, special = FALSE, start, end;
348 printf("n=%d c=U+%04x cm=U+%04x m=%08x\n", n, c, cm, m);
351 * FIXME: Alt+numberpad codes.
355 * Shift and Ctrl with PageUp/PageDown for scrollback.
357 if (n == 1 && c == NSPageUpFunctionKey && (m & NSShiftKeyMask)) {
358 term_scroll(term, 0, -term->rows/2);
361 if (n == 1 && c == NSPageUpFunctionKey && (m & NSControlKeyMask)) {
362 term_scroll(term, 0, -1);
365 if (n == 1 && c == NSPageDownFunctionKey && (m & NSShiftKeyMask)) {
366 term_scroll(term, 0, +term->rows/2);
369 if (n == 1 && c == NSPageDownFunctionKey && (m & NSControlKeyMask)) {
370 term_scroll(term, 0, +1);
375 * FIXME: Shift-Ins for paste? Or is that not Maccy enough?
379 * FIXME: Alt (Option? Command?) prefix in general.
381 * (Note that Alt-Shift-thing will work just by looking at
382 * charactersIgnoringModifiers; but Alt-Ctrl-thing will need
383 * processing properly, and Alt-as-in-Option won't happen at
386 * (Note also that we need to be able to override menu key
387 * equivalents before this is particularly useful.)
393 * Ctrl-` is the same as Ctrl-\, unless we already have a
396 if ((m & NSControlKeyMask) && n == 1 && cm == '`' && c == '`') {
401 /* We handle Return ourselves, because it needs to be flagged as
402 * special to ldisc. */
403 if (n == 1 && c == '\015') {
410 /* Control-Shift-Space is 160 (ISO8859 nonbreaking space) */
411 if (n == 1 && (m & NSControlKeyMask) && (m & NSShiftKeyMask) &&
417 /* Control-2, Control-Space and Control-@ are all NUL. */
418 if ((m & NSControlKeyMask) && n == 1 &&
419 (cm == '2' || cm == '@' || cm == ' ') && c == cm) {
424 /* We don't let MacOS tell us what Backspace is! We know better. */
425 if (cm == 0x7F && !(m & NSShiftKeyMask)) {
426 coutput[1] = cfg.bksp_is_delete ? '\x7F' : '\x08';
428 use_coutput = special = TRUE;
430 /* For Shift Backspace, do opposite of what is configured. */
431 if (cm == 0x7F && (m & NSShiftKeyMask)) {
432 coutput[1] = cfg.bksp_is_delete ? '\x08' : '\x7F';
434 use_coutput = special = TRUE;
437 /* Shift-Tab is ESC [ Z. Oddly, this combination generates ^Y by
438 * default on MacOS! */
439 if (cm == 0x19 && (m & NSShiftKeyMask) && !(m & NSControlKeyMask)) {
441 output[end++] = '\033';
447 * NetHack keypad mode.
449 if (cfg.nethack_keypad && (m & NSNumericPadKeyMask)) {
450 wchar_t *keys = NULL;
452 case '1': keys = L"bB"; break;
453 case '2': keys = L"jJ"; break;
454 case '3': keys = L"nN"; break;
455 case '4': keys = L"hH"; break;
456 case '5': keys = L".."; break;
457 case '6': keys = L"lL"; break;
458 case '7': keys = L"yY"; break;
459 case '8': keys = L"kK"; break;
460 case '9': keys = L"uU"; break;
464 if (m & NSShiftKeyMask)
473 * Application keypad mode.
475 if (term->app_keypad_keys && !cfg.no_applic_k &&
476 (m & NSNumericPadKeyMask)) {
479 case NSClearLineFunctionKey: xkey = 'P'; break;
480 case '=': xkey = 'Q'; break;
481 case '/': xkey = 'R'; break;
482 case '*': xkey = 'S'; break;
484 * FIXME: keypad - and + need to be mapped to ESC O l
485 * and ESC O k, or ESC O l and ESC O m, depending on
486 * xterm function key mode, and I can't remember which
489 case '\003': xkey = 'M'; break;
490 case '0': xkey = 'p'; break;
491 case '1': xkey = 'q'; break;
492 case '2': xkey = 'r'; break;
493 case '3': xkey = 's'; break;
494 case '4': xkey = 't'; break;
495 case '5': xkey = 'u'; break;
496 case '6': xkey = 'v'; break;
497 case '7': xkey = 'w'; break;
498 case '8': xkey = 'x'; break;
499 case '9': xkey = 'y'; break;
500 case '.': xkey = 'n'; break;
503 if (term->vt52_mode) {
504 if (xkey >= 'P' && xkey <= 'S') {
505 output[end++] = '\033';
506 output[end++] = xkey;
508 output[end++] = '\033';
510 output[end++] = xkey;
513 output[end++] = '\033';
515 output[end++] = xkey;
522 * Next, all the keys that do tilde codes. (ESC '[' nn '~',
523 * for integer decimal nn.)
525 * We also deal with the weird ones here. Linux VCs replace F1
526 * to F5 by ESC [ [ A to ESC [ [ E. rxvt doesn't do _that_, but
527 * does replace Home and End (1~ and 4~) by ESC [ H and ESC O w
533 case NSF1FunctionKey:
534 code = (m & NSShiftKeyMask ? 23 : 11);
536 case NSF2FunctionKey:
537 code = (m & NSShiftKeyMask ? 24 : 12);
539 case NSF3FunctionKey:
540 code = (m & NSShiftKeyMask ? 25 : 13);
542 case NSF4FunctionKey:
543 code = (m & NSShiftKeyMask ? 26 : 14);
545 case NSF5FunctionKey:
546 code = (m & NSShiftKeyMask ? 28 : 15);
548 case NSF6FunctionKey:
549 code = (m & NSShiftKeyMask ? 29 : 17);
551 case NSF7FunctionKey:
552 code = (m & NSShiftKeyMask ? 31 : 18);
554 case NSF8FunctionKey:
555 code = (m & NSShiftKeyMask ? 32 : 19);
557 case NSF9FunctionKey:
558 code = (m & NSShiftKeyMask ? 33 : 20);
560 case NSF10FunctionKey:
561 code = (m & NSShiftKeyMask ? 34 : 21);
563 case NSF11FunctionKey:
566 case NSF12FunctionKey:
569 case NSF13FunctionKey:
572 case NSF14FunctionKey:
575 case NSF15FunctionKey:
578 case NSF16FunctionKey:
581 case NSF17FunctionKey:
584 case NSF18FunctionKey:
587 case NSF19FunctionKey:
590 case NSF20FunctionKey:
594 if (!(m & NSControlKeyMask)) switch (cm) {
595 case NSHomeFunctionKey:
599 case GDK_Insert: case GDK_KP_Insert:
603 case NSDeleteFunctionKey:
606 case NSEndFunctionKey:
609 case NSPageUpFunctionKey:
612 case NSPageDownFunctionKey:
616 /* Reorder edit keys to physical order */
617 if (cfg.funky_type == FUNKY_VT400 && code <= 6)
618 code = "\0\2\1\4\5\3\6"[code];
620 if (term->vt52_mode && code > 0 && code <= 6) {
621 output[end++] = '\033';
622 output[end++] = " HLMEIG"[code];
626 if (cfg.funky_type == FUNKY_SCO && /* SCO function keys */
627 code >= 11 && code <= 34) {
628 char codes[] = "MNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz@[\\]^_`{";
631 case NSF1FunctionKey: index = 0; break;
632 case NSF2FunctionKey: index = 1; break;
633 case NSF3FunctionKey: index = 2; break;
634 case NSF4FunctionKey: index = 3; break;
635 case NSF5FunctionKey: index = 4; break;
636 case NSF6FunctionKey: index = 5; break;
637 case NSF7FunctionKey: index = 6; break;
638 case NSF8FunctionKey: index = 7; break;
639 case NSF9FunctionKey: index = 8; break;
640 case NSF10FunctionKey: index = 9; break;
641 case NSF11FunctionKey: index = 10; break;
642 case NSF12FunctionKey: index = 11; break;
644 if (m & NSShiftKeyMask) index += 12;
645 if (m & NSControlKeyMask) index += 24;
646 output[end++] = '\033';
648 output[end++] = codes[index];
651 if (cfg.funky_type == FUNKY_SCO && /* SCO small keypad */
652 code >= 1 && code <= 6) {
653 char codes[] = "HL.FIG";
658 output[end++] = '\033';
660 output[end++] = codes[code-1];
664 if ((term->vt52_mode || cfg.funky_type == FUNKY_VT100P) &&
665 code >= 11 && code <= 24) {
671 if (term->vt52_mode) {
672 output[end++] = '\033';
673 output[end++] = code + 'P' - 11 - offt;
675 output[end++] = '\033';
677 output[end++] = code + 'P' - 11 - offt;
681 if (cfg.funky_type == FUNKY_LINUX && code >= 11 && code <= 15) {
682 output[end++] = '\033';
685 output[end++] = code + 'A' - 11;
688 if (cfg.funky_type == FUNKY_XTERM && code >= 11 && code <= 14) {
689 if (term->vt52_mode) {
690 output[end++] = '\033';
691 output[end++] = code + 'P' - 11;
693 output[end++] = '\033';
695 output[end++] = code + 'P' - 11;
699 if (cfg.rxvt_homeend && (code == 1 || code == 4)) {
701 output[end++] = '\033';
705 output[end++] = '\033';
713 sprintf(buf, "\x1B[%d~", code);
714 for (i = 0; buf[i]; i++)
715 output[end++] = buf[i];
721 * Cursor keys. (This includes the numberpad cursor keys,
722 * if we haven't already done them due to app keypad mode.)
727 case NSUpArrowFunctionKey: xkey = 'A'; break;
728 case NSDownArrowFunctionKey: xkey = 'B'; break;
729 case NSRightArrowFunctionKey: xkey = 'C'; break;
730 case NSLeftArrowFunctionKey: xkey = 'D'; break;
734 * The arrow keys normally do ESC [ A and so on. In
735 * app cursor keys mode they do ESC O A instead.
736 * Ctrl toggles the two modes.
738 if (term->vt52_mode) {
739 output[end++] = '\033';
740 output[end++] = xkey;
741 } else if (!term->app_cursor_keys ^ !(m & NSControlKeyMask)) {
742 output[end++] = '\033';
744 output[end++] = xkey;
746 output[end++] = '\033';
748 output[end++] = xkey;
757 * Failing everything else, send the exact Unicode we got from
761 if (n > lenof(output)-start)
762 n = lenof(output)-start; /* _shouldn't_ happen! */
763 for (i = 0; i < n; i++) {
764 output[i+start] = [s characterAtIndex:i];
771 assert(end < lenof(coutput));
773 ldisc_send(ldisc, coutput+start, -2, TRUE);
775 luni_send(ldisc, output+start, end-start, TRUE);
779 - (int)fromBackend:(const char *)data len:(int)len isStderr:(int)is_stderr
781 return term_data(term, is_stderr, data, len);
784 - (void)startAlert:(NSAlert *)alert
785 withCallback:(void (*)(void *, int))callback andCtx:(void *)ctx
787 alert_callback = callback;
788 alert_ctx = ctx; /* NB this is assumed to need freeing! */
789 [alert beginSheetModalForWindow:self modalDelegate:self
790 didEndSelector:@selector(alertSheetDidEnd:returnCode:contextInfo:)
794 - (void)alertSheetDidEnd:(NSAlert *)alert returnCode:(int)returnCode
795 contextInfo:(void *)contextInfo
797 alert_callback(alert_ctx, returnCode); /* transfers ownership of ctx */
803 int from_backend(void *frontend, int is_stderr, const char *data, int len)
805 SessionWindow *win = (SessionWindow *)frontend;
806 return [win fromBackend:data len:len isStderr:is_stderr];
809 void frontend_keypress(void *handle)
814 void connection_fatal(void *frontend, char *p, ...)
816 //SessionWindow *win = (SessionWindow *)frontend;
817 /* FIXME: proper OS X GUI stuff */
819 fprintf(stderr, "FATAL ERROR: ");
821 vfprintf(stderr, p, ap);
827 void notify_remote_exit(void *frontend)
829 //SessionWindow *win = (SessionWindow *)frontend;
833 void ldisc_update(void *frontend, int echo, int edit)
835 //SessionWindow *win = (SessionWindow *)frontend;
837 * In a GUI front end, this need do nothing.
841 void update_specials_menu(void *frontend)
843 //SessionWindow *win = (SessionWindow *)frontend;
848 * This is still called when mode==BELL_VISUAL, even though the
849 * visual bell is handled entirely within terminal.c, because we
850 * may want to perform additional actions on any kind of bell (for
851 * example, taskbar flashing in Windows).
853 void beep(void *frontend, int mode)
855 //SessionWindow *win = (SessionWindow *)frontend;
856 if (mode != BELL_VISUAL)
860 int char_width(Context ctx, int uc)
863 * Under X, any fixed-width font really _is_ fixed-width.
864 * Double-width characters will be dealt with using a separate
865 * font. For the moment we can simply return 1.
870 void palette_set(void *frontend, int n, int r, int g, int b)
872 SessionWindow *win = (SessionWindow *)frontend;
878 [win setColour:n r:r/255.0 g:g/255.0 b:b/255.0];
881 * FIXME: do we need an OS X equivalent of set_window_background?
885 void palette_reset(void *frontend)
887 SessionWindow *win = (SessionWindow *)frontend;
888 Config *cfg = [win cfg];
890 /* This maps colour indices in cfg to those used in colours[]. */
891 static const int ww[] = {
892 256, 257, 258, 259, 260, 261,
893 0, 8, 1, 9, 2, 10, 3, 11,
894 4, 12, 5, 13, 6, 14, 7, 15
899 for (i = 0; i < NCFGCOLOURS; i++) {
900 [win setColour:ww[i] r:cfg->colours[i][0]/255.0
901 g:cfg->colours[i][1]/255.0 b:cfg->colours[i][2]/255.0];
904 for (i = 0; i < NEXTCOLOURS; i++) {
906 int r = i / 36, g = (i / 6) % 6, b = i % 6;
907 [win setColour:i+16 r:r/5.0 g:g/5.0 b:b/5.0];
910 float fshade = (shade + 1) / (float)(NEXTCOLOURS - 216 + 1);
911 [win setColour:i+16 r:fshade g:fshade b:fshade];
916 * FIXME: do we need an OS X equivalent of set_window_background?
920 Context get_ctx(void *frontend)
922 SessionWindow *win = (SessionWindow *)frontend;
925 * Lock the drawing focus on the image inside the TerminalView.
927 [win drawStartFinish:YES];
929 [[NSGraphicsContext currentContext] setShouldAntialias:YES];
932 * Cocoa drawing functions don't take a graphics context: that
933 * parameter is implicit. Therefore, we'll use the frontend
934 * handle itself as the context, on the grounds that it's as
935 * good a thing to use as any.
940 void free_ctx(Context ctx)
942 SessionWindow *win = (SessionWindow *)ctx;
944 [win drawStartFinish:NO];
947 void do_text(Context ctx, int x, int y, wchar_t *text, int len,
948 unsigned long attr, int lattr)
950 SessionWindow *win = (SessionWindow *)ctx;
952 [win doText:text len:len x:x y:y attr:attr lattr:lattr];
955 void do_cursor(Context ctx, int x, int y, wchar_t *text, int len,
956 unsigned long attr, int lattr)
958 SessionWindow *win = (SessionWindow *)ctx;
959 Config *cfg = [win cfg];
962 if (attr & TATTR_PASCURS) {
963 attr &= ~TATTR_PASCURS;
967 if ((attr & TATTR_ACTCURS) && cfg->cursor_type != 0) {
968 attr &= ~TATTR_ACTCURS;
973 [win doText:text len:len x:x y:y attr:attr lattr:lattr];
976 * FIXME: now draw the various cursor types (both passive and
977 * active underlines and vertical lines, plus passive blocks).
982 * Minimise or restore the window in response to a server-side
985 void set_iconic(void *frontend, int iconic)
987 //SessionWindow *win = (SessionWindow *)frontend;
992 * Move the window in response to a server-side request.
994 void move_window(void *frontend, int x, int y)
996 //SessionWindow *win = (SessionWindow *)frontend;
1001 * Move the window to the top or bottom of the z-order in response
1002 * to a server-side request.
1004 void set_zorder(void *frontend, int top)
1006 //SessionWindow *win = (SessionWindow *)frontend;
1011 * Refresh the window in response to a server-side request.
1013 void refresh_window(void *frontend)
1015 //SessionWindow *win = (SessionWindow *)frontend;
1020 * Maximise or restore the window in response to a server-side
1023 void set_zoomed(void *frontend, int zoomed)
1025 //SessionWindow *win = (SessionWindow *)frontend;
1030 * Report whether the window is iconic, for terminal reports.
1032 int is_iconic(void *frontend)
1034 //SessionWindow *win = (SessionWindow *)frontend;
1035 return NO; /* FIXME */
1039 * Report the window's position, for terminal reports.
1041 void get_window_pos(void *frontend, int *x, int *y)
1043 //SessionWindow *win = (SessionWindow *)frontend;
1048 * Report the window's pixel size, for terminal reports.
1050 void get_window_pixels(void *frontend, int *x, int *y)
1052 //SessionWindow *win = (SessionWindow *)frontend;
1057 * Return the window or icon title.
1059 char *get_window_title(void *frontend, int icon)
1061 //SessionWindow *win = (SessionWindow *)frontend;
1062 return NULL; /* FIXME */
1065 void set_title(void *frontend, char *title)
1067 //SessionWindow *win = (SessionWindow *)frontend;
1071 void set_icon(void *frontend, char *title)
1073 //SessionWindow *win = (SessionWindow *)frontend;
1077 void set_sbar(void *frontend, int total, int start, int page)
1079 //SessionWindow *win = (SessionWindow *)frontend;
1083 void get_clip(void *frontend, wchar_t ** p, int *len)
1085 //SessionWindow *win = (SessionWindow *)frontend;
1089 void write_clip(void *frontend, wchar_t * data, int len, int must_deselect)
1091 //SessionWindow *win = (SessionWindow *)frontend;
1095 void request_paste(void *frontend)
1097 //SessionWindow *win = (SessionWindow *)frontend;
1101 void set_raw_mouse_mode(void *frontend, int activate)
1103 //SessionWindow *win = (SessionWindow *)frontend;
1107 void request_resize(void *frontend, int w, int h)
1109 //SessionWindow *win = (SessionWindow *)frontend;
1113 void sys_cursor(void *frontend, int x, int y)
1115 //SessionWindow *win = (SessionWindow *)frontend;
1117 * This is probably meaningless under OS X. FIXME: find out for
1122 void logevent(void *frontend, const char *string)
1124 //SessionWindow *win = (SessionWindow *)frontend;
1126 printf("logevent: %s\n", string);
1129 int font_dimension(void *frontend, int which)/* 0 for width, 1 for height */
1131 //SessionWindow *win = (SessionWindow *)frontend;
1132 return 1; /* FIXME */
1135 void set_busy_status(void *frontend, int status)
1138 * We need do nothing here: the OS X `application is busy'
1139 * beachball pointer appears _automatically_ when the
1140 * application isn't responding to GUI messages.