diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 6f3bcd4365..2f548ee75b 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,19 @@ +20000326-03:42 EST Paul Tucker + * source/rtl/gtwin/gtwin.c + * This is an old problem: + Because Windows allows you to set the size of the window to something + like 100x300 (for example) you then get scroll bars on the window. + I've been toying with the various conditions and oddities that might + arise from this situation. This includes switching from a window + to full screen where the max visible is typically 50x80, yet the system + can still give you access to the full 100x300. Writing to the extra + screen space is simple enough, but using it becomes annoying, since + the system will move the buffer around to keep the cursor in view. + Rather than fight it, gt_init, now caps the screen size to 50x80. + If you want a bigger size, then it is assumed you know what you are + going to do with the extra real eastate, and thus you can call + SetMode(100,300). + 20000326-08:06 GMT+1 Victor Szakats * include/hbdefs.h diff --git a/harbour/source/rtl/gtwin/gtwin.c b/harbour/source/rtl/gtwin/gtwin.c index 923cf83289..969974cc5a 100644 --- a/harbour/source/rtl/gtwin/gtwin.c +++ b/harbour/source/rtl/gtwin/gtwin.c @@ -6,7 +6,8 @@ * Harbour Project source code: * Video subsystem for Win32 compilers * - * Copyright 1999 Paul Tucker (functions marked ptucker) + * Copyright 1999-2000 Paul Tucker + * (for functions marked ptucker) * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify @@ -85,9 +86,9 @@ #endif #if 0 -static HANDLE s_HOsave; -#endif +static HANDLE s_HOsave; /* work in progress */ static HANDLE s_HDOutput; +#endif static HANDLE s_HOriginal; static HANDLE s_HOutput; static HANDLE s_HActive; @@ -143,7 +144,10 @@ void hb_gt_Init( int iFilenoStdin, int iFilenoStdout, int iFilenoStderr ) HB_SYMBOL_UNUSED( iFilenoStdout ); HB_SYMBOL_UNUSED( iFilenoStderr ); +#if 0 + s_HOsave = s_HDOutput = INVALID_HANDLE_VALUE; +#endif s_cNumRead = 0; s_cNumIndex = 0; @@ -180,7 +184,13 @@ void hb_gt_Init( int iFilenoStdin, int iFilenoStdout, int iFilenoStderr ) { CONSOLE_SCREEN_BUFFER_INFO csbi; - SMALL_RECT srWin; + + GetConsoleScreenBufferInfo( s_HOriginal, &csbi ); + csbi.dwSize.Y = min( csbi.dwSize.Y, 50 ); + csbi.srWindow.Bottom = min( csbi.srWindow.Bottom, 49 ); + + SetConsoleWindowInfo( s_HOriginal, TRUE, &csbi.srWindow ); + SetConsoleScreenBufferSize( s_HOriginal, csbi.dwSize ); s_HInactive = CreateConsoleScreenBuffer( GENERIC_READ | GENERIC_WRITE, /* Access flag */ @@ -189,16 +199,10 @@ void hb_gt_Init( int iFilenoStdin, int iFilenoStdout, int iFilenoStderr ) CONSOLE_TEXTMODE_BUFFER, /* Type of buffer */ NULL ); /* reserved */ - GetConsoleScreenBufferInfo( s_HOriginal, &csbi ); - /* new console window size and scroll position */ - srWin.Top = srWin.Left = 0; - srWin.Bottom = csbi.dwSize.Y - 1; - srWin.Right = csbi.dwSize.X - 1; - - SetConsoleScreenBufferSize( s_HInactive, csbi.dwSize ); SetConsoleWindowInfo( s_HInactive, TRUE, &csbi.srWindow ); - SetConsoleWindowInfo( s_HInactive, FALSE, &srWin ); + SetConsoleScreenBufferSize( s_HInactive, csbi.dwSize ); + } /* @@ -1018,9 +1022,13 @@ BOOL hb_gt_SetMode( USHORT uiRows, USHORT uiCols ) CONSOLE_SCREEN_BUFFER_INFO csbi; SMALL_RECT srWin; COORD coBuf; + USHORT uiDispCount = s_uiDispCount; HB_TRACE(HB_TR_DEBUG, ("hb_gt_SetMode(%hu, %hu)", uiRows, uiCols)); + while( s_uiDispCount ) + hb_gt_DispEnd(); + GetConsoleScreenBufferInfo( s_HOutput, &csbi ); coBuf = GetLargestConsoleWindowSize( s_HOutput ); @@ -1058,6 +1066,9 @@ BOOL hb_gt_SetMode( USHORT uiRows, USHORT uiCols ) bRetVal = FALSE; } + while( s_uiDispCount < uiDispCount ) + hb_gt_DispBegin(); + return bRetVal; }