From fa8c6cba51219ab4ce86ee66725c52882b7403e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Sun, 24 Apr 2011 22:21:58 +0200 Subject: [PATCH] forward port of a389a45ecaea2577f5162edd1485356c81263cce prevent accidental desktop swaps CCBUG: 220088 --- effects/desktopgrid/desktopgrid.cpp | 5 ++++- effects/desktopgrid/desktopgrid.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/effects/desktopgrid/desktopgrid.cpp b/effects/desktopgrid/desktopgrid.cpp index 950303f8c2..79240f7ac6 100644 --- a/effects/desktopgrid/desktopgrid.cpp +++ b/effects/desktopgrid/desktopgrid.cpp @@ -54,6 +54,7 @@ DesktopGridEffect::DesktopGridEffect() , keyboardGrab(false) , wasWindowMove(false) , wasDesktopMove(false) + , isValidMove(false) , windowMove(NULL) , windowMoveDiff() , gridSize() @@ -543,7 +544,7 @@ void DesktopGridEffect::windowInputMouseEvent(Window, QEvent* e) XDefineCursor(display(), input, QCursor(Qt::ClosedHandCursor).handle()); } if (d != highlightedDesktop) { // Highlight desktop - if ((me->buttons() & Qt::LeftButton) && !wasWindowMove && d <= effects->numberOfDesktops()) { + if ((me->buttons() & Qt::LeftButton) && isValidMove && !wasWindowMove && d <= effects->numberOfDesktops()) { EffectWindowList windows = effects->stackingOrder(); EffectWindowList stack; foreach (EffectWindow * w, windows) { @@ -580,6 +581,7 @@ void DesktopGridEffect::windowInputMouseEvent(Window, QEvent* e) } if (e->type() == QEvent::MouseButtonPress) { if (me->buttons() == Qt::LeftButton) { + isValidMove = true; // QRect rect; dragStartPos = me->pos(); bool isDesktop = (me->modifiers() & Qt::ControlModifier); @@ -625,6 +627,7 @@ void DesktopGridEffect::windowInputMouseEvent(Window, QEvent* e) } } if (e->type() == QEvent::MouseButtonRelease && me->button() == Qt::LeftButton) { + isValidMove = false; if (!wasWindowMove && !wasDesktopMove) { setCurrentDesktop(posToDesktop(me->pos())); if (windowMove) diff --git a/effects/desktopgrid/desktopgrid.h b/effects/desktopgrid/desktopgrid.h index 2795b2a934..8a8ddabeb9 100644 --- a/effects/desktopgrid/desktopgrid.h +++ b/effects/desktopgrid/desktopgrid.h @@ -125,7 +125,7 @@ private: int highlightedDesktop; Window input; bool keyboardGrab; - bool wasWindowMove, wasDesktopMove; + bool wasWindowMove, wasDesktopMove, isValidMove; EffectWindow* windowMove; QPoint windowMoveDiff; QPoint dragStartPos;