From ce1c90ec78d39a3c9a1e1c6bb2da84eb893e5bcc Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sat, 11 Feb 2023 11:01:48 +0200 Subject: [PATCH] When GUI is open: emulation window ESC=close GUI. F12/left mouse doubleclick=Bring GUI on top. --- od-win32/win32.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index 6578aeb8..3f1b304b 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include "resource.h" @@ -1970,8 +1971,18 @@ static LRESULT CALLBACK AmigaWindowProc(HWND hWnd, UINT message, WPARAM wParam, return 0; case WM_KEYDOWN: - if (dinput_wmkey((uae_u32)lParam)) - inputdevice_add_inputcode(AKS_ENTERGUI, 1, NULL); + if (!hGUIWnd) { + if (dinput_wmkey((uae_u32)lParam)) { + inputdevice_add_inputcode(AKS_ENTERGUI, 1, NULL); + } + } else { + int scancode = (lParam >> 16) & 0xff; + if (((currprefs.win32_guikey > 0 && scancode == currprefs.win32_guikey) || (currprefs.win32_guikey < 0 && scancode == DIK_F12))) { + SetForegroundWindow(hGUIWnd); + } else if (wParam == VK_ESCAPE) { + SendMessage(hGUIWnd, WM_CLOSE, 0, 0); + } + } return 0; case WM_LBUTTONUP: @@ -2003,7 +2014,11 @@ static LRESULT CALLBACK AmigaWindowProc(HWND hWnd, UINT message, WPARAM wParam, } else if (dinput_winmouse() >= 0 && isfocus()) { if (log_winmouse) write_log(_T("WM_LBUTTONDOWN\n")); - setmousebuttonstate(dinput_winmouse(), 0, 1); + if (message == WM_LBUTTONDBLCLK && hGUIWnd) { + SetForegroundWindow(hGUIWnd); + } else { + setmousebuttonstate(dinput_winmouse(), 0, 1); + } } } return 0; -- 2.47.3