From 35bfec15111b1cd9ad98db63e405a928bfd2084d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Sat, 12 Apr 2014 21:38:52 +0200 Subject: [PATCH] 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 --- screenedge.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/screenedge.cpp b/screenedge.cpp index bdf154f91b..a8d61d6fd4 100644 --- a/screenedge.cpp +++ b/screenedge.cpp @@ -255,24 +255,30 @@ 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()); - pos.setX(displayWidth() - 1 - OFFSET); - } - if (isRight()) { + if (desktop != interimDesktop) + pos.setX(displayWidth() - 1 - OFFSET); + } else if (isRight()) { + const uint interimDesktop = desktop; desktop = vds->toRight(desktop, vds->isNavigationWrappingAround()); - pos.setX(OFFSET); + if (desktop != interimDesktop) + pos.setX(OFFSET); } if (isTop()) { + const uint interimDesktop = desktop; desktop = vds->above(desktop, vds->isNavigationWrappingAround()); - pos.setY(displayHeight() - 1 - OFFSET); - } - if (isBottom()) { + if (desktop != interimDesktop) + pos.setY(displayHeight() - 1 - OFFSET); + } else if (isBottom()) { + const uint interimDesktop = desktop; desktop = vds->below(desktop, vds->isNavigationWrappingAround()); - pos.setY(OFFSET); + if (desktop != interimDesktop) + pos.setY(OFFSET); } if (Client *c = Workspace::self()->getMovingClient()) { if (c->rules()->checkDesktop(desktop) != int(desktop)) {