From ff0e77f8a66d55b0b8ca89ea9319c920df2ac1d4 Mon Sep 17 00:00:00 2001 From: Wengier Date: Tue, 25 Jan 2022 18:09:33 -0500 Subject: [PATCH] C_FORCE_MENU_HMENU option --- CHANGELOG | 2 ++ configure.ac | 8 ++++++++ include/menu.h | 4 +++- vs/config.h | 8 +++++++- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index bd01defd2..77e0e48cb 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -74,6 +74,8 @@ changeable via CONFIG command. (Wengier) - The default output for Linux SDL1 builds is changed from surface to opengl, unlike Linux SDL2. (Wengier) + - Using native Windows menus is supported in Windows + SDL2 build with an option at compile time. (Wengier) - Setting "windowposition" to "-" in the configuration will leave DOSBox-X window position as is instead of a specific position or being centered. (Wengier) diff --git a/configure.ac b/configure.ac index a4da8d3ca..1b9e5929f 100644 --- a/configure.ac +++ b/configure.ac @@ -164,6 +164,10 @@ dnl yksoft1 wants a MinGW build for Windows that doesn't use the Windows menu sy AH_TEMPLATE(C_FORCE_MENU_SDLDRAW,[Define to 1 to force SDL-drawn menus]) AC_ARG_ENABLE(force-menu-sdldraw,AC_HELP_STRING([--enable-force-menu-sdldraw],[Force SDL drawn menus]),enable_force_menu_sdldraw=yes) +dnl For Windows SDL2 builds that use the Windows native menu system. +AH_TEMPLATE(C_FORCE_MENU_HMENU,[Define to 1 to force native menus in Windows SDL2 builds]) +AC_ARG_ENABLE(force-menu-hmenu,AC_HELP_STRING([--enable-force-menu-hmenu],[Force Windows SDL2 native menus]),enable_force_menu_hmenu=yes) + dnl This is how the build script can specify a HX DOS extender target AH_TEMPLATE(C_HX_DOS,[Define to 1 to target HX DOS]) AC_ARG_ENABLE(hx-dos,AC_HELP_STRING([--enable-hx-dos],[Enable HX target]),enable_hx=yes) @@ -212,6 +216,10 @@ if test x$enable_force_menu_sdldraw = xyes; then AC_DEFINE(C_FORCE_MENU_SDLDRAW,1,[Force SDL drawn menus]) fi +if test x$enable_force_menu_hmenu = xyes; then + AC_DEFINE(C_FORCE_MENU_HMENU,1,[Force Windows SDL2 native menus]) +fi + dnl TEST: Environ can be included AC_MSG_CHECKING(if environ can be included) AC_LINK_IFELSE([AC_LANG_PROGRAM([[ diff --git a/include/menu.h b/include/menu.h index 569510e31..4ab4d289e 100644 --- a/include/menu.h +++ b/include/menu.h @@ -101,7 +101,9 @@ void DOSBox_NoMenu(void); #if C_FORCE_MENU_SDLDRAW /* Programmer/Dev wants to compile with SDL drawn menus even if host OS offers menus (shrug) Ok */ # define DOSBOXMENU_TYPE DOSBOXMENU_SDLDRAW -#elif defined(WIN32) && !defined(HX_DOS) && !(defined(C_SDL2) && 1) // Windows SDL1 (and perhaps SDL2) and not HX-DOS +#elif defined(HX_DOS) +# define DOSBOXMENU_TYPE DOSBOXMENU_SDLDRAW +#elif defined(WIN32) && (!defined(C_SDL2) || C_FORCE_MENU_HMENU) // Windows SDL1 and perhaps also SDL2 if desired # define DOSBOXMENU_TYPE DOSBOXMENU_HMENU #elif defined(MACOSX) # define DOSBOXMENU_TYPE DOSBOXMENU_NSMENU diff --git a/vs/config.h b/vs/config.h index fdd473f3b..a584a8863 100644 --- a/vs/config.h +++ b/vs/config.h @@ -89,8 +89,14 @@ /* Define to 1 to enable libfluidsynth MIDI synthesis */ #undef C_FLUIDSYNTH +/* Force Windows native menus for Windows SDL2 */ +#undef C_FORCE_MENU_HMENU + +/* Force SDL drawn menus for Windows SDL1 */ +#undef C_FORCE_MENU_SDLDRAW + /* Define to 1 to enable floating point emulation */ -#define C_FPU 1 +#define C_FPU 1 /* Define to 1 to use a x86/x64 assembly fpu core */ /* FIXME: VS2015 x86_64 will not allow inline asm! */