Commit 9e323227 authored by Martin Flöser's avatar Martin Flöser

Move (start|stop)DelayedMoveResize to AbstractClient

Also requires to add startMoveResized() as a virtual method. Not
yet implemented in AbstractClient.
parent 95a99d33
......@@ -1124,4 +1124,9 @@ void AbstractClient::updateHaveResizeEffect()
s_haveResizeEffect = effects && static_cast<EffectsHandlerImpl*>(effects)->provides(Effect::Resize);
}
bool AbstractClient::startMoveResize()
{
return false;
}
}
......@@ -696,6 +696,9 @@ protected:
* Sets an appropriate cursor shape for the logical mouse position.
*/
void updateCursor();
void startDelayedMoveResize();
void stopDelayedMoveResize();
virtual bool startMoveResize();
void finishMoveResize(bool cancel);
/**
* Leaves the move resize mode.
......@@ -770,6 +773,7 @@ private:
bool buttonDown = false;
Qt::CursorShape cursor = Qt::ArrowCursor;
int startScreen = 0;
QTimer *delayedTimer = nullptr;
} m_moveResize;
......
......@@ -109,7 +109,6 @@ Client::Client()
, m_motif(atoms->motif_wm_hints)
, blocks_compositing(false)
, shadeHoverTimer(NULL)
, delayedMoveResizeTimer(NULL)
, m_colormap(XCB_COLORMAP_NONE)
, in_group(NULL)
, tab_group(NULL)
......
......@@ -543,12 +543,10 @@ private:
int checkShadeGeometry(int w, int h);
void getSyncCounter();
void sendSyncRequest();
bool startMoveResize();
bool startMoveResize() override;
void leaveMoveResize() override;
void handleMoveResize(int x, int y, int x_root, int y_root);
void handleMoveResize(const QPoint &local, const QPoint &global);
void startDelayedMoveResize();
void stopDelayedMoveResize();
void positionGeometryTip();
void grabButton(int mod);
void ungrabButton(int mod);
......@@ -651,7 +649,6 @@ private:
QRect geom_restore;
QRect geom_fs_restore;
QTimer* shadeHoverTimer;
QTimer* delayedMoveResizeTimer;
xcb_colormap_t m_colormap;
QString cap_normal, cap_iconic, cap_suffix, cap_deco;
Group* in_group;
......
......@@ -2786,12 +2786,12 @@ void AbstractClient::checkUnrestrictedMoveResize()
// When the user pressed mouse on the titlebar, don't activate move immediatelly,
// since it may be just a click. Activate instead after a delay. Move used to be
// activated only after moving by several pixels, but that looks bad.
void Client::startDelayedMoveResize()
void AbstractClient::startDelayedMoveResize()
{
Q_ASSERT(!delayedMoveResizeTimer);
delayedMoveResizeTimer = new QTimer(this);
delayedMoveResizeTimer->setSingleShot(true);
connect(delayedMoveResizeTimer, &QTimer::timeout, this,
Q_ASSERT(!m_moveResize.delayedTimer);
m_moveResize.delayedTimer = new QTimer(this);
m_moveResize.delayedTimer->setSingleShot(true);
connect(m_moveResize.delayedTimer, &QTimer::timeout, this,
[this]() {
assert(isMoveResizePointerButtonDown());
if (!startMoveResize()) {
......@@ -2801,13 +2801,13 @@ void Client::startDelayedMoveResize()
stopDelayedMoveResize();
}
);
delayedMoveResizeTimer->start(QApplication::startDragTime());
m_moveResize.delayedTimer->start(QApplication::startDragTime());
}
void Client::stopDelayedMoveResize()
void AbstractClient::stopDelayedMoveResize()
{
delete delayedMoveResizeTimer;
delayedMoveResizeTimer = NULL;
delete m_moveResize.delayedTimer;
m_moveResize.delayedTimer = nullptr;
}
void Client::updateMoveResize(const QPointF &currentGlobalCursor)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment