react on screenCountChanged to re-validate lists

includes fixing commit 1ac2f407c67c5740fb79cb11b610814a056b3268

BUG: 314409
REVIEW: 108775
FIXED-IN: 4.10.1
(cherry picked from commit e4ef2f072336a59039b1372266e4a5ab05d29cc0)
This commit is contained in:
Thomas Lübking 2013-02-04 16:46:34 +01:00
parent 084df811d2
commit 1cc5c2ff3f
2 changed files with 29 additions and 13 deletions

View file

@ -42,6 +42,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <math.h>
#include <assert.h>
#include <limits.h>
#include <QApplication>
#include <QDesktopWidget>
#include <QTimer>
#include <QVector2D>
#include <QVector4D>
@ -102,6 +104,8 @@ PresentWindowsEffect::PresentWindowsEffect()
connect(effects, SIGNAL(windowDeleted(KWin::EffectWindow*)), this, SLOT(slotWindowDeleted(KWin::EffectWindow*)));
connect(effects, SIGNAL(windowGeometryShapeChanged(KWin::EffectWindow*,QRect)), this, SLOT(slotWindowGeometryShapeChanged(KWin::EffectWindow*,QRect)));
connect(effects, SIGNAL(propertyNotify(KWin::EffectWindow*,long)), this, SLOT(slotPropertyNotify(KWin::EffectWindow*,long)));
connect (qApp->desktop(), SIGNAL(screenCountChanged(int)), SLOT(screenCountChanged()));
}
PresentWindowsEffect::~PresentWindowsEffect()
@ -1540,19 +1544,7 @@ void PresentWindowsEffect::setActive(bool active)
m_hasKeyboardGrab = effects->grabKeyboard(this);
effects->setActiveFullScreenEffect(this);
m_gridSizes.clear();
for (int i = 0; i < effects->numScreens(); ++i) {
m_gridSizes.append(GridSize());
if (m_dragToClose) {
const QRect screenRect = effects->clientArea(FullScreenArea, i, 1);
EffectFrame *frame = effects->effectFrame(EffectFrameNone, false);
KIcon icon("user-trash");
frame->setIcon(icon.pixmap(QSize(128, 128)));
frame->setPosition(QPoint(screenRect.x() + screenRect.width(), screenRect.y()));
frame->setAlignment(Qt::AlignRight | Qt::AlignTop);
m_dropTargets.append(frame);
}
}
screenCountChanged();
rearrangeWindows();
setHighlightedWindow(effects->activeWindow());
@ -1930,6 +1922,29 @@ bool PresentWindowsEffect::isActive() const
return m_activated || m_motionManager.managingWindows();
}
void PresentWindowsEffect::screenCountChanged()
{
if (!isActive())
return;
while (!m_dropTargets.empty()) {
delete m_dropTargets.takeFirst();
}
m_gridSizes.clear();
for (int i = 0; i < effects->numScreens(); ++i) {
m_gridSizes.append(GridSize());
if (m_dragToClose) {
const QRect screenRect = effects->clientArea(FullScreenArea, i, 1);
EffectFrame *frame = effects->effectFrame(EffectFrameNone, false);
KIcon icon("user-trash");
frame->setIcon(icon.pixmap(QSize(128, 128)));
frame->setPosition(QPoint(screenRect.x() + screenRect.width(), screenRect.y()));
frame->setAlignment(Qt::AlignRight | Qt::AlignTop);
m_dropTargets.append(frame);
}
}
rearrangeWindows();
}
/************************************************
* CloseWindowView
************************************************/

View file

@ -224,6 +224,7 @@ public slots:
private slots:
void closeWindow();
void elevateCloseWindow();
void screenCountChanged();
protected:
// Window rearranging