desktop grid: general cleanup

code cleanups and minor fixes
This commit is contained in:
Thomas Lübking 2015-09-14 19:34:25 +02:00
parent 454f704647
commit c2acb5ad63

View file

@ -495,14 +495,16 @@ void DesktopGridEffect::windowInputMouseEvent(QEvent* e)
}
m_proxy->calculateWindowTransformations(manager.managedWindows(), windowMove->screen(), manager);
}
}
effects->defineCursor(Qt::ClosedHandCursor);
}
wasWindowMove = true;
}
}
if (windowMove->isMovable() && !isUsingPresentWindows()) {
wasWindowMove = true;
int screen = effects->screenNumber(me->pos());
effects->moveWindow(windowMove, unscalePos(me->pos(), NULL) + windowMoveDiff, true, 1.0 / scale[screen]);
}
if (wasWindowMove) {
effects->defineCursor(Qt::ClosedHandCursor);
if (d != highlightedDesktop) {
effects->windowToDesktop(windowMove, d); // Not true all desktop move
const int screen = effects->screenNumber(me->pos());
@ -510,6 +512,7 @@ void DesktopGridEffect::windowInputMouseEvent(QEvent* e)
effects->windowToScreen(windowMove, screen);
}
effects->addRepaintFull();
}
} else if ((me->buttons() & Qt::LeftButton) && !wasDesktopMove &&
(me->pos() - dragStartPos).manhattanLength() > QApplication::startDragDistance()) {
wasDesktopMove = true;
@ -559,7 +562,6 @@ void DesktopGridEffect::windowInputMouseEvent(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);
EffectWindow* w = isDesktop ? NULL : windowAt(me->pos());
@ -603,18 +605,19 @@ void DesktopGridEffect::windowInputMouseEvent(QEvent* e)
}
if (e->type() == QEvent::MouseButtonRelease && me->button() == Qt::LeftButton) {
isValidMove = false;
if (!wasWindowMove && !wasDesktopMove) {
if (windowMove)
effects->activateWindow(windowMove);
if (wasWindowMove || wasDesktopMove) { // reset pointer
effects->defineCursor(Qt::PointingHandCursor);
} else { // click -> exit
const int desk = posToDesktop(me->pos());
if (desk > effects->numberOfDesktops())
return; // don't quit when missing desktop
setCurrentDesktop(desk);
if (windowMove)
effects->activateWindow(windowMove);
setActive(false);
}
if (windowMove) {
if (wasWindowMove) {
if (isUsingPresentWindows()) {
if (wasWindowMove && isUsingPresentWindows()) {
const int targetDesktop = windowMove->isOnAllDesktops() ? posToDesktop(cursorPos()) : windowMove->desktop();
foreach (const int i, desktopList(windowMove)) {
WindowMotionManager& manager = m_managers[(i)*(effects->numScreens()) + windowMove->screen()];
@ -629,14 +632,9 @@ void DesktopGridEffect::windowInputMouseEvent(QEvent* e)
}
effects->addRepaintFull();
}
else
effects->activateWindow(windowMove);
}
effects->setElevatedWindow(windowMove, false);
windowMove = NULL;
effects->defineCursor(Qt::PointingHandCursor);
} else if (wasDesktopMove)
effects->defineCursor(Qt::PointingHandCursor);
}
wasWindowMove = false;
wasDesktopMove = false;
}
@ -1105,9 +1103,8 @@ void DesktopGridEffect::setup()
view->setRemoveDesktopEnabled(enableRemove);
const QRect screenRect = effects->clientArea(FullScreenArea, i, 1);
view->show(); // pseudo show must happen before geometry changes
view->setGeometry(screenRect.right() - border/3 - view->width(),
screenRect.bottom() - border/3 - view->height(),
view->width(), view->height());
view->setPosition(screenRect.right() - border/3 - view->width(),
screenRect.bottom() - border/3 - view->height());
}
while (it != m_desktopButtonsViews.end()) {
(*it)->deleteLater();