summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinWX/FrameTools.cpp
diff options
context:
space:
mode:
authorShawn Hoffman <godisgovernment@gmail.com>2014-09-05 22:15:10 -0700
committerShawn Hoffman <godisgovernment@gmail.com>2014-09-05 22:21:09 -0700
commit7308b809d8d57020d18b82b8718d24877e2b6581 (patch)
tree9b0fffd554a9bcf7c8506a55c21bf8bd99e4122b /Source/Core/DolphinWX/FrameTools.cpp
parent387e1e3f21ae65c65fcd90b2c8aa21d9eff7d382 (diff)
Fix render to main crashing in fullscreen.
When hiding the menubar (for going fullscreen with render to main), keep a functionally-duplicate menubar around for servicing menubar actions.
Diffstat (limited to 'Source/Core/DolphinWX/FrameTools.cpp')
-rw-r--r--Source/Core/DolphinWX/FrameTools.cpp36
1 files changed, 23 insertions, 13 deletions
diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp
index 7341e62336..489c835baf 100644
--- a/Source/Core/DolphinWX/FrameTools.cpp
+++ b/Source/Core/DolphinWX/FrameTools.cpp
@@ -108,13 +108,24 @@ extern "C" {
class InputConfig;
class wxFrame;
+// This override allows returning a fake menubar object while removing the real one from the screen
+wxMenuBar* CFrame::GetMenuBar() const
+{
+ if (m_frameMenuBar)
+ {
+ return m_frameMenuBar;
+ }
+ else
+ {
+ return m_menubar_shadow;
+ }
+}
+
// Create menu items
// ---------------------
-void CFrame::CreateMenu()
+wxMenuBar* CFrame::CreateMenu()
{
- if (GetMenuBar()) GetMenuBar()->Destroy();
-
- wxMenuBar *m_MenuBar = new wxMenuBar();
+ wxMenuBar* menubar = new wxMenuBar();
// file menu
wxMenu* fileMenu = new wxMenu;
@@ -137,7 +148,7 @@ void CFrame::CreateMenu()
fileMenu->Append(IDM_BROWSE, _("&Browse for ISOs..."));
fileMenu->AppendSeparator();
fileMenu->Append(wxID_EXIT, _("E&xit") + wxString("\tAlt+F4"));
- m_MenuBar->Append(fileMenu, _("&File"));
+ menubar->Append(fileMenu, _("&File"));
// Emulation menu
wxMenu* emulationMenu = new wxMenu;
@@ -197,7 +208,7 @@ void CFrame::CreateMenu()
for (unsigned int i = 1; i <= State::NUM_STATES; i++)
loadMenu->Append(IDM_LOADLAST1 + i - 1, GetMenuLabel(HK_LOAD_LAST_STATE_1 + i - 1));
- m_MenuBar->Append(emulationMenu, _("&Emulation"));
+ menubar->Append(emulationMenu, _("&Emulation"));
// Options menu
wxMenu* pOptionsMenu = new wxMenu;
@@ -213,7 +224,7 @@ void CFrame::CreateMenu()
pOptionsMenu->AppendSeparator();
g_pCodeWindow->CreateMenuOptions(pOptionsMenu);
}
- m_MenuBar->Append(pOptionsMenu, _("&Options"));
+ menubar->Append(pOptionsMenu, _("&Options"));
// Tools menu
wxMenu* toolsMenu = new wxMenu;
@@ -236,7 +247,7 @@ void CFrame::CreateMenu()
toolsMenu->AppendCheckItem(IDM_CONNECT_WIIMOTE4, GetMenuLabel(HK_WIIMOTE4_CONNECT));
toolsMenu->AppendCheckItem(IDM_CONNECT_BALANCEBOARD, GetMenuLabel(HK_BALANCEBOARD_CONNECT));
- m_MenuBar->Append(toolsMenu, _("&Tools"));
+ menubar->Append(toolsMenu, _("&Tools"));
wxMenu* viewMenu = new wxMenu;
viewMenu->AppendCheckItem(IDM_TOGGLE_TOOLBAR, _("Show &Toolbar"));
@@ -326,11 +337,11 @@ void CFrame::CreateMenu()
- m_MenuBar->Append(viewMenu, _("&View"));
+ menubar->Append(viewMenu, _("&View"));
if (g_pCodeWindow)
{
- g_pCodeWindow->CreateMenu(SConfig::GetInstance().m_LocalCoreStartupParameter, m_MenuBar);
+ g_pCodeWindow->CreateMenu(SConfig::GetInstance().m_LocalCoreStartupParameter, menubar);
}
// Help menu
@@ -342,10 +353,9 @@ void CFrame::CreateMenu()
helpMenu->Append(IDM_HELPGITHUB, _("Dolphin at &GitHub"));
helpMenu->AppendSeparator();
helpMenu->Append(wxID_ABOUT, _("&About..."));
- m_MenuBar->Append(helpMenu, _("&Help"));
+ menubar->Append(helpMenu, _("&Help"));
- // Associate the menu bar with the frame
- SetMenuBar(m_MenuBar);
+ return menubar;
}
wxString CFrame::GetMenuLabel(int Id)