summaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-06-02 18:16:37 +0200
committerOlivier Goffart <ogoffart@trolltech.com>2009-06-03 13:00:19 +0200
commit259b65c2f5d736dd7f6d81b6390f54464dd5f183 (patch)
tree418962f9d87bfee08e0df78934c240232c9b679c /demos
parentae5b1555676cef4058157431c3af2e7ff9ead8ce (diff)
BT: qt demo takes 100% of the cpu on X11
The tick timer is always active, even if the moving gree Qt logo is not visible. But the code that is supposed to pause it when the app loose the focus doesn't works if the moving Qt logo is not visible. Also the call to syncX makes Xorg takes lot of cpu. It doesn't fix the fact that the timer is still running while the green logo is not visible, but at least doesn't take the cpu anymore if qtdemo loose the focus. Task-number: 255020 Reviewed-by: Richard Moe Gustavsen
Diffstat (limited to 'demos')
-rw-r--r--demos/qtdemo/colors.cpp2
-rw-r--r--demos/qtdemo/mainwindow.cpp13
2 files changed, 3 insertions, 12 deletions
diff --git a/demos/qtdemo/colors.cpp b/demos/qtdemo/colors.cpp
index 41bbfb384e..883b0fbd08 100644
--- a/demos/qtdemo/colors.cpp
+++ b/demos/qtdemo/colors.cpp
@@ -97,7 +97,7 @@ bool Colors::noTickerMorph = false;
bool Colors::adapted = false;
bool Colors::verbose = false;
bool Colors::pause = true;
-int Colors::fps = 100;
+int Colors::fps = 60;
int Colors::menuCount = 18;
float Colors::animSpeed = 1.0;
float Colors::animSpeedButtons = 1.0;
diff --git a/demos/qtdemo/mainwindow.cpp b/demos/qtdemo/mainwindow.cpp
index 8723823526..16ca95fbe8 100644
--- a/demos/qtdemo/mainwindow.cpp
+++ b/demos/qtdemo/mainwindow.cpp
@@ -190,7 +190,6 @@ void MainWindow::switchTimerOnOff(bool on)
if (on && !Colors::noTimerUpdate){
this->useTimer = true;
- this->setViewportUpdateMode(QGraphicsView::NoViewportUpdate);
this->fpsTime = QTime::currentTime();
this->updateTimer.start(int(1000 / Colors::fps));
}
@@ -262,10 +261,6 @@ void MainWindow::tick()
if (MenuManager::instance()->ticker)
MenuManager::instance()->ticker->tick();
- this->viewport()->update();
- if (Colors::softwareRendering)
- QApplication::syncX();
-
if (this->useTimer)
this->updateTimer.start(int(1000 / Colors::fps));
}
@@ -435,9 +430,7 @@ void MainWindow::focusInEvent(QFocusEvent *)
if (MenuManager::instance()->ticker)
MenuManager::instance()->ticker->pause(false);
- int code = MenuManager::instance()->currentMenuCode;
- if (code == MenuManager::ROOT || code == MenuManager::MENU1)
- this->switchTimerOnOff(true);
+ this->switchTimerOnOff(true);
this->pausedLabel->setRecursiveVisible(false);
}
@@ -450,9 +443,7 @@ void MainWindow::focusOutEvent(QFocusEvent *)
if (MenuManager::instance()->ticker)
MenuManager::instance()->ticker->pause(true);
- int code = MenuManager::instance()->currentMenuCode;
- if (code == MenuManager::ROOT || code == MenuManager::MENU1)
- this->switchTimerOnOff(false);
+ this->switchTimerOnOff(false);
this->pausedLabel->setRecursiveVisible(true);
}