Move reset out of message handling

This commit is contained in:
zilmar 2015-02-21 21:21:17 +11:00
parent 129932d86e
commit e05a7db66d
2 changed files with 30 additions and 11 deletions

View File

@ -27,7 +27,9 @@ CMainGui::CMainGui (bool bMainWindow, const char * WindowTitle ) :
m_bMainWindow(bMainWindow), m_bMainWindow(bMainWindow),
m_Created(false), m_Created(false),
m_AttachingMenu(false), m_AttachingMenu(false),
m_MakingVisible(false) m_MakingVisible(false),
m_ResetPlugins(false),
m_ResetInfo(NULL)
{ {
m_Menu = NULL; m_Menu = NULL;
@ -327,11 +329,19 @@ void CMainGui::CreateStatusBar (void) {
int CMainGui::ProcessAllMessages (void) { int CMainGui::ProcessAllMessages (void) {
MSG msg; MSG msg;
while (GetMessage(&msg,NULL,0,0)) { while (GetMessage(&msg,NULL,0,0))
{
if (g_BaseSystem && g_BaseSystem->IsDialogMsg(&msg)) if (g_BaseSystem && g_BaseSystem->IsDialogMsg(&msg))
{ {
continue; continue;
} }
if (m_ResetPlugins)
{
m_ResetPlugins = false;
m_ResetInfo->res = m_ResetInfo->plugins->Reset(m_ResetInfo->system);
SetEvent(m_ResetInfo->hEvent);
m_ResetInfo = NULL;
}
//if (IsDialogMessage( hManageWindow,&msg)) { continue; } //if (IsDialogMessage( hManageWindow,&msg)) { continue; }
if (m_Menu->ProcessAccelerator(m_hMainWindow,&msg)) { continue; } if (m_Menu->ProcessAccelerator(m_hMainWindow,&msg)) { continue; }
TranslateMessage(&msg); TranslateMessage(&msg);
@ -345,6 +355,10 @@ bool CMainGui::ProcessGuiMessages (void) {
while (PeekMessage(&msg,NULL,0,0,PM_NOREMOVE)) while (PeekMessage(&msg,NULL,0,0,PM_NOREMOVE))
{ {
if (m_ResetPlugins)
{
m_ResetPlugins = false;
}
if (msg.message == WM_QUIT) { if (msg.message == WM_QUIT) {
return true; return true;
} }
@ -773,10 +787,13 @@ DWORD CALLBACK CMainGui::MainGui_Proc (HWND hWnd, DWORD uMsg, DWORD wParam, DWOR
break; break;
case WM_RESET_PLUGIN: case WM_RESET_PLUGIN:
{ {
RESET_PLUGIN * info = (RESET_PLUGIN *)lParam; CMainGui * _this = (CMainGui *)GetProp((HWND)hWnd, "Class");
if (_this->m_ResetInfo != NULL)
info->res = info->plugins->Reset(info->system); {
SetEvent(info->hEvent); Notify().BreakPoint(__FILE__, __LINE__);
}
_this->m_ResetInfo = (RESET_PLUGIN *)lParam;
_this->m_ResetPlugins = true;
} }
break; break;
case WM_COMMAND: case WM_COMMAND:

View File

@ -114,6 +114,8 @@ private:
bool m_Created; bool m_Created;
bool m_AttachingMenu; bool m_AttachingMenu;
bool m_MakingVisible; bool m_MakingVisible;
bool m_ResetPlugins;
RESET_PLUGIN * m_ResetInfo;
CriticalSection m_CS; CriticalSection m_CS;