summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Endrodi <ext-adam.endrodi@nokia.com>2010-12-13 16:27:13 +0200
committerAdam Endrodi <ext-adam.endrodi@nokia.com>2010-12-15 15:47:18 +0200
commit3952cde3936fdbb987fce9b2e3ce3b19ec1ffe8f (patch)
tree7de8ab087f43ceccdffb57c83bf262d4667169d5
parented42feb78bb2b36e6e4f5991650e2ff5c6468e76 (diff)
simplify MCompositeWindow::itemChange()
* src/mcompositewindow.cpp (MCompositeWindow::itemChange): Use a flag rather than highest_visible_z == -1000.
-rw-r--r--src/mcompositewindow.cpp36
1 files changed, 19 insertions, 17 deletions
diff --git a/src/mcompositewindow.cpp b/src/mcompositewindow.cpp
index b3f60e6..2c28fd1 100644
--- a/src/mcompositewindow.cpp
+++ b/src/mcompositewindow.cpp
@@ -684,28 +684,30 @@ bool MCompositeWindow::hasTransitioningWindow()
QVariant MCompositeWindow::itemChange(GraphicsItemChange change, const QVariant &value)
{
MCompositeManager *p = (MCompositeManager *) qApp;
- bool zvalChanged = (change == ItemZValueHasChanged);
- if (zvalChanged) {
+ if (change == ItemZValueHasChanged) {
findBehindWindow();
p->d->setWindowDebugProperties(window());
- }
- // Be careful that there is a changed visible item, to not reopen NB#189519.
- // Update is needed if visibility changes for a visible item
- // (other visible items get redrawn also)
- QList<QGraphicsItem*> l;
- if (scene())
- l = scene()->items();
- int highest_visible_z = -1000;
- for (QList<QGraphicsItem*>::const_iterator i = l.begin(); i != l.end(); ++i)
- if ((*i)->isVisible()) {
- highest_visible_z = (*i)->zValue();
- break;
+ // Be careful not to update if this item whose visibility is about
+ // to change is behind a visible item, to not reopen NB#189519.
+ // Update is needed if visibility changes for a visible item
+ // (other visible items get redrawn also). Case requiring this:
+ // status menu closed on top of an mdecorated window.
+ bool ok_to_update = true;
+ if (scene()) {
+ QList<QGraphicsItem*> l = scene()->items();
+ for (QList<QGraphicsItem*>::const_iterator i = l.begin();
+ i != l.end(); ++i)
+ if ((*i)->isVisible()) {
+ ok_to_update = zValue() >= (*i)->zValue();
+ break;
+ }
}
- // case requiring this: status menu closed on top of decorated FieldTest app
- if (zValue() >= highest_visible_z && change == ItemVisibleHasChanged)
- p->d->glwidget->update();
+ if (ok_to_update)
+ // Nothing is visible or the topmost visible item is lower than us.
+ p->d->glwidget->update();
+ }
return QGraphicsItem::itemChange(change, value);
}