mirror of
https://github.com/david-schmidt/gsport.git
synced 2024-11-18 04:08:33 +00:00
In the Win32 build only, allow the user to hide the console window since a typical end-user won't care about the contents.
This commit is contained in:
parent
c6057e57ee
commit
08df2baad0
14
src/config.c
14
src/config.c
@ -93,7 +93,8 @@ extern char* g_printer_font_script;
|
||||
extern char* g_printer_font_ocra;
|
||||
extern int g_printer_timeout;
|
||||
#ifdef _WIN32
|
||||
extern int g_win_status_debug_request;
|
||||
extern int g_win_show_console_request;
|
||||
extern int g_win_status_debug_request;
|
||||
#endif
|
||||
|
||||
extern int g_screen_index[];
|
||||
@ -278,6 +279,15 @@ Cfg_menu g_cfg_printer_menu[] = {
|
||||
{ 0, 0, 0, 0, 0 },
|
||||
};
|
||||
|
||||
Cfg_menu g_cfg_debug_menu[] = {
|
||||
{ "Debugging Options", g_cfg_debug_menu, 0, 0, CFGTYPE_MENU },
|
||||
{ "Status lines,0,Hide,1,Show", KNMP(g_win_status_debug_request), CFGTYPE_INT },
|
||||
{ "Console,0,Hide,1,Show", KNMP(g_win_show_console_request), CFGTYPE_INT },
|
||||
{ "", 0, 0, 0, 0 },
|
||||
{ "Back to Main Config", g_cfg_main_menu, 0, 0, CFGTYPE_MENU },
|
||||
{ 0, 0, 0, 0, 0 },
|
||||
};
|
||||
|
||||
Cfg_menu g_cfg_main_menu[] = {
|
||||
{ "GSport Configuration", g_cfg_main_menu, 0, 0, CFGTYPE_MENU },
|
||||
{ "Disk Configuration", g_cfg_disk_menu, 0, 0, CFGTYPE_MENU },
|
||||
@ -291,7 +301,7 @@ Cfg_menu g_cfg_main_menu[] = {
|
||||
{ "Force X-windows display depth", KNMP(g_force_depth), CFGTYPE_INT },
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
{ "Debug status lines,0,Hide,1,Show", KNMP(g_win_status_debug_request), CFGTYPE_INT },
|
||||
{ "Debugging Options", g_cfg_debug_menu, 0, 0, CFGTYPE_MENU },
|
||||
#endif
|
||||
{ "Auto-update configuration file,0,Manual,1,Immediately",
|
||||
KNMP(g_config_gsport_auto_update), CFGTYPE_INT },
|
||||
|
@ -110,6 +110,16 @@ void x_toggle_status_lines()
|
||||
}
|
||||
}
|
||||
|
||||
void x_show_console(int show)
|
||||
{
|
||||
HWND hWnd = ::GetConsoleWindow();
|
||||
if (hWnd)
|
||||
::ShowWindow(hWnd, show ? SW_SHOW : SW_HIDE);
|
||||
|
||||
if (g_hwnd_main)
|
||||
::SetFocus(g_hwnd_main);
|
||||
}
|
||||
|
||||
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
|
||||
{
|
||||
return main(0,0);
|
||||
@ -118,6 +128,10 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
// Hide the console initially to reduce window flashing. We'll show the console later if needed.
|
||||
x_show_console(0);
|
||||
|
||||
// Register the window class.
|
||||
WNDCLASS wndclass;
|
||||
SIZE size;
|
||||
RECT rect;
|
||||
@ -133,7 +147,6 @@ main(int argc, char **argv)
|
||||
wndclass.lpszMenuName = NULL;
|
||||
wndclass.lpszClassName = "gsport";
|
||||
|
||||
// Register the window
|
||||
if(!RegisterClass(&wndclass)) {
|
||||
printf("Registering window failed\n");
|
||||
exit(1);
|
||||
|
@ -44,6 +44,7 @@ extern int g_config_control_panel;
|
||||
|
||||
extern void quitEmulator();
|
||||
extern void x_toggle_status_lines();
|
||||
extern void x_show_console(int show);
|
||||
extern void x_check_input_events();
|
||||
|
||||
int g_win_capslock_down = 0;
|
||||
@ -58,8 +59,10 @@ BITMAPINFO *g_bmapinfo_ptr = 0;
|
||||
volatile BITMAPINFOHEADER *g_bmaphdr_ptr = 0;
|
||||
|
||||
// KEGS32 specific customisations
|
||||
int g_win_status_debug = 1; // Current visibility of status lines.
|
||||
int g_win_status_debug_request = 1; // Desired visibility of status lines.
|
||||
int g_win_status_debug = 1; // Current visibility of status lines.
|
||||
int g_win_status_debug_request = 1; // Desired visibility of status lines.
|
||||
int g_win_show_console = 0; // Current visibility of console.
|
||||
int g_win_show_console_request = 1; // Desired visibility of console.
|
||||
RECT g_main_window_saved_rect;
|
||||
int g_win_fullscreen_state = 0;
|
||||
|
||||
@ -373,7 +376,11 @@ check_input_events()
|
||||
|
||||
if (g_win_status_debug_request != g_win_status_debug)
|
||||
x_toggle_status_lines();
|
||||
|
||||
if (g_win_show_console_request != g_win_show_console)
|
||||
{
|
||||
g_win_show_console = g_win_show_console_request;
|
||||
x_show_console(g_win_show_console_request);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user