Optimize away XMoveWindow() calls in the common click-and-drag case

This implements an optimization similar to one in compiz which defers updating
the backing X window during a window move until the move is terminated. This
helps alleviate some choppiness when using composite + vsync.

REVIEW: 107256
icc-effect-5.14.5
Brian Nguyen 2012-11-07 15:54:05 -08:00 committed by Martin Gräßlin
parent 6979e0a9eb
commit a04e9cbc6f
3 changed files with 15 additions and 1 deletions

View File

@ -135,6 +135,7 @@ Client::Client(Workspace* ws)
, electricMaximizing(false)
, activitiesDefined(false)
, needsSessionInteract(false)
, needsXWindowMove(false)
#ifdef KWIN_BUILD_KAPPMENU
, m_menuAvailable(false)
#endif

View File

@ -987,6 +987,7 @@ private:
bool activitiesDefined; //whether the x property was actually set
bool needsSessionInteract;
bool needsXWindowMove;
#ifdef KWIN_BUILD_KAPPMENU
bool m_menuAvailable;

View File

@ -1902,7 +1902,14 @@ void Client::setGeometry(int x, int y, int w, int h, ForceGeometry_t force)
}
updateShape();
} else {
XMoveWindow(display(), frameId(), x, y);
if (moveResizeMode && compositing()) {
// Defer the X update until we leave this mode
needsXWindowMove = true;
} else {
XMoveWindow(display(), frameId(), x, y);
}
// Unconditionally move the input window: it won't affect rendering
if (inputId()) {
const QPoint pos = QPoint(x, y) + inputPos();
XMoveWindow(display(), inputId(), pos.x(), pos.y());
@ -2665,6 +2672,11 @@ void Client::finishMoveResize(bool cancel)
void Client::leaveMoveResize()
{
if (needsXWindowMove) {
// Do the deferred move
XMoveWindow(display(), frameId(), geom.x(), geom.y());
needsXWindowMove = false;
}
if (geometryTip) {
geometryTip->hide();
delete geometryTip;