mirror of
https://github.com/david-schmidt/gsport.git
synced 2024-06-30 20:29:29 +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
12
src/config.c
12
src/config.c
|
@ -93,6 +93,7 @@ extern char* g_printer_font_script;
|
||||||
extern char* g_printer_font_ocra;
|
extern char* g_printer_font_ocra;
|
||||||
extern int g_printer_timeout;
|
extern int g_printer_timeout;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
extern int g_win_show_console_request;
|
||||||
extern int g_win_status_debug_request;
|
extern int g_win_status_debug_request;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -278,6 +279,15 @@ Cfg_menu g_cfg_printer_menu[] = {
|
||||||
{ 0, 0, 0, 0, 0 },
|
{ 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[] = {
|
Cfg_menu g_cfg_main_menu[] = {
|
||||||
{ "GSport Configuration", g_cfg_main_menu, 0, 0, CFGTYPE_MENU },
|
{ "GSport Configuration", g_cfg_main_menu, 0, 0, CFGTYPE_MENU },
|
||||||
{ "Disk Configuration", g_cfg_disk_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 },
|
{ "Force X-windows display depth", KNMP(g_force_depth), CFGTYPE_INT },
|
||||||
#endif
|
#endif
|
||||||
#ifdef _WIN32
|
#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
|
#endif
|
||||||
{ "Auto-update configuration file,0,Manual,1,Immediately",
|
{ "Auto-update configuration file,0,Manual,1,Immediately",
|
||||||
KNMP(g_config_gsport_auto_update), CFGTYPE_INT },
|
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)
|
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
|
||||||
{
|
{
|
||||||
return main(0,0);
|
return main(0,0);
|
||||||
|
@ -118,6 +128,10 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
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;
|
WNDCLASS wndclass;
|
||||||
SIZE size;
|
SIZE size;
|
||||||
RECT rect;
|
RECT rect;
|
||||||
|
@ -133,7 +147,6 @@ main(int argc, char **argv)
|
||||||
wndclass.lpszMenuName = NULL;
|
wndclass.lpszMenuName = NULL;
|
||||||
wndclass.lpszClassName = "gsport";
|
wndclass.lpszClassName = "gsport";
|
||||||
|
|
||||||
// Register the window
|
|
||||||
if(!RegisterClass(&wndclass)) {
|
if(!RegisterClass(&wndclass)) {
|
||||||
printf("Registering window failed\n");
|
printf("Registering window failed\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
|
@ -44,6 +44,7 @@ extern int g_config_control_panel;
|
||||||
|
|
||||||
extern void quitEmulator();
|
extern void quitEmulator();
|
||||||
extern void x_toggle_status_lines();
|
extern void x_toggle_status_lines();
|
||||||
|
extern void x_show_console(int show);
|
||||||
extern void x_check_input_events();
|
extern void x_check_input_events();
|
||||||
|
|
||||||
int g_win_capslock_down = 0;
|
int g_win_capslock_down = 0;
|
||||||
|
@ -60,6 +61,8 @@ volatile BITMAPINFOHEADER *g_bmaphdr_ptr = 0;
|
||||||
// KEGS32 specific customisations
|
// KEGS32 specific customisations
|
||||||
int g_win_status_debug = 1; // Current 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_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;
|
RECT g_main_window_saved_rect;
|
||||||
int g_win_fullscreen_state = 0;
|
int g_win_fullscreen_state = 0;
|
||||||
|
|
||||||
|
@ -373,7 +376,11 @@ check_input_events()
|
||||||
|
|
||||||
if (g_win_status_debug_request != g_win_status_debug)
|
if (g_win_status_debug_request != g_win_status_debug)
|
||||||
x_toggle_status_lines();
|
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
|
void
|
||||||
|
|
Loading…
Reference in New Issue
Block a user