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.
This commit is contained in:
parent
387e1e3f21
commit
7308b809d8
|
@ -318,7 +318,7 @@ CFrame::CFrame(wxFrame* parent,
|
||||||
long style)
|
long style)
|
||||||
: CRenderFrame(parent, id, title, pos, size, style)
|
: CRenderFrame(parent, id, title, pos, size, style)
|
||||||
, g_pCodeWindow(nullptr), g_NetPlaySetupDiag(nullptr), g_CheatsWindow(nullptr)
|
, g_pCodeWindow(nullptr), g_NetPlaySetupDiag(nullptr), g_CheatsWindow(nullptr)
|
||||||
, m_SavedPerspectives(nullptr), m_ToolBar(nullptr)
|
, m_menubar_shadow(nullptr), m_SavedPerspectives(nullptr), m_ToolBar(nullptr)
|
||||||
, m_GameListCtrl(nullptr), m_Panel(nullptr)
|
, m_GameListCtrl(nullptr), m_Panel(nullptr)
|
||||||
, m_RenderFrame(nullptr), m_RenderParent(nullptr)
|
, m_RenderFrame(nullptr), m_RenderParent(nullptr)
|
||||||
, m_LogWindow(nullptr), m_LogConfigWindow(nullptr)
|
, m_LogWindow(nullptr), m_LogConfigWindow(nullptr)
|
||||||
|
@ -353,7 +353,10 @@ CFrame::CFrame(wxFrame* parent,
|
||||||
GetStatusBar()->Hide();
|
GetStatusBar()->Hide();
|
||||||
|
|
||||||
// Give it a menu bar
|
// Give it a menu bar
|
||||||
CreateMenu();
|
wxMenuBar* menubar_active = CreateMenu();
|
||||||
|
SetMenuBar(menubar_active);
|
||||||
|
// Create a menubar to service requests while the real menubar is hidden from the screen
|
||||||
|
m_menubar_shadow = CreateMenu();
|
||||||
|
|
||||||
// ---------------
|
// ---------------
|
||||||
// Main panel
|
// Main panel
|
||||||
|
@ -450,6 +453,10 @@ CFrame::~CFrame()
|
||||||
ClosePages();
|
ClosePages();
|
||||||
|
|
||||||
delete m_Mgr;
|
delete m_Mgr;
|
||||||
|
|
||||||
|
// This object is owned by us, not wxw
|
||||||
|
m_menubar_shadow->Destroy();
|
||||||
|
m_menubar_shadow = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CFrame::RendererIsFullscreen()
|
bool CFrame::RendererIsFullscreen()
|
||||||
|
@ -1271,9 +1278,9 @@ void CFrame::DoFullscreen(bool enable_fullscreen)
|
||||||
DoToggleToolbar(SConfig::GetInstance().m_InterfaceToolbar);
|
DoToggleToolbar(SConfig::GetInstance().m_InterfaceToolbar);
|
||||||
|
|
||||||
// Recreate the menubar if needed.
|
// Recreate the menubar if needed.
|
||||||
if (GetMenuBar() == nullptr)
|
if (wxFrame::GetMenuBar() == nullptr)
|
||||||
{
|
{
|
||||||
CreateMenu();
|
SetMenuBar(CreateMenu());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show statusbar if enabled
|
// Show statusbar if enabled
|
||||||
|
|
|
@ -129,6 +129,7 @@ public:
|
||||||
void UpdateTitle(const std::string &str);
|
void UpdateTitle(const std::string &str);
|
||||||
|
|
||||||
const CGameListCtrl *GetGameListCtrl() const;
|
const CGameListCtrl *GetGameListCtrl() const;
|
||||||
|
virtual wxMenuBar* GetMenuBar() const override;
|
||||||
|
|
||||||
#ifdef __WXGTK__
|
#ifdef __WXGTK__
|
||||||
Common::Event panic_event;
|
Common::Event panic_event;
|
||||||
|
@ -199,9 +200,11 @@ private:
|
||||||
wxBitmap m_Bitmaps[EToolbar_Max];
|
wxBitmap m_Bitmaps[EToolbar_Max];
|
||||||
wxBitmap m_BitmapsMenu[EToolbar_Max];
|
wxBitmap m_BitmapsMenu[EToolbar_Max];
|
||||||
|
|
||||||
|
wxMenuBar* m_menubar_shadow;
|
||||||
|
|
||||||
void PopulateToolbar(wxToolBar* toolBar);
|
void PopulateToolbar(wxToolBar* toolBar);
|
||||||
void RecreateToolbar();
|
void RecreateToolbar();
|
||||||
void CreateMenu();
|
wxMenuBar* CreateMenu();
|
||||||
|
|
||||||
// Utility
|
// Utility
|
||||||
wxString GetMenuLabel(int Id);
|
wxString GetMenuLabel(int Id);
|
||||||
|
|
|
@ -108,13 +108,24 @@ extern "C" {
|
||||||
class InputConfig;
|
class InputConfig;
|
||||||
class wxFrame;
|
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
|
// Create menu items
|
||||||
// ---------------------
|
// ---------------------
|
||||||
void CFrame::CreateMenu()
|
wxMenuBar* CFrame::CreateMenu()
|
||||||
{
|
{
|
||||||
if (GetMenuBar()) GetMenuBar()->Destroy();
|
wxMenuBar* menubar = new wxMenuBar();
|
||||||
|
|
||||||
wxMenuBar *m_MenuBar = new wxMenuBar();
|
|
||||||
|
|
||||||
// file menu
|
// file menu
|
||||||
wxMenu* fileMenu = new wxMenu;
|
wxMenu* fileMenu = new wxMenu;
|
||||||
|
@ -137,7 +148,7 @@ void CFrame::CreateMenu()
|
||||||
fileMenu->Append(IDM_BROWSE, _("&Browse for ISOs..."));
|
fileMenu->Append(IDM_BROWSE, _("&Browse for ISOs..."));
|
||||||
fileMenu->AppendSeparator();
|
fileMenu->AppendSeparator();
|
||||||
fileMenu->Append(wxID_EXIT, _("E&xit") + wxString("\tAlt+F4"));
|
fileMenu->Append(wxID_EXIT, _("E&xit") + wxString("\tAlt+F4"));
|
||||||
m_MenuBar->Append(fileMenu, _("&File"));
|
menubar->Append(fileMenu, _("&File"));
|
||||||
|
|
||||||
// Emulation menu
|
// Emulation menu
|
||||||
wxMenu* emulationMenu = new wxMenu;
|
wxMenu* emulationMenu = new wxMenu;
|
||||||
|
@ -197,7 +208,7 @@ void CFrame::CreateMenu()
|
||||||
for (unsigned int i = 1; i <= State::NUM_STATES; i++)
|
for (unsigned int i = 1; i <= State::NUM_STATES; i++)
|
||||||
loadMenu->Append(IDM_LOADLAST1 + i - 1, GetMenuLabel(HK_LOAD_LAST_STATE_1 + i - 1));
|
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
|
// Options menu
|
||||||
wxMenu* pOptionsMenu = new wxMenu;
|
wxMenu* pOptionsMenu = new wxMenu;
|
||||||
|
@ -213,7 +224,7 @@ void CFrame::CreateMenu()
|
||||||
pOptionsMenu->AppendSeparator();
|
pOptionsMenu->AppendSeparator();
|
||||||
g_pCodeWindow->CreateMenuOptions(pOptionsMenu);
|
g_pCodeWindow->CreateMenuOptions(pOptionsMenu);
|
||||||
}
|
}
|
||||||
m_MenuBar->Append(pOptionsMenu, _("&Options"));
|
menubar->Append(pOptionsMenu, _("&Options"));
|
||||||
|
|
||||||
// Tools menu
|
// Tools menu
|
||||||
wxMenu* toolsMenu = new wxMenu;
|
wxMenu* toolsMenu = new wxMenu;
|
||||||
|
@ -236,7 +247,7 @@ void CFrame::CreateMenu()
|
||||||
toolsMenu->AppendCheckItem(IDM_CONNECT_WIIMOTE4, GetMenuLabel(HK_WIIMOTE4_CONNECT));
|
toolsMenu->AppendCheckItem(IDM_CONNECT_WIIMOTE4, GetMenuLabel(HK_WIIMOTE4_CONNECT));
|
||||||
toolsMenu->AppendCheckItem(IDM_CONNECT_BALANCEBOARD, GetMenuLabel(HK_BALANCEBOARD_CONNECT));
|
toolsMenu->AppendCheckItem(IDM_CONNECT_BALANCEBOARD, GetMenuLabel(HK_BALANCEBOARD_CONNECT));
|
||||||
|
|
||||||
m_MenuBar->Append(toolsMenu, _("&Tools"));
|
menubar->Append(toolsMenu, _("&Tools"));
|
||||||
|
|
||||||
wxMenu* viewMenu = new wxMenu;
|
wxMenu* viewMenu = new wxMenu;
|
||||||
viewMenu->AppendCheckItem(IDM_TOGGLE_TOOLBAR, _("Show &Toolbar"));
|
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)
|
if (g_pCodeWindow)
|
||||||
{
|
{
|
||||||
g_pCodeWindow->CreateMenu(SConfig::GetInstance().m_LocalCoreStartupParameter, m_MenuBar);
|
g_pCodeWindow->CreateMenu(SConfig::GetInstance().m_LocalCoreStartupParameter, menubar);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Help menu
|
// Help menu
|
||||||
|
@ -342,10 +353,9 @@ void CFrame::CreateMenu()
|
||||||
helpMenu->Append(IDM_HELPGITHUB, _("Dolphin at &GitHub"));
|
helpMenu->Append(IDM_HELPGITHUB, _("Dolphin at &GitHub"));
|
||||||
helpMenu->AppendSeparator();
|
helpMenu->AppendSeparator();
|
||||||
helpMenu->Append(wxID_ABOUT, _("&About..."));
|
helpMenu->Append(wxID_ABOUT, _("&About..."));
|
||||||
m_MenuBar->Append(helpMenu, _("&Help"));
|
menubar->Append(helpMenu, _("&Help"));
|
||||||
|
|
||||||
// Associate the menu bar with the frame
|
return menubar;
|
||||||
SetMenuBar(m_MenuBar);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString CFrame::GetMenuLabel(int Id)
|
wxString CFrame::GetMenuLabel(int Id)
|
||||||
|
|
Loading…
Reference in New Issue