warp cursor per virtual desktop wrap direction

if there's no desktop toLeft/Right above/below it's wrong
to warp the cursor, branch opens on corner edges

CCBUG: 333341

Forward port of eea4bb81105f2c289831cf1f682c3927a24fd831 from kde-workspace
This commit is contained in:
Thomas Lübking 2014-04-12 21:38:52 +02:00 committed by Martin Gräßlin
parent 5d8ae96a56
commit 35bfec1511

View file

@ -255,23 +255,29 @@ void Edge::switchDesktop(const QPoint &cursorPos)
{
QPoint pos(cursorPos);
VirtualDesktopManager *vds = VirtualDesktopManager::self();
uint desktop = vds->current();
const uint oldDesktop = vds->current();
uint desktop = oldDesktop;
const int OFFSET = 2;
if (isLeft()) {
const uint interimDesktop = desktop;
desktop = vds->toLeft(desktop, vds->isNavigationWrappingAround());
if (desktop != interimDesktop)
pos.setX(displayWidth() - 1 - OFFSET);
}
if (isRight()) {
} else if (isRight()) {
const uint interimDesktop = desktop;
desktop = vds->toRight(desktop, vds->isNavigationWrappingAround());
if (desktop != interimDesktop)
pos.setX(OFFSET);
}
if (isTop()) {
const uint interimDesktop = desktop;
desktop = vds->above(desktop, vds->isNavigationWrappingAround());
if (desktop != interimDesktop)
pos.setY(displayHeight() - 1 - OFFSET);
}
if (isBottom()) {
} else if (isBottom()) {
const uint interimDesktop = desktop;
desktop = vds->below(desktop, vds->isNavigationWrappingAround());
if (desktop != interimDesktop)
pos.setY(OFFSET);
}
if (Client *c = Workspace::self()->getMovingClient()) {