commit 2e90c17122335efc6a8746cd40f9e42b0e70699b
parent 9df412f6cda03eeea4e2c8e76e104a4eea43e928
Author: cfillion <cfillion@users.noreply.github.com>
Date: Mon, 1 Feb 2016 02:39:48 -0500
ensure the manager window cannot be used when displaying an about dialog
Diffstat:
4 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/src/dialog.cpp b/src/dialog.cpp
@@ -45,19 +45,22 @@ WDL_DLGRET Dialog::Proc(HWND handle, UINT msg, WPARAM wParam, LPARAM lParam)
dlg->onInit();
break;
case WM_SHOWWINDOW:
- if(wParam) {
- // this makes possible to call onHide when destroying the window
- // but only if was visible before the destruction request
- // (destruction might be caused by the application exiting,
- // in which case IsWindowVisible would be false but m_isVisible == true)
- dlg->m_isVisible = true;
+ // this makes possible to call onHide when destroying the window
+ // but only if was visible before the destruction request
+ // (destruction might be caused by the application exiting,
+ // in which case IsWindowVisible would be false but m_isVisible == true)
+ dlg->m_isVisible = wParam == 1;
+
+ if(wParam)
dlg->onShow();
- }
- else {
- dlg->m_isVisible = false;
+ else
dlg->onHide();
- }
break;
+#ifdef _WIN32
+ case WM_ENABLE: // not supported by SWELL
+ dlg->m_isEnabled = wParam == 1;
+ break;
+#endif
case WM_TIMER:
dlg->onTimer();
break;
@@ -86,7 +89,7 @@ WDL_DLGRET Dialog::Proc(HWND handle, UINT msg, WPARAM wParam, LPARAM lParam)
}
Dialog::Dialog(const int templateId)
- : m_template(templateId), m_isVisible(false),
+ : m_template(templateId), m_isVisible(false), m_isEnabled(true),
m_instance(nullptr), m_parent(nullptr), m_handle(nullptr)
{
// can't call reimplemented virtual methods here during object construction
diff --git a/src/dialog.hpp b/src/dialog.hpp
@@ -63,6 +63,7 @@ public:
HWND handle() const { return m_handle; }
bool isVisible() const { return m_isVisible; }
+ bool isEnabled() const { return m_isEnabled; }
void enable() { enable(m_handle); }
void enable(HWND handle) { setEnabled(true, handle); }
@@ -112,6 +113,7 @@ private:
const int m_template;
bool m_isVisible;
+ bool m_isEnabled;
REAPER_PLUGIN_HINSTANCE m_instance;
HWND m_parent;
diff --git a/src/manager.cpp b/src/manager.cpp
@@ -179,7 +179,7 @@ void Manager::about()
RemoteIndex *index = RemoteIndex::load(remote.name());
unique_ptr<RemoteIndex> ptr(index);
- Dialog::Show<About>(instance(), parent(), index);
+ Dialog::Show<About>(instance(), handle(), index);
}
bool Manager::confirm() const
diff --git a/src/reapack.cpp b/src/reapack.cpp
@@ -262,6 +262,7 @@ Transaction *ReaPack::createTransaction()
if(m_transaction->isCancelled() || !m_transaction->isReportEnabled())
return;
+ const bool wasManagerEnabled = m_manager->isEnabled();
m_manager->disable();
if(m_transaction->taskCount() == 0 && m_transaction->errors().empty())
@@ -269,7 +270,8 @@ Transaction *ReaPack::createTransaction()
else
Dialog::Show<Report>(m_instance, m_mainWindow, m_transaction);
- m_manager->enable();
+ if(wasManagerEnabled)
+ m_manager->enable();
});
m_transaction->onDestroy([=] {