mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Make gui panic alerts thread safe in linux.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6375 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -351,6 +351,8 @@ CFrame::CFrame(wxFrame* parent,
|
|||||||
for (int i = 0; i <= IDM_CODEWINDOW - IDM_LOGWINDOW; i++)
|
for (int i = 0; i <= IDM_CODEWINDOW - IDM_LOGWINDOW; i++)
|
||||||
bFloatWindow[i] = false;
|
bFloatWindow[i] = false;
|
||||||
|
|
||||||
|
panic_event.Init();
|
||||||
|
|
||||||
if (ShowLogWindow) SConfig::GetInstance().m_InterfaceLogWindow = true;
|
if (ShowLogWindow) SConfig::GetInstance().m_InterfaceLogWindow = true;
|
||||||
|
|
||||||
// Give it a console early to show potential messages from this onward
|
// Give it a console early to show potential messages from this onward
|
||||||
@ -490,6 +492,8 @@ CFrame::~CFrame()
|
|||||||
|
|
||||||
ClosePages();
|
ClosePages();
|
||||||
|
|
||||||
|
panic_event.Shutdown();
|
||||||
|
|
||||||
delete m_Mgr;
|
delete m_Mgr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -647,6 +651,14 @@ void CFrame::OnHostMessage(wxCommandEvent& event)
|
|||||||
m_RenderParent->SetCursor(wxCURSOR_BLANK);
|
m_RenderParent->SetCursor(wxCURSOR_BLANK);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef __WXGTK__
|
||||||
|
case IDM_PANIC:
|
||||||
|
bPanicResult = (wxYES == wxMessageBox(event.GetString(),
|
||||||
|
wxT("Warning"), event.GetInt() ? wxYES_NO : wxOK));
|
||||||
|
panic_event.Set();
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_X11) && HAVE_X11
|
#if defined(HAVE_X11) && HAVE_X11
|
||||||
case WM_USER_STOP:
|
case WM_USER_STOP:
|
||||||
DoStop();
|
DoStop();
|
||||||
|
@ -135,6 +135,11 @@ class CFrame : public CRenderFrame
|
|||||||
void DoFullscreen(bool bF);
|
void DoFullscreen(bool bF);
|
||||||
void ToggleDisplayMode (bool bFullscreen);
|
void ToggleDisplayMode (bool bFullscreen);
|
||||||
|
|
||||||
|
#ifdef __WXGTK__
|
||||||
|
Common::Event panic_event;
|
||||||
|
bool bPanicResult;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||||
X11Utils::XRRConfiguration *m_XRRConfig;
|
X11Utils::XRRConfiguration *m_XRRConfig;
|
||||||
#endif
|
#endif
|
||||||
|
@ -237,6 +237,7 @@ enum
|
|||||||
IDM_UPDATESTATUSBAR,
|
IDM_UPDATESTATUSBAR,
|
||||||
IDM_UPDATETITLE,
|
IDM_UPDATETITLE,
|
||||||
IDM_UPDATEBREAKPOINTS,
|
IDM_UPDATEBREAKPOINTS,
|
||||||
|
IDM_PANIC,
|
||||||
IDM_HOST_MESSAGE,
|
IDM_HOST_MESSAGE,
|
||||||
|
|
||||||
IDM_MPANEL, ID_STATUSBAR,
|
IDM_MPANEL, ID_STATUSBAR,
|
||||||
|
@ -452,9 +452,23 @@ void Host_SysMessage(const char *fmt, ...)
|
|||||||
|
|
||||||
bool wxMsgAlert(const char* caption, const char* text, bool yes_no, int /*Style*/)
|
bool wxMsgAlert(const char* caption, const char* text, bool yes_no, int /*Style*/)
|
||||||
{
|
{
|
||||||
return wxYES == wxMessageBox(wxString::FromAscii(text),
|
#ifdef __WXGTK__
|
||||||
wxString::FromAscii(caption),
|
if (wxIsMainThread())
|
||||||
(yes_no)?wxYES_NO:wxOK);
|
#endif
|
||||||
|
return wxYES == wxMessageBox(wxString::FromAscii(text),
|
||||||
|
wxString::FromAscii(caption),
|
||||||
|
(yes_no) ? wxYES_NO : wxOK);
|
||||||
|
#ifdef __WXGTK__
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_PANIC);
|
||||||
|
event.SetString(wxString::FromAscii(text));
|
||||||
|
event.SetInt(yes_no);
|
||||||
|
main_frame->GetEventHandler()->AddPendingEvent(event);
|
||||||
|
main_frame->panic_event.Wait();
|
||||||
|
return main_frame->bPanicResult;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Accessor for the main window class
|
// Accessor for the main window class
|
||||||
|
Reference in New Issue
Block a user