mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-10-19 02:17:45 +08:00
Windows SDL 1.x: Add menu item to system menu to allow restoring the menu bar if you've hidden it.
This commit is contained in:
@@ -715,3 +715,6 @@
|
|||||||
#define ID_GLIDE_EMU_AUTO 819
|
#define ID_GLIDE_EMU_AUTO 819
|
||||||
#define ID_ALWAYS_ON_TOP 820
|
#define ID_ALWAYS_ON_TOP 820
|
||||||
|
|
||||||
|
#if defined(WIN32)
|
||||||
|
# define ID_WIN_SYSMENU_RESTOREMENU 0x0F00
|
||||||
|
#endif
|
||||||
|
@@ -738,6 +738,32 @@ void Mount_Img(char drive, std::string realpath) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DOSBox_SetSysMenu(void) {
|
||||||
|
MENUITEMINFO mii;
|
||||||
|
HMENU sysmenu;
|
||||||
|
BOOL s;
|
||||||
|
|
||||||
|
sysmenu = GetSystemMenu(GetHWND(), TRUE); // revert, so we can reapply menu items
|
||||||
|
sysmenu = GetSystemMenu(GetHWND(), FALSE);
|
||||||
|
if (sysmenu == NULL) return;
|
||||||
|
|
||||||
|
s = AppendMenu(sysmenu, MF_SEPARATOR, -1, "");
|
||||||
|
|
||||||
|
{
|
||||||
|
const char *msg = "Show menu &bar";
|
||||||
|
|
||||||
|
memset(&mii, 0, sizeof(mii));
|
||||||
|
mii.cbSize = sizeof(mii);
|
||||||
|
mii.fMask = MIIM_ID | MIIM_STRING | MIIM_STATE;
|
||||||
|
mii.fState = MFS_ENABLED;
|
||||||
|
mii.wID = ID_WIN_SYSMENU_RESTOREMENU;
|
||||||
|
mii.dwTypeData = (LPTSTR)(msg);
|
||||||
|
mii.cch = strlen(msg)+1;
|
||||||
|
|
||||||
|
s = InsertMenuItem(sysmenu, GetMenuItemCount(sysmenu), TRUE, &mii);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DOSBox_SetMenu(void) {
|
void DOSBox_SetMenu(void) {
|
||||||
if(!menu.gui) return;
|
if(!menu.gui) return;
|
||||||
|
|
||||||
@@ -791,6 +817,7 @@ void DOSBox_RefreshMenu(void) {
|
|||||||
DrawMenuBar(GetHWND());
|
DrawMenuBar(GetHWND());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
DOSBox_SetSysMenu();
|
||||||
if(menu.toggle)
|
if(menu.toggle)
|
||||||
DOSBox_SetMenu();
|
DOSBox_SetMenu();
|
||||||
else
|
else
|
||||||
@@ -835,6 +862,7 @@ void ToggleMenu(bool pressed) {
|
|||||||
menu.toggle=false;
|
menu.toggle=false;
|
||||||
DOSBox_NoMenu();
|
DOSBox_NoMenu();
|
||||||
}
|
}
|
||||||
|
DOSBox_SetSysMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MENU_Check_Drive(HMENU handle, int cdrom, int floppy, int local, int image, int automount, int umount, char drive) {
|
void MENU_Check_Drive(HMENU handle, int cdrom, int floppy, int local, int image, int automount, int umount, char drive) {
|
||||||
|
@@ -3624,7 +3624,6 @@ void GFX_Events() {
|
|||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
case SDL_SYSWMEVENT : {
|
case SDL_SYSWMEVENT : {
|
||||||
if(menu_compatible) break;
|
|
||||||
switch( event.syswm.msg->msg ) {
|
switch( event.syswm.msg->msg ) {
|
||||||
case WM_SYSCOMMAND:
|
case WM_SYSCOMMAND:
|
||||||
switch (event.syswm.msg->wParam) {
|
switch (event.syswm.msg->wParam) {
|
||||||
@@ -3639,6 +3638,9 @@ void GFX_Events() {
|
|||||||
GFX_SwitchFullScreen();
|
GFX_SwitchFullScreen();
|
||||||
menu.maxwindow=false;
|
menu.maxwindow=false;
|
||||||
break;
|
break;
|
||||||
|
case ID_WIN_SYSMENU_RESTOREMENU:
|
||||||
|
DOSBox_SetMenu();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case WM_MOVE:
|
case WM_MOVE:
|
||||||
break;
|
break;
|
||||||
@@ -3664,6 +3666,7 @@ void GFX_Events() {
|
|||||||
if (sdl.mouse.locked) GFX_CaptureMouse();
|
if (sdl.mouse.locked) GFX_CaptureMouse();
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
|
if (sdl.desktop.fullscreen)
|
||||||
GFX_ForceFullscreenExit();
|
GFX_ForceFullscreenExit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -5056,6 +5059,8 @@ int main(int argc, char* argv[]) {
|
|||||||
|
|
||||||
#if !defined(C_SDL2)
|
#if !defined(C_SDL2)
|
||||||
/* -- -- decide whether to set menu */
|
/* -- -- decide whether to set menu */
|
||||||
|
void DOSBox_SetSysMenu(void);
|
||||||
|
DOSBox_SetSysMenu();
|
||||||
if (menu_gui && !control->opt_nomenu)
|
if (menu_gui && !control->opt_nomenu)
|
||||||
DOSBox_SetMenu();
|
DOSBox_SetMenu();
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user