diff --git a/src/conio/ciolib.c b/src/conio/ciolib.c index 34c4ce12f935cbce233f41fe00e03a7809a3e340..a04970c8fa71acaab8567027fd5c862578f656d2 100644 --- a/src/conio/ciolib.c +++ b/src/conio/ciolib.c @@ -235,7 +235,10 @@ int try_conio_init(int mode) { /* This should test for something or other */ if(win32_initciolib(mode)) { - cio_api.mode=CIOLIB_MODE_CONIO; + if(mode==CIOLIB_MODE_AUTO) + cio_api.mode=CIOLIB_MODE_CONIO; + else + cio_api.mode=mode; /* CIOLIB_MODE_CONIO or CIOLIB_MODE_CONIO_FULLSCREEN */ cio_api.mouse=1; cio_api.puttext=win32_puttext; cio_api.gettext=win32_gettext; @@ -299,6 +302,7 @@ CIOLIBEXPORT int CIOLIBCALL initciolib(int mode) break; #ifdef _WIN32 case CIOLIB_MODE_CONIO: + case CIOLIB_MODE_CONIO_FULLSCREEN: try_conio_init(mode); break; #else diff --git a/src/conio/ciolib.h b/src/conio/ciolib.h index 425e0a43dd55bf6272e08651e448e5e136721dbd..07f21b2a2e2c55836853a6589579486c958b7502 100644 --- a/src/conio/ciolib.h +++ b/src/conio/ciolib.h @@ -76,6 +76,7 @@ enum { ,CIOLIB_MODE_ANSI ,CIOLIB_MODE_X ,CIOLIB_MODE_CONIO + ,CIOLIB_MODE_CONIO_FULLSCREEN ,CIOLIB_MODE_SDL ,CIOLIB_MODE_SDL_FULLSCREEN ,CIOLIB_MODE_SDL_YUV diff --git a/src/conio/win32cio.c b/src/conio/win32cio.c index b5f29d6f685e072f454c5905fbda1d03b0a55917..773194f053118ea2ba845aa4963b11b967ef2a31 100644 --- a/src/conio/win32cio.c +++ b/src/conio/win32cio.c @@ -299,6 +299,7 @@ static int win32_keyboardio(int isgetch) switch(input.EventType) { case KEY_EVENT: +#ifdef DEBUG_KEY_EVENTS dprintf("KEY_EVENT: KeyDown=%u" ,input.Event.KeyEvent.bKeyDown); dprintf(" RepeatCount=%u" @@ -312,6 +313,7 @@ static int win32_keyboardio(int isgetch) ,(BYTE)input.Event.KeyEvent.uChar.AsciiChar); dprintf(" ControlKeyState=0x%08lX" ,input.Event.KeyEvent.dwControlKeyState); +#endif if(input.Event.KeyEvent.bKeyDown) { /* Is this an AltGr key? */ @@ -391,9 +393,78 @@ static DWORD orig_in_conmode=0; static DWORD orig_out_conmode=0; static void * win32_suspendbuf=NULL; +#ifndef CONSOLE_FULLSCREEN_MODE +/* SetConsoleDisplayMode parameter value */ +#define CONSOLE_FULLSCREEN_MODE 1 // Text is displayed in full-screen mode. +#define CONSOLE_WINDOWED_MODE 2 // Text is displayed in a console window. +#endif + +static DWORD orig_display_mode=0; + +/*----------------------------------------------------------------------------- +NT_SetConsoleDisplayMode - Set the console display to fullscreen or windowed. + +Parameters: + hOutputHandle - Output handle of cosole, usually + "GetStdHandle(STD_OUTPUT_HANDLE)" + dwNewMode - 0=windowed, 1=fullscreen + +Returns Values: + TRUE if successful, otherwise FALSE is returned. Call GetLastError() for + extened information. + +Remarks: + This only works on NT based versions of Windows. + + If dwNewMode is anything other than 0 or 1, FALSE is returned and + GetLastError() returns ERROR_INVALID_PARAMETER. + + If dwNewMode specfies the current mode, FALSE is returned and + GetLastError() returns ERROR_INVALID_PARAMETER. Use the (documented) + function GetConsoleDisplayMode() to determine the current display mode. +-----------------------------------------------------------------------------*/ +BOOL NT_SetConsoleDisplayMode(HANDLE hOutputHandle, DWORD dwNewMode) +{ + typedef BOOL (WINAPI *SCDMProc_t) (HANDLE, DWORD, LPDWORD); + SCDMProc_t SetConsoleDisplayMode; + HMODULE hKernel32; + BOOL ret; + const char KERNEL32_NAME[] = "kernel32.dll"; + + hKernel32 = LoadLibrary(KERNEL32_NAME); + if (hKernel32 == NULL) + return FALSE; + + SetConsoleDisplayMode = + (SCDMProc_t)GetProcAddress(hKernel32, "SetConsoleDisplayMode"); + if (SetConsoleDisplayMode == NULL) + { + OutputDebugString("!SetConsoleDisplayMode missing\n"); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + ret = FALSE; + } + else + { + DWORD dummy=0; + ret = SetConsoleDisplayMode(hOutputHandle, dwNewMode, &dummy); + dprintf("SetConsoleDisplayMode(%d) returned %d (%d)", dwNewMode, ret, dummy); + } + + FreeLibrary(hKernel32); + + return ret; +} + +void RestoreDisplayMode(void) +{ + if(orig_display_mode==0) + NT_SetConsoleDisplayMode(GetStdHandle(STD_OUTPUT_HANDLE),CONSOLE_WINDOWED_MODE); +} + void win32_suspend(void) { HANDLE h; + OutputDebugString("win32_suspend\n"); if((h=GetStdHandle(STD_INPUT_HANDLE)) != INVALID_HANDLE_VALUE) SetConsoleMode(h, orig_in_conmode); @@ -406,6 +477,7 @@ void win32_resume(void) DWORD conmode; HANDLE h; + OutputDebugString("win32_resume\n"); conmode=orig_in_conmode; conmode&=~(ENABLE_PROCESSED_INPUT|ENABLE_QUICK_EDIT_MODE); conmode|=ENABLE_MOUSE_INPUT; @@ -426,6 +498,7 @@ int win32_initciolib(long inmode) HANDLE h; CONSOLE_SCREEN_BUFFER_INFO sbuff; + dprintf("win32_initciolib(%u)", inmode); if(!isatty(fileno(stdin))) { if(!AllocConsole()) return(0); @@ -508,6 +581,14 @@ int win32_initciolib(long inmode) } } +#if(_WIN32_WINNT >= 0x0500) + i=GetConsoleDisplayMode(&orig_display_mode); + dprintf("GetConsoleDisplayMode returned %d (%d)", i, orig_display_mode); +#endif + if(inmode==CIOLIB_MODE_CONIO_FULLSCREEN) { + NT_SetConsoleDisplayMode(h,CONSOLE_FULLSCREEN_MODE); + atexit(RestoreDisplayMode); + } cio_api.mouse=1; return(1); } diff --git a/src/syncterm/bbslist.c b/src/syncterm/bbslist.c index 488722a88685a833f7dfc7a276d24185bb632653..4de120769a0645973b7fcabda8d02efa8bd6fa00 100644 --- a/src/syncterm/bbslist.c +++ b/src/syncterm/bbslist.c @@ -1158,7 +1158,7 @@ void change_settings(void) " Writes ANSI on CodePage 437 on stdout and reads input from\n" " stdin. ANSI must be supported on the current terminal for this\n" " mode to work. This mode is intended to be used to run SyncTERM\n" - " as a door\n\n" + " as a BBS door\n\n" #if defined(__unix__) && !defined(NO_X) "~ X11 ~\n" " Uses the Xlib library directly for graphical output. This is\n" diff --git a/src/syncterm/syncterm.c b/src/syncterm/syncterm.c index f3e42b846ffe22847424334ea5dda5a047ca0074..58fd1f9e666434f95571c3b4020701366ced6188 100644 --- a/src/syncterm/syncterm.c +++ b/src/syncterm/syncterm.c @@ -657,6 +657,7 @@ char *output_types[]={ #endif #ifdef _WIN32 ,"Win32 Console" + ,"Win32 Console Fullscreen" #endif #if defined(WITH_SDL) || defined(WITH_SDL_AUDIO) ,"SDL" @@ -677,6 +678,7 @@ int output_map[]={ #endif #ifdef _WIN32 ,CIOLIB_MODE_CONIO + ,CIOLIB_MODE_CONIO_FULLSCREEN #endif #if defined(WITH_SDL) || defined(WITH_SDL_AUDIO) ,CIOLIB_MODE_SDL @@ -692,6 +694,7 @@ char *output_descrs[]={ ,"ANSI" ,"X11" ,"Win32 Console" + ,"Win32 Console Fullscreen" ,"SDL" ,"SDL Fullscreen" ,"SDL Overlay" @@ -705,6 +708,7 @@ char *output_enum[]={ ,"ANSI" ,"X11" ,"WinConsole" + ,"WinConsoleFullscreen" ,"SDL" ,"SDLFullscreen" ,"SDLOverlay" @@ -1054,6 +1058,11 @@ int main(int argc, char **argv) break; case 'W': ciolib_mode=CIOLIB_MODE_CONIO; + switch(toupper(argv[i][3])) { + case 'F': + ciolib_mode=CIOLIB_MODE_CONIO_FULLSCREEN; + break; + } break; case 'S': switch(toupper(argv[i][3])) { @@ -1274,7 +1283,7 @@ int main(int argc, char **argv) " C = Curses mode\n" " F = Curses mode with forced IBM charset\n" #else - " W = Win32 native mode\n" + " W[F] = Win32 native mode, F for fullscreen\n" #endif " A = ANSI mode\n" "-l# = set screen lines to # (default=auto-detect)\n"