summaryrefslogtreecommitdiff
path: root/plugingui/plugingui.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2016-03-12 10:54:52 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2016-03-12 10:54:52 +0100
commitb9773f6eecea38e6a5aa28745cc6fe79aa2d441f (patch)
tree3740949c67bb6bfe533b35974f230c0443ce2c57 /plugingui/plugingui.cc
parent4bda33e204fafc4fdee6d14d5167ca7a801400ae (diff)
Add parent widget pointer for contained plugin windows. Remove threaded event handling and make all event handling depend on processEcvents being called with a regular (~50ms) interval.
Diffstat (limited to 'plugingui/plugingui.cc')
-rw-r--r--plugingui/plugingui.cc47
1 files changed, 7 insertions, 40 deletions
diff --git a/plugingui/plugingui.cc b/plugingui/plugingui.cc
index 85e628c..3375817 100644
--- a/plugingui/plugingui.cc
+++ b/plugingui/plugingui.cc
@@ -33,21 +33,15 @@
namespace GUI {
-PluginGUI::PluginGUI()
+PluginGUI::PluginGUI(void* native_window)
: MessageReceiver(MSGRCV_UI)
+ , native_window(native_window)
{
-#ifdef USE_THREAD
- run();
-#else
init();
-#endif/*USE_THREAD*/
-
- sem.wait();
}
PluginGUI::~PluginGUI()
{
- stopThread();
}
void PluginGUI::handleMessage(Message *msg)
@@ -114,27 +108,6 @@ void PluginGUI::handleMessage(Message *msg)
}
}
-void PluginGUI::thread_main()
-{
- init();
-
- { // Request all engine settings
- EngineSettingsMessage *msg = new EngineSettingsMessage();
- msghandler.sendMessage(MSGRCV_ENGINE, msg);
- }
-
- while(processEvents())
- {
-#ifdef WIN32
- SleepEx(50, FALSE);
-#else
- usleep(50000);
-#endif/*WIN32*/
- }
-
- deinit();
-}
-
bool PluginGUI::processEvents()
{
if(!initialised)
@@ -155,15 +128,6 @@ bool PluginGUI::processEvents()
return running;
}
-void PluginGUI::stopThread()
-{
- if(running)
- {
- running = false;
- wait_stop();
- }
-}
-
void PluginGUI::init()
{
DEBUG(gui, "init");
@@ -171,14 +135,17 @@ void PluginGUI::init()
config = new Config();
config->load();
- window = new DGWindow(msghandler, *config);
+ window = new DGWindow(native_window, msghandler, *config);
auto eventHandler = window->eventHandler();
CONNECT(eventHandler, closeNotifier, this, &PluginGUI::closeEventHandler);
window->show();
- sem.post();
+ { // Request all engine settings
+ EngineSettingsMessage *msg = new EngineSettingsMessage();
+ msghandler.sendMessage(MSGRCV_ENGINE, msg);
+ }
initialised = true;
}