From 8e4fecb730fda4dac801b4f8e618ecae8103c00c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Samuel=20R=C3=B8dal?= <samuel.rodal@nokia.com>
Date: Fri, 13 May 2011 16:41:57 +0200
Subject: Fixed bug in meego graphics system runtime switching.

Switch when the last _visible_ widget is destroyed (and also switch back
when a widget is mapped and there are no other visible widgets).

Reviewed-by: Armin Berres
---
 src/plugins/graphicssystems/meego/qmeegographicssystem.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
index 69a6922..412d521 100644
--- a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
+++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
@@ -124,14 +124,14 @@ void QMeeGoGraphicsSystemSwitchHandler::addWidget(QWidget *widget)
 
 void QMeeGoGraphicsSystemSwitchHandler::handleMapNotify()
 {
-    if (m_widgets.isEmpty() && QMeeGoGraphicsSystem::switchPolicy == QMeeGoGraphicsSystem::AutomaticSwitch)
+    if (QMeeGoGraphicsSystem::switchPolicy == QMeeGoGraphicsSystem::AutomaticSwitch && visibleWidgets() == 0)
         QTimer::singleShot(0, this, SLOT(switchToMeeGo()));
 }
 
 void QMeeGoGraphicsSystemSwitchHandler::removeWidget(QObject *object)
 {
     m_widgets.removeOne(static_cast<QWidget *>(object));
-    if (m_widgets.isEmpty() && QMeeGoGraphicsSystem::switchPolicy == QMeeGoGraphicsSystem::AutomaticSwitch)
+    if (QMeeGoGraphicsSystem::switchPolicy == QMeeGoGraphicsSystem::AutomaticSwitch && visibleWidgets() == 0)
         QTimer::singleShot(0, this, SLOT(switchToRaster()));
 }
 
-- 
cgit v0.12