From 7775510918a1a0822e9fac9ef72270905642190c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Sun, 9 Sep 2012 14:24:06 +0200 Subject: [PATCH] fix desktopgrid window manage on VD amount change BUG: 289747 FIXED-IN: 4.9.2 REVIEW: 106391 --- effects/desktopgrid/desktopgrid.cpp | 23 ++++++++++++++--------- effects/desktopgrid/desktopgrid.h | 1 + 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/effects/desktopgrid/desktopgrid.cpp b/effects/desktopgrid/desktopgrid.cpp index 7e0afc17f7..f249b42330 100644 --- a/effects/desktopgrid/desktopgrid.cpp +++ b/effects/desktopgrid/desktopgrid.cpp @@ -383,7 +383,7 @@ void DesktopGridEffect::slotWindowAdded(EffectWindow* w) if (!activated) return; if (isUsingPresentWindows()) { - if (w->isDesktop() || w->isDock() || !w->isCurrentTab()) + if (!isRelevantWithPresentWindows(w)) return; // don't add if (w->isOnAllDesktops()) { for (int i = 0; i < effects->numberOfDesktops(); i++) { @@ -1105,8 +1105,7 @@ void DesktopGridEffect::setup() for (int j = 0; j < effects->numScreens(); j++) { WindowMotionManager manager; foreach (EffectWindow * w, effects->stackingOrder()) { - if (w->isOnDesktop(i) && w->screen() == j && !w->isDesktop() && !w->isDock() && - w->isCurrentTab() && !w->isSkipSwitcher() && w->isOnCurrentActivity()) { + if (w->isOnDesktop(i) && w->screen() == j &&isRelevantWithPresentWindows(w)) { manager.manage(w); } } @@ -1317,12 +1316,11 @@ void DesktopGridEffect::desktopsAdded(int old) } if (isUsingPresentWindows()) { - for (int i = old; i <= effects->numberOfDesktops(); i++) { - for (int j = 0; j < effects->numScreens(); j++) { + for (int i = old+1; i <= effects->numberOfDesktops(); ++i) { + for (int j = 0; j < effects->numScreens(); ++j) { WindowMotionManager manager; foreach (EffectWindow * w, effects->stackingOrder()) { - if (w->isOnDesktop(i) && w->screen() == j && !w->isDesktop() && !w->isDock() && - w->isCurrentTab()) { + if (w->isOnDesktop(i) && w->screen() == j &&isRelevantWithPresentWindows(w)) { manager.manage(w); } } @@ -1360,8 +1358,9 @@ void DesktopGridEffect::desktopsRemoved(int old) for (int j = 0; j < effects->numScreens(); ++j) { WindowMotionManager& manager = m_managers[(desktop-1)*(effects->numScreens())+j ]; foreach (EffectWindow * w, effects->stackingOrder()) { - if (!manager.isManaging(w) && w->isOnDesktop(desktop) && w->screen() == j && - !w->isDesktop() && !w->isDock() && w->isCurrentTab()) { + if (manager.isManaging(w)) + continue; + if (w->isOnDesktop(desktop) && w->screen() == j && isRelevantWithPresentWindows(w)) { manager.manage(w); } } @@ -1380,6 +1379,12 @@ bool DesktopGridEffect::isActive() const return timeline.currentValue() != 0 || activated || (isUsingPresentWindows() && isMotionManagerMovingWindows()); } +bool DesktopGridEffect::isRelevantWithPresentWindows(EffectWindow *w) const +{ + return !(w->isDesktop() || w->isDock() || w->isSkipSwitcher()) && + w->isCurrentTab() && w->isOnCurrentActivity(); +} + /************************************************ * DesktopButtonView ************************************************/ diff --git a/effects/desktopgrid/desktopgrid.h b/effects/desktopgrid/desktopgrid.h index c97666e296..498e2fde4a 100644 --- a/effects/desktopgrid/desktopgrid.h +++ b/effects/desktopgrid/desktopgrid.h @@ -134,6 +134,7 @@ private: void setupGrid(); void finish(); bool isMotionManagerMovingWindows() const; + bool isRelevantWithPresentWindows(EffectWindow *w) const; bool isUsingPresentWindows() const; QRectF moveGeometryToDesktop(int desktop) const; void desktopsAdded(int old);