summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-06-02 16:16:37 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2009-06-04 03:34:27 (GMT)
commit8340c5aec4f5c8694fe412d142d8c21a9d7833c1 (patch)
tree168d547dd4122b3e2154217dd07e8f2aabd63396
parentbafb2999067c99b0bfdb1fa3e69bcc892261d6b4 (diff)
downloadQt-8340c5aec4f5c8694fe412d142d8c21a9d7833c1.zip
Qt-8340c5aec4f5c8694fe412d142d8c21a9d7833c1.tar.gz
Qt-8340c5aec4f5c8694fe412d142d8c21a9d7833c1.tar.bz2
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 (cherry picked from commit 259b65c2f5d736dd7f6d81b6390f54464dd5f183)
-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 32f2ad0..9657a72 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 7996876..9c1d1f5 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);
}