Commit 1dd16336 authored by Brian Nguyen's avatar Brian Nguyen Committed by Martin Flöser
Browse files

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
parent 9adb5006
......@@ -135,6 +135,7 @@ Client::Client(Workspace* ws)
, electricMaximizing(false)
, activitiesDefined(false)
, needsSessionInteract(false)
, needsXWindowMove(false)
#ifdef KWIN_BUILD_KAPPMENU
, m_menuAvailable(false)
#endif
......
......@@ -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;
......
......@@ -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;
......
Supports Markdown
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