wayland: Avoid repetitive move() and resize() calls during interactive move/resize

With internal clients and xdg-shell clients, geometry updates occur in
asynchronous fashion when interactively resizing the window.

As is, performInteractiveMoveResize() will call resize() if the move
resize geometry is different from the current frame geometry. This can
result in kwin sending excessive configure events.

With this change, kwin will send less configure events during
interactive resize.
master
Vlad Zahorodnii 3 years ago
parent fcf0b4796f
commit dd7972ce46

@ -1430,25 +1430,25 @@ void AbstractClient::handleInteractiveMoveResize(int x, int y, int x_root, int y
if (!update)
return;
if (isInteractiveResize() && !haveResizeEffect()) {
doInteractiveResizeSync();
} else
performInteractiveMoveResize();
if (isInteractiveMove()) {
move(moveResizeGeometry().topLeft());
completeInteractiveMoveResizeStep();
} else {
if (!haveResizeEffect()) {
doInteractiveResizeSync();
} else {
completeInteractiveMoveResizeStep();
}
}
if (isInteractiveMove()) {
ScreenEdges::self()->check(globalPos, QDateTime::fromMSecsSinceEpoch(xTime(), Qt::UTC));
}
}
void AbstractClient::performInteractiveMoveResize()
void AbstractClient::completeInteractiveMoveResizeStep()
{
const QRect &moveResizeGeom = moveResizeGeometry();
if (isInteractiveMove()) {
move(moveResizeGeom.topLeft());
} else if (isInteractiveResize() && !haveResizeEffect()) {
resize(moveResizeGeom.size());
}
Q_EMIT clientStepUserMovedResized(this, moveResizeGeom);
Q_EMIT clientStepUserMovedResized(this, moveResizeGeometry());
}
StrutRect AbstractClient::strutRect(StrutArea area) const

@ -1158,7 +1158,7 @@ protected:
* ensures that the internal mode is properly ended.
*/
virtual void leaveInteractiveMoveResize();
void performInteractiveMoveResize();
void completeInteractiveMoveResizeStep();
/*
* Checks if the mouse cursor is near the edge of the screen and if so
* activates quick tiling or maximization

@ -404,7 +404,7 @@ void InternalClient::present(const QSharedPointer<QOpenGLFramebufferObject> fbo)
surfaceItem()->addDamage(surfaceItem()->rect());
if (isInteractiveResize()) {
performInteractiveMoveResize();
completeInteractiveMoveResizeStep();
}
}
@ -423,7 +423,7 @@ void InternalClient::present(const QImage &image, const QRegion &damage)
surfaceItem()->addDamage(damage);
if (isInteractiveResize()) {
performInteractiveMoveResize();
completeInteractiveMoveResizeStep();
}
}

@ -2772,12 +2772,20 @@ void X11Client::handleSync()
if (m_syncRequest.timeout) {
m_syncRequest.timeout->stop();
}
performInteractiveMoveResize();
performInteractiveResize();
updateWindowPixmap();
} else // setReadyForPainting does as well, but there's a small chance for resize syncs after the resize ended
addRepaintFull();
}
void X11Client::performInteractiveResize()
{
if (isInteractiveResize() && !haveResizeEffect()) {
resize(moveResizeGeometry().size());
}
completeInteractiveMoveResizeStep();
}
bool X11Client::belongToSameApplication(const X11Client *c1, const X11Client *c2, SameApplicationChecks checks)
{
bool same_app = false;
@ -4583,7 +4591,7 @@ void X11Client::handleSyncTimeout()
if (m_syncRequest.counter == XCB_NONE) { // client w/o XSYNC support. allow the next resize event
m_syncRequest.isPending = false; // NEVER do this for clients with a valid counter
} // (leads to sync request races in some clients)
performInteractiveMoveResize();
performInteractiveResize();
}
NETExtendedStrut X11Client::strut() const

@ -396,6 +396,7 @@ private:
void getSyncCounter();
void sendSyncRequest();
void leaveInteractiveMoveResize() override;
void performInteractiveResize();
void establishCommandWindowGrab(uint8_t button);
void establishCommandAllGrab(uint8_t button);
void resizeDecoration();

@ -245,7 +245,7 @@ void XdgSurfaceClient::handleNextWindowGeometry()
updateGeometry(frameGeometry);
if (isInteractiveResize()) {
performInteractiveMoveResize();
completeInteractiveMoveResizeStep();
}
}

Loading…
Cancel
Save