summaryrefslogtreecommitdiff
path: root/plugingui
diff options
context:
space:
mode:
Diffstat (limited to 'plugingui')
-rw-r--r--plugingui/plugingui.cc24
-rw-r--r--plugingui/plugingui.h1
2 files changed, 7 insertions, 18 deletions
diff --git a/plugingui/plugingui.cc b/plugingui/plugingui.cc
index 4a2f4fa..5408334 100644
--- a/plugingui/plugingui.cc
+++ b/plugingui/plugingui.cc
@@ -172,7 +172,6 @@ PluginGUI::PluginGUI()
: MessageReceiver(MSGRCV_UI), sem("plugingui")
{
initialised = false;
- //printf("PluginGUI::PluginGUI() begin\n"); fflush(stdout);
windowClosedHandler = NULL;
changeMidimapHandler = NULL;
@@ -189,8 +188,6 @@ PluginGUI::PluginGUI()
#endif/*USE_THREAD*/
sem.wait();
-
- //printf("PluginGUI::PluginGUI() done\n"); fflush(stdout);
}
PluginGUI::~PluginGUI()
@@ -306,8 +303,6 @@ void PluginGUI::init()
{
DEBUG(gui, "init");
- //printf("init begin\n"); fflush(stdout);
-
config = new Config();
config->load();
@@ -472,16 +467,13 @@ void PluginGUI::init()
sem.post();
- //printf("init end\n"); fflush(stdout);
initialised = true;
}
void PluginGUI::show()
{
- while(!initialised) {
- //printf("Waiting for init to finish\n"); fflush(stdout);
- sleep(1);
- }
+ while(!initialised) usleep(10000);
+
if(!window) init();
window->show();
@@ -489,19 +481,15 @@ void PluginGUI::show()
void PluginGUI::hide()
{
- while(!initialised) {
- //printf("Waiting for init to finish\n"); fflush(stdout);
- sleep(1);
- }
+ while(!initialised) usleep(10000);
+
if(window) window->hide();
}
void PluginGUI::processEvents()
{
- if(!initialised) {
- //printf("Not yet initialised\n"); fflush(stdout);
- return;
- }
+ if(!initialised) return;
+
if(closing) {
if(windowClosedHandler) windowClosedHandler(windowClosedPtr);
closing = false;
diff --git a/plugingui/plugingui.h b/plugingui/plugingui.h
index 36e8b1c..39643e1 100644
--- a/plugingui/plugingui.h
+++ b/plugingui/plugingui.h
@@ -93,6 +93,7 @@ private:
volatile bool running;
volatile bool closing;
volatile bool initialised;
+
Semaphore sem;
};