From ce92539ec195273634dec693361fb7ba1cd61edf Mon Sep 17 00:00:00 2001 From: Mark Hessling Date: Fri, 2 Apr 2004 02:25:17 +0000 Subject: [PATCH] =?UTF-8?q?Try=20another=20version=20of=20screen=20resizin?= =?UTF-8?q?g=20for=20Win32=EF=BF=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- win32/pdcscrn.c | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/win32/pdcscrn.c b/win32/pdcscrn.c index 6201c87d..e7e40b7d 100644 --- a/win32/pdcscrn.c +++ b/win32/pdcscrn.c @@ -22,7 +22,7 @@ #include #ifdef PDCDEBUG -char *rcsid_PDCscrn = "$Id: pdcscrn.c,v 1.2 2002/06/23 04:10:03 mark Exp $"; +char *rcsid_PDCscrn = "$Id: pdcscrn.c,v 1.3 2004/04/02 02:25:17 rexx Exp $"; #endif HANDLE hConOut = INVALID_HANDLE_VALUE; @@ -405,9 +405,9 @@ int nlines,ncols; #endif /***********************************************************************/ { -#ifdef FGC0 +#ifdef MHES COORD size, max; - SMALL_RECT rect; + SMALL_RECT rect,displayarea = {0,0,0,0}; CONSOLE_SCREEN_BUFFER_INFO csbi; int external_resized = SP->resized; @@ -441,8 +441,11 @@ int nlines,ncols; if (rect.Bottom >= max.Y) rect.Bottom = max.Y; FitConsoleWindow(hConOut, &rect); /* helps to allow the BufferSize */ + displayarea.Right = rect.Right; + displayarea.Bottom = rect.Bottom; if (!SetConsoleScreenBufferSize(hConOut, size) || - !FitConsoleWindow(hConOut, &rect)) + !FitConsoleWindow(hConOut, &rect) || + !SetConsoleWindowInfo(hConOut, TRUE, &displayarea)) { SetConsoleScreenBufferSize(hConOut, csbi.dwSize); SetConsoleWindowInfo(hConOut, TRUE, &csbi.srWindow); @@ -451,7 +454,7 @@ int nlines,ncols; SetConsoleActiveScreenBuffer(hConOut); return ( OK ); -#else +#elif defined(FGC) int rc=OK; COORD size; SMALL_RECT rect; @@ -477,6 +480,33 @@ int nlines,ncols; SetConsoleWindowInfo(hConOut,TRUE,&rect); SetConsoleScreenBufferSize(hConOut, size); SetConsoleWindowInfo(hConOut,TRUE,&rect); + SetConsoleActiveScreenBuffer(hConOut); + SP->resized = FALSE; + return ( rc ); +#else + int rc=OK; + SMALL_RECT rect; + COORD size, max; + + if (nlines < 2 || ncols < 2) + return(ERR); + max = GetLargestConsoleWindowSize(hConOut); + + rect.Left = rect.Top = 0; + rect.Right = ncols - 1; + if (rect.Right >= max.X) + rect.Right = max.X; + rect.Bottom = nlines - 1; + if (rect.Bottom >= max.Y) + rect.Bottom = max.Y; + size.X = rect.Right + 1; + size.Y = rect.Bottom + 1; + FitConsoleWindow(hConOut, &rect); + SetConsoleScreenBufferSize(hConOut, size); + FitConsoleWindow(hConOut, &rect); + SetConsoleScreenBufferSize(hConOut, size); + + SetConsoleActiveScreenBuffer(hConOut); SP->resized = FALSE; return ( rc );