Added the WM_SENDSTATUS (0x8895) and WM_SENDSSTATUS (0x8896) window message for manager purposes.

This commit is contained in:
OBattler
2018-10-23 19:41:17 +02:00
parent 14095aab59
commit 53e64c22ba
5 changed files with 621 additions and 15 deletions

View File

@@ -8,7 +8,7 @@
*
* Platform support defintions for Win32.
*
* Version: @(#)win.h 1.0.21 2018/10/12
* Version: @(#)win.h 1.0.22 2018/10/23
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -53,6 +53,8 @@
#define WM_HARDRESET 0x8892
#define WM_SHUTDOWN 0x8893
#define WM_CTRLALTDEL 0x8894
#define WM_SENDSTATUS 0x8895
#define WM_SENDSSTATUS 0x8896
#ifdef USE_VNC
#define RENDERERS_NUM 5

View File

@@ -8,7 +8,7 @@
*
* Windows 86Box Settings dialog handler.
*
* Version: @(#)win_settings.c 1.0.65 2018/10/17
* Version: @(#)win_settings.c 1.0.66 2018/10/23
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* David Hrdlička, <hrdlickadavid@outlook.com>
@@ -4469,6 +4469,38 @@ win_settings_main_insert_categories(HWND hwndList)
}
static void
win_settings_communicate_closure(void)
{
if (source_hwnd)
SendMessage((HWND) (uintptr_t) source_hwnd, WM_SENDSSTATUS, (WPARAM) 0, (LPARAM) 0);
}
#ifdef __amd64__
static LRESULT CALLBACK
#else
static BOOL CALLBACK
#endif
win_settings_confirm(HWND hdlg, int button)
{
SendMessage(hwndChildDialog, WM_SAVESETTINGS, 0, 0);
i = settings_msgbox_reset();
if (i > 0) {
if (i == 2)
win_settings_save();
DestroyWindow(hwndChildDialog);
EndDialog(hdlg, 0);
plat_pause(0);
win_settings_communicate_closure();
return button ? TRUE : FALSE;
} else
return button ? FALSE : TRUE;
}
#ifdef __amd64__
static LRESULT CALLBACK
#else
@@ -4505,25 +4537,17 @@ win_settings_main_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
win_settings_show_child(hdlg, category);
}
break;
case WM_CLOSE:
return win_settings_confirm(hdlg, 0);
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
SendMessage(hwndChildDialog, WM_SAVESETTINGS, 0, 0);
i = settings_msgbox_reset();
if (i > 0) {
if (i == 2)
win_settings_save();
DestroyWindow(hwndChildDialog);
EndDialog(hdlg, 0);
plat_pause(0);
return TRUE;
} else
return FALSE;
return win_settings_confirm(hdlg, 1);
case IDCANCEL:
DestroyWindow(hwndChildDialog);
EndDialog(hdlg, 0);
plat_pause(0);
win_settings_communicate_closure();
return TRUE;
}
break;
@@ -4539,4 +4563,7 @@ void
win_settings_open(HWND hwnd)
{
DialogBox(hinstance, (LPCWSTR)DLG_CONFIG, hwnd, win_settings_main_proc);
if (source_hwnd)
SendMessage((HWND) (uintptr_t) source_hwnd, WM_SENDSSTATUS, (WPARAM) 1, (LPARAM) 0);
}

View File

@@ -8,7 +8,7 @@
*
* user Interface module for WinAPI on Windows.
*
* Version: @(#)win_ui.c 1.0.33 2018/10/12
* Version: @(#)win_ui.c 1.0.34 2018/10/23
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -972,6 +972,10 @@ plat_pause(int p)
/* Update the actual menu. */
CheckMenuItem(menuMain, IDM_ACTION_PAUSE,
(dopause) ? MF_CHECKED : MF_UNCHECKED);
/* Send the WM to a manager if needed. */
if (source_hwnd)
SendMessage((HWND) (uintptr_t) source_hwnd, WM_SENDSTATUS, (WPARAM) !!dopause, (LPARAM) 0);
}