Move handleMoveResize to AbstractClient
Sync related code is split out into dedicated virtual methods so that Client can provide the X11 specific implementation. General handling, though is completely in AbstractClient.icc-effect-5.14.5
parent
dcff41ab40
commit
f4b02d5a8c
|
@ -1137,6 +1137,15 @@ void AbstractClient::doPerformMoveResize()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AbstractClient::isWaitingForMoveResizeSync() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractClient::doResizeSync()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void AbstractClient::checkQuickTilingMaximizationZones(int xroot, int yroot)
|
void AbstractClient::checkQuickTilingMaximizationZones(int xroot, int yroot)
|
||||||
{
|
{
|
||||||
QuickTileMode mode = QuickTileNone;
|
QuickTileMode mode = QuickTileNone;
|
||||||
|
|
|
@ -730,6 +730,20 @@ protected:
|
||||||
* activates quick tiling or maximization
|
* activates quick tiling or maximization
|
||||||
*/
|
*/
|
||||||
void checkQuickTilingMaximizationZones(int xroot, int yroot);
|
void checkQuickTilingMaximizationZones(int xroot, int yroot);
|
||||||
|
/**
|
||||||
|
* Whether a sync request is still pending.
|
||||||
|
* Default implementation returns @c false.
|
||||||
|
**/
|
||||||
|
virtual bool isWaitingForMoveResizeSync() const;
|
||||||
|
/**
|
||||||
|
* Called during handling a resize. Implementing subclasses can use this
|
||||||
|
* method to perform windowing system specific syncing.
|
||||||
|
*
|
||||||
|
* Default implementation does nothing.
|
||||||
|
**/
|
||||||
|
virtual void doResizeSync();
|
||||||
|
void handleMoveResize(int x, int y, int x_root, int y_root);
|
||||||
|
void handleMoveResize(const QPoint &local, const QPoint &global);
|
||||||
|
|
||||||
static bool haveResizeEffect() {
|
static bool haveResizeEffect() {
|
||||||
return s_haveResizeEffect;
|
return s_haveResizeEffect;
|
||||||
|
|
4
client.h
4
client.h
|
@ -469,6 +469,8 @@ protected:
|
||||||
void doMove(int x, int y) override;
|
void doMove(int x, int y) override;
|
||||||
bool doStartMoveResize() override;
|
bool doStartMoveResize() override;
|
||||||
void doPerformMoveResize() override;
|
void doPerformMoveResize() override;
|
||||||
|
bool isWaitingForMoveResizeSync() const override;
|
||||||
|
void doResizeSync() override;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void delayedSetShortcut();
|
void delayedSetShortcut();
|
||||||
|
@ -544,8 +546,6 @@ private:
|
||||||
void getSyncCounter();
|
void getSyncCounter();
|
||||||
void sendSyncRequest();
|
void sendSyncRequest();
|
||||||
void leaveMoveResize() 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 positionGeometryTip() override;
|
void positionGeometryTip() override;
|
||||||
void grabButton(int mod);
|
void grabButton(int mod);
|
||||||
void ungrabButton(int mod);
|
void ungrabButton(int mod);
|
||||||
|
|
31
geometry.cpp
31
geometry.cpp
|
@ -2823,7 +2823,7 @@ void Client::updateMoveResize(const QPointF ¤tGlobalCursor)
|
||||||
handleMoveResize(pos(), currentGlobalCursor.toPoint());
|
handleMoveResize(pos(), currentGlobalCursor.toPoint());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::handleMoveResize(const QPoint &local, const QPoint &global)
|
void AbstractClient::handleMoveResize(const QPoint &local, const QPoint &global)
|
||||||
{
|
{
|
||||||
const QRect oldGeo = geometry();
|
const QRect oldGeo = geometry();
|
||||||
handleMoveResize(local.x(), local.y(), global.x(), global.y());
|
handleMoveResize(local.x(), local.y(), global.x(), global.y());
|
||||||
|
@ -2831,6 +2831,7 @@ void Client::handleMoveResize(const QPoint &local, const QPoint &global)
|
||||||
if (quickTileMode() != QuickTileNone && oldGeo != geometry()) {
|
if (quickTileMode() != QuickTileNone && oldGeo != geometry()) {
|
||||||
GeometryUpdatesBlocker blocker(this);
|
GeometryUpdatesBlocker blocker(this);
|
||||||
setQuickTileMode(QuickTileNone);
|
setQuickTileMode(QuickTileNone);
|
||||||
|
const QRect &geom_restore = geometryRestore();
|
||||||
setMoveOffset(QPoint(double(moveOffset().x()) / double(oldGeo.width()) * double(geom_restore.width()),
|
setMoveOffset(QPoint(double(moveOffset().x()) / double(oldGeo.width()) * double(geom_restore.width()),
|
||||||
double(moveOffset().y()) / double(oldGeo.height()) * double(geom_restore.height())));
|
double(moveOffset().y()) / double(oldGeo.height()) * double(geom_restore.height())));
|
||||||
if (rules()->checkMaximize(MaximizeRestore) == MaximizeRestore)
|
if (rules()->checkMaximize(MaximizeRestore) == MaximizeRestore)
|
||||||
|
@ -2842,9 +2843,14 @@ void Client::handleMoveResize(const QPoint &local, const QPoint &global)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::handleMoveResize(int x, int y, int x_root, int y_root)
|
bool Client::isWaitingForMoveResizeSync() const
|
||||||
{
|
{
|
||||||
if (syncRequest.isPending && isResize())
|
return syncRequest.isPending && isResize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractClient::handleMoveResize(int x, int y, int x_root, int y_root)
|
||||||
|
{
|
||||||
|
if (isWaitingForMoveResizeSync())
|
||||||
return; // we're still waiting for the client or the timeout
|
return; // we're still waiting for the client or the timeout
|
||||||
|
|
||||||
const Position mode = moveResizePointerMode();
|
const Position mode = moveResizePointerMode();
|
||||||
|
@ -2866,7 +2872,7 @@ void Client::handleMoveResize(int x, int y, int x_root, int y_root)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ShadeHover or ShadeActive, ShadeNormal was already avoided above
|
// ShadeHover or ShadeActive, ShadeNormal was already avoided above
|
||||||
if (mode != PositionCenter && shade_mode != ShadeNone)
|
if (mode != PositionCenter && shadeMode() != ShadeNone)
|
||||||
setShade(ShadeNone);
|
setShade(ShadeNone);
|
||||||
|
|
||||||
QPoint globalPos(x_root, y_root);
|
QPoint globalPos(x_root, y_root);
|
||||||
|
@ -3154,6 +3160,17 @@ void Client::handleMoveResize(int x, int y, int x_root, int y_root)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (isResize() && !haveResizeEffect()) {
|
if (isResize() && !haveResizeEffect()) {
|
||||||
|
doResizeSync();
|
||||||
|
} else
|
||||||
|
performMoveResize();
|
||||||
|
|
||||||
|
if (isMove()) {
|
||||||
|
ScreenEdges::self()->check(globalPos, QDateTime::fromMSecsSinceEpoch(xTime()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Client::doResizeSync()
|
||||||
|
{
|
||||||
if (!syncRequest.timeout) {
|
if (!syncRequest.timeout) {
|
||||||
syncRequest.timeout = new QTimer(this);
|
syncRequest.timeout = new QTimer(this);
|
||||||
connect(syncRequest.timeout, &QTimer::timeout, this, &Client::performMoveResize);
|
connect(syncRequest.timeout, &QTimer::timeout, this, &Client::performMoveResize);
|
||||||
|
@ -3168,12 +3185,6 @@ void Client::handleMoveResize(int x, int y, int x_root, int y_root)
|
||||||
} // and no human can control faster resizes anyway
|
} // and no human can control faster resizes anyway
|
||||||
const QRect &moveResizeGeom = moveResizeGeometry();
|
const QRect &moveResizeGeom = moveResizeGeometry();
|
||||||
m_client.setGeometry(0, 0, moveResizeGeom.width() - (borderLeft() + borderRight()), moveResizeGeom.height() - (borderTop() + borderBottom()));
|
m_client.setGeometry(0, 0, moveResizeGeom.width() - (borderLeft() + borderRight()), moveResizeGeom.height() - (borderTop() + borderBottom()));
|
||||||
} else
|
|
||||||
performMoveResize();
|
|
||||||
|
|
||||||
if (isMove()) {
|
|
||||||
ScreenEdges::self()->check(globalPos, QDateTime::fromMSecsSinceEpoch(xTime()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractClient::performMoveResize()
|
void AbstractClient::performMoveResize()
|
||||||
|
|
Loading…
Reference in New Issue