From 17c56a0c880725a424bb26f372e53b45d52f5e25 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Mon, 15 May 2017 07:29:10 -0700 Subject: [PATCH] IBM1130: Bring focus to the SCP window at appropriate times with GUI console As suggested by Jim Fehlinger in #450 --- Ibm1130/ibm1130_gui.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Ibm1130/ibm1130_gui.c b/Ibm1130/ibm1130_gui.c index 9b84d224..1bd43334 100644 --- a/Ibm1130/ibm1130_gui.c +++ b/Ibm1130/ibm1130_gui.c @@ -115,12 +115,17 @@ extern UNIT prt_unit; void remark_cmd (char *remark) {sim_printf("%s\n", remark);} #else +static HWND hConsoleWindow = NULL; + t_stat console_reset (DEVICE *dptr) { if (! sim_gui) { SETBIT(console_unit.flags, UNIT_DIS); /* disable the GUI */ CLRBIT(console_unit.flags, UNIT_DISPLAY); /* turn the GUI off */ - } + } else { + if (!hConsoleWindow) + hConsoleWindow = GetConsoleWindow(); + } update_gui(FALSE); return SCPE_OK; @@ -1223,6 +1228,7 @@ void HandleCommand (HWND hWnd, WORD wNotify, WORD idCtl, HWND hwCtl) * while (running) * Sleep(10); */ + SetForegroundWindow(hConsoleWindow); } break; @@ -1400,6 +1406,8 @@ void keyboard_selected (int select) { btn[IDC_KEYBOARD_SELECT].state = select; + if (select) + SetForegroundWindow(hConsoleWindow); if (btn[IDC_KEYBOARD_SELECT].hBtn != NULL) EnableWindow(btn[IDC_KEYBOARD_SELECT].hBtn, select); }