2009-04-15 19:31:20 +00:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2009 Michael Zanetti <michael_zanetti@gmx.net>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
|
|
|
|
|
|
|
#include "slideback.h"
|
|
|
|
|
|
|
|
#include <kconfiggroup.h>
|
|
|
|
#include <kdebug.h>
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
KWIN_EFFECT(slideback, SlideBackEffect)
|
2009-04-15 19:31:20 +00:00
|
|
|
|
|
|
|
SlideBackEffect::SlideBackEffect()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2009-05-24 14:00:35 +00:00
|
|
|
updateStackingOrder();
|
|
|
|
disabled = false;
|
2009-07-06 11:30:46 +00:00
|
|
|
unminimizedWindow = NULL;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool windowsShareDesktop(EffectWindow *w1, EffectWindow *w2)
|
|
|
|
{
|
2010-11-14 18:03:36 +00:00
|
|
|
return w1->isOnAllDesktops() || w2->isOnAllDesktops() || w1->desktop() == w2->desktop();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-04-15 19:31:20 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void SlideBackEffect::windowActivated(EffectWindow* w)
|
|
|
|
{
|
|
|
|
if (w == NULL || w->keepAbove()) { // plasma popups, yakuake etc...
|
2009-04-15 19:31:20 +00:00
|
|
|
return;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (disabled || effects->activeFullScreenEffect()) { // TabBox or PresentWindows/Cube in progress
|
2009-04-15 19:31:20 +00:00
|
|
|
updateStackingOrder();
|
|
|
|
disabled = false;
|
|
|
|
return;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-07-06 11:13:48 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
if (!isWindowUsable(w) || !stackingOrderChanged() || !isWindowOnTop(w)) { // Focus changed but stacking still the same
|
2009-04-15 19:31:20 +00:00
|
|
|
updateStackingOrder();
|
|
|
|
return;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-07-06 11:13:48 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
if (unminimizedWindow == w) { // A window was activated by being unminimized. Don't trigger SlideBack.
|
2009-07-06 11:13:48 +00:00
|
|
|
unminimizedWindow = NULL;
|
|
|
|
updateStackingOrder();
|
|
|
|
return;
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
if (clientItemShown == w) {
|
2009-11-15 03:24:04 +00:00
|
|
|
clientItemShown = NULL;
|
|
|
|
updateStackingOrder();
|
|
|
|
return;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
|
|
|
if (clientItemHidden == w) {
|
2009-11-15 03:24:04 +00:00
|
|
|
clientItemHidden = NULL;
|
|
|
|
updateStackingOrder();
|
|
|
|
return;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-04-15 19:31:20 +00:00
|
|
|
// Determine all windows on top of the activated one
|
|
|
|
bool currentFound = false;
|
2011-01-30 14:34:42 +00:00
|
|
|
foreach (EffectWindow * tmp, oldStackingOrder) {
|
|
|
|
if (!currentFound) {
|
|
|
|
if (tmp == w) {
|
2009-04-15 19:31:20 +00:00
|
|
|
currentFound = true;
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
} else {
|
|
|
|
if (isWindowUsable(tmp) && windowsShareDesktop(tmp, w)) {
|
2009-04-15 19:31:20 +00:00
|
|
|
// Do we have to move it?
|
2011-01-30 14:34:42 +00:00
|
|
|
if (intersects(w, tmp->geometry())) {
|
2009-04-22 12:49:28 +00:00
|
|
|
QRect slideRect;
|
2011-01-30 14:34:42 +00:00
|
|
|
slideRect = getSlideDestination(getModalGroupGeometry(w), tmp->geometry());
|
|
|
|
effects->setElevatedWindow(tmp, true);
|
|
|
|
elevatedList.append(tmp);
|
|
|
|
motionManager.manage(tmp);
|
|
|
|
motionManager.moveWindow(tmp, slideRect);
|
|
|
|
destinationList.insert(tmp, slideRect);
|
|
|
|
coveringWindows.append(tmp);
|
|
|
|
} else {
|
2009-04-15 19:31:20 +00:00
|
|
|
//Does it intersect with a moved (elevated) window and do we have to elevate it too?
|
2011-01-30 14:34:42 +00:00
|
|
|
foreach (EffectWindow * elevatedWindow, elevatedList) {
|
|
|
|
if (tmp->geometry().intersects(elevatedWindow->geometry())) {
|
|
|
|
effects->setElevatedWindow(tmp, true);
|
|
|
|
elevatedList.append(tmp);
|
2009-04-15 19:31:20 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2009-04-15 19:31:20 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
|
|
|
if (tmp->isDock() || tmp->keepAbove()) {
|
|
|
|
effects->setElevatedWindow(tmp, true);
|
|
|
|
elevatedList.append(tmp);
|
2009-04-15 19:31:20 +00:00
|
|
|
}
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-04-15 19:31:20 +00:00
|
|
|
// If a window is minimized it could happen that the panels stay elevated without any windows sliding.
|
|
|
|
// clear all elevation settings
|
2011-01-30 14:34:42 +00:00
|
|
|
if (!motionManager.managingWindows()) {
|
|
|
|
foreach (EffectWindow * tmp, elevatedList) {
|
|
|
|
effects->setElevatedWindow(tmp, false);
|
2009-04-15 19:31:20 +00:00
|
|
|
}
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
updateStackingOrder();
|
|
|
|
}
|
2009-04-15 19:31:20 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
QRect SlideBackEffect::getSlideDestination(const QRect &windowUnderGeometry, const QRect &windowOverGeometry)
|
|
|
|
{
|
2009-04-20 21:19:14 +00:00
|
|
|
// Determine the shortest way:
|
|
|
|
int leftSlide = windowUnderGeometry.left() - windowOverGeometry.right() - 20;
|
|
|
|
int rightSlide = windowUnderGeometry.right() - windowOverGeometry.left() + 20;
|
|
|
|
int upSlide = windowUnderGeometry.top() - windowOverGeometry.bottom() - 20;
|
|
|
|
int downSlide = windowUnderGeometry.bottom() - windowOverGeometry.top() + 20;
|
|
|
|
|
|
|
|
int horizSlide = leftSlide;
|
2011-01-30 14:34:42 +00:00
|
|
|
if (qAbs(horizSlide) > qAbs(rightSlide)) {
|
2009-04-20 21:19:14 +00:00
|
|
|
horizSlide = rightSlide;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-04-20 21:19:14 +00:00
|
|
|
int vertSlide = upSlide;
|
2011-01-30 14:34:42 +00:00
|
|
|
if (qAbs(vertSlide) > qAbs(downSlide)) {
|
|
|
|
vertSlide = downSlide;
|
|
|
|
}
|
2009-04-20 21:19:14 +00:00
|
|
|
|
|
|
|
QRect slideRect = windowOverGeometry;
|
2011-01-30 14:34:42 +00:00
|
|
|
if (qAbs(horizSlide) < qAbs(vertSlide)) {
|
|
|
|
slideRect.moveLeft(slideRect.x() + horizSlide);
|
|
|
|
} else {
|
|
|
|
slideRect.moveTop(slideRect.y() + vertSlide);
|
2009-04-20 21:19:14 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
return slideRect;
|
|
|
|
}
|
2009-04-20 21:19:14 +00:00
|
|
|
|
2009-04-15 19:31:20 +00:00
|
|
|
void SlideBackEffect::updateStackingOrder()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
usableOldStackingOrder = usableWindows(effects->stackingOrder());
|
2009-04-15 19:31:20 +00:00
|
|
|
oldStackingOrder = effects->stackingOrder();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-04-15 19:31:20 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void SlideBackEffect::prePaintScreen(ScreenPrePaintData &data, int time)
|
|
|
|
{
|
|
|
|
if (motionManager.managingWindows()) {
|
|
|
|
motionManager.calculate(time);
|
2009-04-15 19:31:20 +00:00
|
|
|
data.mask |= Effect::PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS;
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
effects->prePaintScreen(data, time);
|
|
|
|
}
|
2009-04-15 19:31:20 +00:00
|
|
|
|
|
|
|
void SlideBackEffect::postPaintScreen()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
if (motionManager.areWindowsMoving()) {
|
2009-04-15 19:31:20 +00:00
|
|
|
effects->addRepaintFull();
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
effects->postPaintScreen();
|
|
|
|
}
|
2009-04-15 19:31:20 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void SlideBackEffect::prePaintWindow(EffectWindow *w, WindowPrePaintData &data, int time)
|
|
|
|
{
|
|
|
|
if (motionManager.isManaging(w)) {
|
2009-05-19 13:52:50 +00:00
|
|
|
data.setTransformed();
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
effects->prePaintWindow(w, data, time);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SlideBackEffect::paintWindow(EffectWindow *w, int mask, QRegion region, WindowPaintData &data)
|
|
|
|
{
|
|
|
|
if (stackingOrderChanged() && (w == newTopWindow()) && !disabled) {
|
2009-04-15 19:31:20 +00:00
|
|
|
/* This can happen because of two reasons:
|
2009-10-30 08:10:35 +00:00
|
|
|
- a window has received the focus earlier without being raised and is raised now. -> call windowActivated() now
|
2009-04-15 19:31:20 +00:00
|
|
|
- paintWindow() is called with a new stackingOrder before activateWindow(). Bug? -> don't draw the overlapping content;*/
|
2011-01-30 14:34:42 +00:00
|
|
|
foreach (EffectWindow * tmp, oldStackingOrder) {
|
|
|
|
if (oldStackingOrder.lastIndexOf(tmp) > oldStackingOrder.lastIndexOf(w) && isWindowUsable(tmp) && windowsShareDesktop(tmp, w)) {
|
|
|
|
kDebug(1212) << "screw detected. region:" << region << "clipping:" << tmp->geometry() ;
|
|
|
|
clippedRegions << region.subtracted(tmp->geometry());
|
|
|
|
PaintClipper::push(clippedRegions.last());
|
2009-05-19 13:52:50 +00:00
|
|
|
// region = region.subtracted( tmp->geometry() );
|
2009-04-15 19:31:20 +00:00
|
|
|
}
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
// Finally call windowActivated in case a already active window is raised.
|
|
|
|
windowActivated(w);
|
2009-05-19 13:52:50 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
if (motionManager.isManaging(w)) {
|
|
|
|
motionManager.apply(w, data);
|
|
|
|
}
|
|
|
|
effects->paintWindow(w, mask, region, data);
|
|
|
|
for (int i = clippedRegions.count() - 1; i > -1; --i)
|
|
|
|
PaintClipper::pop(clippedRegions.at(i));
|
|
|
|
clippedRegions.clear();
|
|
|
|
}
|
2009-05-19 13:52:50 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void SlideBackEffect::postPaintWindow(EffectWindow* w)
|
|
|
|
{
|
|
|
|
if (motionManager.isManaging(w)) {
|
|
|
|
if (destinationList.contains(w)) {
|
2009-04-15 19:31:20 +00:00
|
|
|
// has window reched its destination?
|
2011-01-30 14:34:42 +00:00
|
|
|
if ((qAbs(motionManager.transformedGeometry(w).x() - destinationList[w].x()) < 1) &&
|
|
|
|
(qAbs(motionManager.transformedGeometry(w).y() - destinationList[w].y()) < 1)) {
|
2009-04-20 21:19:14 +00:00
|
|
|
// If we are still intersecting with the activeWindow it is moving. slide to somewhere else
|
|
|
|
// restore the stacking order of all windows not intersecting any more except panels
|
2011-01-30 14:34:42 +00:00
|
|
|
if (coveringWindows.contains(w)) {
|
2009-04-22 11:24:19 +00:00
|
|
|
EffectWindowList tmpList;
|
2011-01-30 14:34:42 +00:00
|
|
|
foreach (EffectWindow * tmp, elevatedList) {
|
2009-04-27 12:57:52 +00:00
|
|
|
QRect elevatedGeometry = tmp->geometry();
|
2011-01-30 14:34:42 +00:00
|
|
|
if (motionManager.isManaging(tmp)) {
|
|
|
|
elevatedGeometry = motionManager.transformedGeometry(tmp).toAlignedRect();
|
|
|
|
}
|
|
|
|
if (effects->activeWindow() && !tmp->isDock() && !tmp->keepAbove() && effects->activeWindow()->geometry().intersects(elevatedGeometry)) {
|
2009-04-22 12:49:28 +00:00
|
|
|
QRect newDestination;
|
2011-01-30 14:34:42 +00:00
|
|
|
newDestination = getSlideDestination(getModalGroupGeometry(effects->activeWindow()), elevatedGeometry);
|
|
|
|
if (!motionManager.isManaging(tmp)) {
|
|
|
|
motionManager.manage(tmp);
|
2009-04-20 21:19:14 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
motionManager.moveWindow(tmp, newDestination);
|
|
|
|
destinationList[tmp] = newDestination;
|
|
|
|
} else {
|
|
|
|
if (!tmp->isDock()) {
|
2009-04-22 11:24:19 +00:00
|
|
|
bool keepElevated = false;
|
2011-01-30 14:34:42 +00:00
|
|
|
foreach (EffectWindow * elevatedWindow, tmpList) {
|
|
|
|
if (tmp->geometry().intersects(elevatedWindow->geometry())) {
|
2009-04-22 11:24:19 +00:00
|
|
|
keepElevated = true;
|
|
|
|
}
|
2009-04-20 21:19:14 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
if (!keepElevated) {
|
|
|
|
effects->setElevatedWindow(tmp, false);
|
|
|
|
elevatedList.removeAll(tmp);
|
|
|
|
}
|
2009-04-20 21:19:14 +00:00
|
|
|
}
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
tmpList.append(tmp);
|
2009-04-20 21:19:14 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
} else {
|
2009-04-20 21:19:14 +00:00
|
|
|
// Move the window back where it belongs
|
2011-01-30 14:34:42 +00:00
|
|
|
motionManager.moveWindow(w, w->geometry());
|
|
|
|
destinationList.remove(w);
|
2009-04-15 19:31:20 +00:00
|
|
|
}
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
} else {
|
2009-04-15 19:31:20 +00:00
|
|
|
// is window back at its original position?
|
2011-01-30 14:34:42 +00:00
|
|
|
if ((qAbs(motionManager.transformedGeometry(w).x() - w->geometry().x()) < 1) &&
|
|
|
|
(qAbs(motionManager.transformedGeometry(w).y() - w->geometry().y()) < 1)) {
|
|
|
|
motionManager.unmanage(w);
|
2009-07-24 09:03:10 +00:00
|
|
|
effects->addRepaintFull();
|
2009-04-15 19:31:20 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
|
|
|
if (coveringWindows.contains(w)) {
|
2009-04-15 19:31:20 +00:00
|
|
|
// It could happen that there is no aciveWindow() here if the user clicks the close-button on an inactive window.
|
|
|
|
// Just skip... the window will be removed in windowDeleted() later
|
2011-01-30 14:34:42 +00:00
|
|
|
if (effects->activeWindow() && !intersects(effects->activeWindow(), motionManager.transformedGeometry(w).toAlignedRect())) {
|
|
|
|
coveringWindows.removeAll(w);
|
|
|
|
if (coveringWindows.isEmpty()) {
|
2009-04-15 19:31:20 +00:00
|
|
|
// Restore correct stacking order
|
2011-01-30 14:34:42 +00:00
|
|
|
foreach (EffectWindow * tmp, elevatedList) {
|
|
|
|
effects->setElevatedWindow(tmp, false);
|
2009-04-15 19:31:20 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
elevatedList.clear();
|
2009-04-15 19:31:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
effects->postPaintWindow(w);
|
|
|
|
}
|
2009-04-15 19:31:20 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void SlideBackEffect::windowDeleted(EffectWindow* w)
|
|
|
|
{
|
|
|
|
usableOldStackingOrder.removeAll(w);
|
|
|
|
oldStackingOrder.removeAll(w);
|
|
|
|
coveringWindows.removeAll(w);
|
|
|
|
elevatedList.removeAll(w);
|
|
|
|
if (motionManager.isManaging(w)) {
|
|
|
|
motionManager.unmanage(w);
|
2009-04-15 19:31:20 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-04-15 19:31:20 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void SlideBackEffect::windowAdded(KWin::EffectWindow* w)
|
|
|
|
{
|
|
|
|
Q_UNUSED(w);
|
2009-04-15 19:31:20 +00:00
|
|
|
updateStackingOrder();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-04-15 19:31:20 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void SlideBackEffect::windowUnminimized(EffectWindow* w)
|
|
|
|
{
|
2009-07-06 11:13:48 +00:00
|
|
|
// SlideBack should not be triggered on an unminimized window. For this we need to store the last unminimized window.
|
2011-01-30 14:34:42 +00:00
|
|
|
// If a window is unminimized but not on top we need to clear the memory because the windowUnminimized() is not
|
2009-07-06 11:13:48 +00:00
|
|
|
// followed by a windowActivated().
|
2011-01-30 14:34:42 +00:00
|
|
|
if (isWindowOnTop(w)) {
|
2009-07-06 11:13:48 +00:00
|
|
|
unminimizedWindow = w;
|
2011-01-30 14:34:42 +00:00
|
|
|
} else {
|
2009-10-15 15:41:35 +00:00
|
|
|
unminimizedWindow = NULL;
|
2009-07-06 11:13:48 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-04-15 19:31:20 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void SlideBackEffect::clientGroupItemSwitched(EffectWindow* from, EffectWindow* to)
|
|
|
|
{
|
2009-11-15 03:24:04 +00:00
|
|
|
clientItemShown = to;
|
|
|
|
clientItemHidden = from;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-11-15 03:24:04 +00:00
|
|
|
|
2009-04-15 19:31:20 +00:00
|
|
|
void SlideBackEffect::tabBoxClosed()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2009-04-15 19:31:20 +00:00
|
|
|
disabled = true;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-04-15 19:31:20 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
bool SlideBackEffect::isWindowOnTop(EffectWindow* w)
|
|
|
|
{
|
|
|
|
EffectWindowList openWindows = usableWindows(effects->stackingOrder());
|
|
|
|
if (!openWindows.isEmpty() && (openWindows.last() == w)) {
|
2009-10-15 15:41:35 +00:00
|
|
|
return true;
|
2009-04-15 19:31:20 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
return false;
|
|
|
|
}
|
2009-04-15 19:31:20 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
bool SlideBackEffect::isWindowUsable(EffectWindow* w)
|
|
|
|
{
|
|
|
|
return w && (w->isNormalWindow() || w->isDialog()) && !w->keepAbove() && !w->isDeleted() && !w->isMinimized()
|
|
|
|
&& w->visibleInClientGroup();
|
|
|
|
}
|
2009-04-15 19:31:20 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
bool SlideBackEffect::intersects(EffectWindow* windowUnder, const QRect &windowOverGeometry)
|
|
|
|
{
|
|
|
|
QRect windowUnderGeometry = getModalGroupGeometry(windowUnder);
|
|
|
|
return windowUnderGeometry.intersects(windowOverGeometry);
|
|
|
|
}
|
2009-04-22 12:49:28 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
EffectWindowList SlideBackEffect::usableWindows(const EffectWindowList & allWindows)
|
|
|
|
{
|
2009-04-15 19:31:20 +00:00
|
|
|
EffectWindowList retList;
|
2011-01-30 14:34:42 +00:00
|
|
|
foreach (EffectWindow * tmp, allWindows) {
|
|
|
|
if (isWindowUsable(tmp)) {
|
|
|
|
retList.append(tmp);
|
2009-04-15 19:31:20 +00:00
|
|
|
}
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
return retList;
|
|
|
|
}
|
2009-04-15 19:31:20 +00:00
|
|
|
|
|
|
|
bool SlideBackEffect::stackingOrderChanged()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
return !(usableOldStackingOrder == usableWindows(effects->stackingOrder()));
|
|
|
|
}
|
2009-04-15 19:31:20 +00:00
|
|
|
|
|
|
|
EffectWindow* SlideBackEffect::newTopWindow()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
EffectWindowList stacking = usableWindows(effects->stackingOrder());
|
2009-04-15 19:31:20 +00:00
|
|
|
return stacking.isEmpty() ? NULL : stacking.last();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-04-15 19:31:20 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
QRect SlideBackEffect::getModalGroupGeometry(EffectWindow *w)
|
|
|
|
{
|
2009-09-14 14:22:31 +00:00
|
|
|
QRect modalGroupGeometry = w->geometry();
|
2011-01-30 14:34:42 +00:00
|
|
|
if (w->isModal()) {
|
|
|
|
foreach (EffectWindow * modalWindow, w->mainWindows()) {
|
|
|
|
modalGroupGeometry = modalGroupGeometry.united(getModalGroupGeometry(modalWindow));
|
2009-09-14 14:22:31 +00:00
|
|
|
}
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
return modalGroupGeometry;
|
|
|
|
}
|
2009-09-14 14:22:31 +00:00
|
|
|
|
2009-04-15 19:31:20 +00:00
|
|
|
} //Namespace
|