From 8ff3f021ae79bf4348cec371052f2a69bd64fbbe Mon Sep 17 00:00:00 2001 From: ben Date: Tue, 11 Feb 2003 23:10:34 +0000 Subject: [PATCH] Clip host resize requests to the size of the desktop. git-svn-id: svn://svn.tartarus.org/sgt/putty@2835 cda61777-01e9-0310-a592-d414129be87e --- mac/README.mac | 3 +-- mac/macterm.c | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/mac/README.mac b/mac/README.mac index 54cb6662..1c0de3f5 100644 --- a/mac/README.mac +++ b/mac/README.mac @@ -1,4 +1,4 @@ -$Id: README.mac,v 1.26 2003/02/10 23:49:58 ben Exp $ +$Id: README.mac,v 1.27 2003/02/11 23:10:34 ben Exp $ Information about PuTTY for the Mac OS -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= @@ -77,7 +77,6 @@ Known bugs: Unimplemented features (should be done before release): * TCP urgent data. * Listening sockets. - * Clipping host resize requests to screen size. * Changing font size in reponse to resize requests. * Full screen mode. * Session configuration. diff --git a/mac/macterm.c b/mac/macterm.c index fbf9412c..d0abf667 100644 --- a/mac/macterm.c +++ b/mac/macterm.c @@ -1,4 +1,4 @@ -/* $Id: macterm.c,v 1.69 2003/02/07 01:38:12 ben Exp $ */ +/* $Id: macterm.c,v 1.70 2003/02/11 23:10:34 ben Exp $ */ /* * Copyright (c) 1999 Simon Tatham * Copyright (c) 1999, 2002 Ben Harris @@ -1477,9 +1477,24 @@ void set_raw_mouse_mode(void *frontend, int activate) /* * Resize the window at the emulator's request */ -void request_resize(void *frontend, int w, int h) { +void request_resize(void *frontend, int w, int h) +{ Session *s = frontend; + RgnHandle grayrgn; + Rect graybox; + int wlim, hlim; + /* Arbitrarily clip to the size of the desktop. */ + grayrgn = GetGrayRgn(); +#if TARGET_API_MAC_CARBON + GetRegionBounds(grayrgn, &graybox); +#else + graybox = (*grayrgn)->rgnBBox; +#endif + wlim = (graybox.right - graybox.left) / s->font_width; + hlim = (graybox.bottom - graybox.top) / s->font_height; + if (w > wlim) w = wlim; + if (h > hlim) h = hlim; term_size(s->term, h, w, s->cfg.savelines); mac_initfont(s); } -- 2.11.0