forward port of a389a45ecaea2577f5162edd1485356c81263cce
prevent accidental desktop swaps CCBUG: 220088
This commit is contained in:
parent
001b9da6d8
commit
fa8c6cba51
2 changed files with 5 additions and 2 deletions
|
@ -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)
|
||||
|
|
|
@ -125,7 +125,7 @@ private:
|
|||
int highlightedDesktop;
|
||||
Window input;
|
||||
bool keyboardGrab;
|
||||
bool wasWindowMove, wasDesktopMove;
|
||||
bool wasWindowMove, wasDesktopMove, isValidMove;
|
||||
EffectWindow* windowMove;
|
||||
QPoint windowMoveDiff;
|
||||
QPoint dragStartPos;
|
||||
|
|
Loading…
Reference in a new issue