ignore desktops and splashes for snapping

Desktops cannot be resonably snapped or cause
implicit screen snapping and splashes are undemanded
short term clients

REVIEW: 111139
This commit is contained in:
Thomas Lübking 2013-06-19 21:17:31 +02:00
parent 16ee964eb7
commit 774e3ec05b

View file

@ -456,19 +456,25 @@ QPoint Workspace::adjustClientPosition(Client* c, QPoint pos, bool unrestricted,
if (snap) {
QList<Client *>::ConstIterator l;
for (l = clients.constBegin(); l != clients.constEnd(); ++l) {
if ((((*l)->isOnDesktop(c->desktop()) && !(*l)->isMinimized())
|| (c->isOnDesktop(NET::OnAllDesktops) && (*l)->isOnDesktop(VirtualDesktopManager::self()->current())
&& !(*l)->isMinimized()))
&& (!(*l)->tabGroup() || (*l) == (*l)->tabGroup()->current())
&& (*l) != c) {
if ((*l) == c)
continue;
if ((*l)->isMinimized())
continue; // is minimized
if ((*l)->tabGroup() && (*l) != (*l)->tabGroup()->current())
continue; // is not active tab
if (!((*l)->isOnDesktop(c->desktop()) || c->isOnDesktop((*l)->desktop())))
continue; // wrong virtual desktop
if (!(*l)->isOnCurrentActivity())
continue; // wrong activity
if ((*l)->isDesktop() || (*l)->isSplash())
continue;
lx = (*l)->x();
ly = (*l)->y();
lrx = lx + (*l)->width();
lry = ly + (*l)->height();
if (((cy <= lry) && (cy >= ly)) ||
((ry >= ly) && (ry <= lry)) ||
((cy <= ly) && (ry >= lry))) {
if (((cy <= lry) && (cy >= ly)) || ((ry >= ly) && (ry <= lry)) || ((cy <= ly) && (ry >= lry))) {
if ((sOWO ? (cx < lrx) : true) && (qAbs(lrx - cx) < snap) && (qAbs(lrx - cx) < deltaX)) {
deltaX = qAbs(lrx - cx);
nx = lrx;
@ -479,9 +485,7 @@ QPoint Workspace::adjustClientPosition(Client* c, QPoint pos, bool unrestricted,
}
}
if (((cx <= lrx) && (cx >= lx)) ||
((rx >= lx) && (rx <= lrx)) ||
((cx <= lx) && (rx >= lrx))) {
if (((cx <= lrx) && (cx >= lx)) || ((rx >= lx) && (rx <= lrx)) || ((cx <= lx) && (rx >= lrx))) {
if ((sOWO ? (cy < lry) : true) && (qAbs(lry - cy) < snap) && (qAbs(lry - cy) < deltaY)) {
deltaY = qAbs(lry - cy);
ny = lry;
@ -516,7 +520,6 @@ QPoint Workspace::adjustClientPosition(Client* c, QPoint pos, bool unrestricted,
}
}
}
}
// center snap
snap = options->centerSnapZone() * snapAdjust; //snap trigger