Turn Client::delayedMoveResize() into a lambda slot

Only used for the delayedMoveResizeTimer as timeout slot. Code is small
so a lambda makes more sense. At the same time the code is slightly
improved to ensure that startDelayedMoveResize is never called while
the timer is already active.

This means that mousePressEvents are now required to come from the
decoration.

REVIEW: 117843
master
Martin Gräßlin 11 years ago
parent 69e1a0fabd
commit 9cce470c35

@ -676,7 +676,6 @@ private Q_SLOTS:
void autoRaise();
void shadeHover();
void shadeUnhover();
void delayedMoveResize();
private:
friend class Bridge; // FRAME

@ -1195,8 +1195,7 @@ bool Client::buttonPressEvent(xcb_window_t w, int button, int state, int x, int
return processDecorationButtonPress(button, state, x, y, x_root, y_root, true);
}
if (w == decorationId()) {
// New API processes core events FIRST and only passes unused ones to the decoration
return processDecorationButtonPress(button, state, x, y, x_root, y_root, true);
return false;
}
if (w == frameId())
processDecorationButtonPress(button, state, x, y, x_root, y_root);

@ -2723,10 +2723,19 @@ void Client::checkUnrestrictedMoveResize()
// activated only after moving by several pixels, but that looks bad.
void Client::startDelayedMoveResize()
{
delete delayedMoveResizeTimer;
Q_ASSERT(!delayedMoveResizeTimer);
delayedMoveResizeTimer = new QTimer(this);
connect(delayedMoveResizeTimer, SIGNAL(timeout()), this, SLOT(delayedMoveResize()));
delayedMoveResizeTimer->setSingleShot(true);
connect(delayedMoveResizeTimer, &QTimer::timeout, this,
[this]() {
assert(buttonDown);
if (!startMoveResize()) {
buttonDown = false;
}
updateCursor();
stopDelayedMoveResize();
}
);
delayedMoveResizeTimer->start(QApplication::startDragTime());
}
@ -2736,15 +2745,6 @@ void Client::stopDelayedMoveResize()
delayedMoveResizeTimer = NULL;
}
void Client::delayedMoveResize()
{
assert(buttonDown);
if (!startMoveResize())
buttonDown = false;
updateCursor();
stopDelayedMoveResize();
}
void Client::handleMoveResize(int x, int y, int x_root, int y_root)
{
if (syncRequest.isPending && isResize())

Loading…
Cancel
Save