Move menu setup to later in the setup process. Do not assume menu setup unless showmenu=true.

This commit is contained in:
Jonathan Campbell 2018-05-19 20:26:35 -07:00
parent 4ab2bc64bc
commit 5fbf166ad6
2 changed files with 15 additions and 25 deletions

View File

@ -20,18 +20,11 @@
#include <windows.h>
#include <windowsx.h>
#include "resource.h"
#define menu_compatible menu.compatible
#define menu_gui menu.gui
#else
// If these are used, the optimizer can completely remove code that is not
// needed on Linux. This way, code is less cluttered with #ifdefs
#define menu_compatible (false)
#define menu_gui (false)
#endif
#define menu_compatible menu.compatible
#define menu_startup menu.startup
#define menu_gui menu.gui
#ifndef MENUDEF_H
#define MENUDEF_H

View File

@ -7546,19 +7546,6 @@ int main(int argc, char* argv[]) {
if (control->opt_nogui || menu.compatible)
menu.gui=false;
{
Section_prop *section = static_cast<Section_prop *>(control->GetSection("SDL"));
assert(section != NULL);
bool cfg_want_menu = section->Get_bool("showmenu");
/* -- -- decide whether to set menu */
if (menu_gui && !control->opt_nomenu && cfg_want_menu)
DOSBox_SetMenu();
else
DOSBox_NoMenu();
}
/* -- -- helpful advice */
LOG(LOG_GUI,LOG_NORMAL)("Press Ctrl-F10 to capture/release mouse, Alt-F10 for configuration.");
@ -8052,7 +8039,6 @@ int main(int argc, char* argv[]) {
#if DOSBOXMENU_TYPE == DOSBOXMENU_HMENU
/* -- menu */
MainMenu = mainMenu.getWinMenu();
DOSBox_SetMenu();
#endif
#if DOSBOXMENU_TYPE == DOSBOXMENU_NSMENU
void sdl_hax_macosx_setmenu(void *nsMenu);
@ -8061,10 +8047,21 @@ int main(int argc, char* argv[]) {
#if DOSBOXMENU_TYPE == DOSBOXMENU_SDLDRAW
mainMenu.screenWidth = sdl.surface->w;
mainMenu.updateRect();
DOSBox_SetMenu();
mainMenu.get_item("mapper_togmenu").check(!menu.toggle).refresh_item(mainMenu);
#endif
{
Section_prop *section = static_cast<Section_prop *>(control->GetSection("SDL"));
assert(section != NULL);
bool cfg_want_menu = section->Get_bool("showmenu");
/* -- -- decide whether to set menu */
if (menu_gui && !control->opt_nomenu && cfg_want_menu)
DOSBox_SetMenu();
else
DOSBox_NoMenu();
}
#if DOSBOXMENU_TYPE == DOSBOXMENU_HMENU
int Reflect_Menu(void);
Reflect_Menu();