From f862928f0c83a2bc1462bd5bee133c8ecee8ed83 Mon Sep 17 00:00:00 2001 From: OBattler Date: Fri, 1 Nov 2019 03:08:58 +0100 Subject: [PATCH] A confirmation message box is now shown on hard reset from the manager and emulator shutdowns are now notified to the manager. --- src/win/win.h | 10 ++++++---- src/win/win_ui.c | 14 ++++++++++++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/win/win.h b/src/win/win.h index 959056ba9..747c8c616 100644 --- a/src/win/win.h +++ b/src/win/win.h @@ -8,15 +8,15 @@ * * Platform support defintions for Win32. * - * Version: @(#)win.h 1.0.25 2019/02/11 + * Version: @(#)win.h 1.0.26 2019/11/01 * * Authors: Sarah Walker, * Miran Grca, * Fred N. van Kempen, * - * Copyright 2008-2018 Sarah Walker. - * Copyright 2016-2018 Miran Grca. - * Copyright 2017,2018 Fred N. van Kempen. + * Copyright 2008-2019 Sarah Walker. + * Copyright 2016-2019 Miran Grca. + * Copyright 2017-2019 Fred N. van Kempen. */ #ifndef PLAT_WIN_H # define PLAT_WIN_H @@ -57,6 +57,8 @@ #define WM_SENDSTATUS 0x8895 /* Settings status: WPARAM = 1 for open, 0 for closed. */ #define WM_SENDSSTATUS 0x8896 +/* Emulator shut down. */ +#define WM_SHUTDOWN_DONE 0x8897 #ifdef USE_VNC #ifdef USE_D2D diff --git a/src/win/win_ui.c b/src/win/win_ui.c index 625769f49..a23d74361 100644 --- a/src/win/win_ui.c +++ b/src/win/win_ui.c @@ -8,7 +8,7 @@ * * user Interface module for WinAPI on Windows. * - * Version: @(#)win_ui.c 1.0.40 2019/10/31 + * Version: @(#)win_ui.c 1.0.41 2019/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -309,6 +309,8 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case IDM_ACTION_EXIT: i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2122); if (i == 0) { + if (source_hwnd) + PostMessage((HWND) (uintptr_t) source_hwnd, WM_SHUTDOWN_DONE, (WPARAM) 0, (LPARAM) hwndMain); UnhookWindowsHookEx(hKeyboardHook); KillTimer(hwnd, TIMER_1SEC); PostQuitMessage(0); @@ -671,6 +673,8 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_CLOSE: i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2122); if (i == 0) { + if (source_hwnd) + PostMessage((HWND) (uintptr_t) source_hwnd, WM_SHUTDOWN_DONE, (WPARAM) 0, (LPARAM) hwndMain); UnhookWindowsHookEx(hKeyboardHook); KillTimer(hwnd, TIMER_1SEC); PostQuitMessage(0); @@ -678,6 +682,8 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) break; case WM_DESTROY: + if (source_hwnd) + PostMessage((HWND) (uintptr_t) source_hwnd, WM_SHUTDOWN_DONE, (WPARAM) 0, (LPARAM) hwndMain); UnhookWindowsHookEx(hKeyboardHook); KillTimer(hwnd, TIMER_1SEC); PostQuitMessage(0); @@ -693,12 +699,16 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) break; case WM_HARDRESET: - pc_reset(1); + i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2121); + if (i == 0) + pc_reset(1); break; case WM_SHUTDOWN: i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2122); if (i == 0) { + if (source_hwnd) + PostMessage((HWND) (uintptr_t) source_hwnd, WM_SHUTDOWN_DONE, (WPARAM) 0, (LPARAM) hwndMain); UnhookWindowsHookEx(hKeyboardHook); KillTimer(hwnd, TIMER_1SEC); PostQuitMessage(0);