Commit 9c55c017 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii Committed by Vlad Zahorodnii
Browse files

Introduce a signal that notifies about new buffer geometry

The new signal can be useful if one wants to watch a toplevel for buffer
geometry updates. This can be especially useful for input related code
because the position of the upper left corner of the main surface is used
to compute the input transformation matrix.
parent fc839d8b
......@@ -908,6 +908,7 @@ void AbstractClient::move(int x, int y, ForceGeometry_t force)
screens()->setCurrent(this);
workspace()->updateStackingOrder();
// client itself is not damaged
emit bufferGeometryChanged(this, bufferGeometryBeforeUpdateBlocking());
emit frameGeometryChanged(this, frameGeometryBeforeUpdateBlocking());
addRepaintDuringGeometryUpdates();
updateGeometryBeforeUpdateBlocking();
......
......@@ -531,6 +531,9 @@ void InternalClient::commitGeometry(const QRect &rect)
addWorkspaceRepaint(visibleRect());
syncGeometryToInternalWindow();
if (bufferGeometryBeforeUpdateBlocking() != bufferGeometry()) {
emit bufferGeometryChanged(this, bufferGeometryBeforeUpdateBlocking());
}
if (clientGeometryBeforeUpdateBlocking() != clientGeometry()) {
emit clientGeometryChanged(this, clientGeometryBeforeUpdateBlocking());
}
......
......@@ -657,6 +657,10 @@ Q_SIGNALS:
*/
void shadowChanged();
/**
* This signal is emitted when the Toplevel's buffer geometry changes.
*/
void bufferGeometryChanged(KWin::Toplevel *toplevel, const QRect &oldGeometry);
/**
* This signal is emitted when the Toplevel's frame geometry changes.
*/
......
......@@ -2902,6 +2902,9 @@ void X11Client::move(int x, int y, ForceGeometry_t force)
screens()->setCurrent(this);
workspace()->updateStackingOrder();
// client itself is not damaged
if (bufferGeometryBeforeUpdateBlocking() != bufferGeometry()) {
emit bufferGeometryChanged(this, bufferGeometryBeforeUpdateBlocking());
}
if (clientGeometryBeforeUpdateBlocking() != clientGeometry()) {
emit clientGeometryChanged(this, clientGeometryBeforeUpdateBlocking());
}
......@@ -4197,6 +4200,9 @@ void X11Client::setFrameGeometry(const QRect &rect, ForceGeometry_t force)
if (bufferGeometryBeforeUpdateBlocking().size() != m_bufferGeometry.size()) {
discardWindowPixmap();
}
if (bufferGeometryBeforeUpdateBlocking() != m_bufferGeometry) {
emit bufferGeometryChanged(this, bufferGeometryBeforeUpdateBlocking());
}
if (clientGeometryBeforeUpdateBlocking() != m_clientGeometry) {
emit clientGeometryChanged(this, clientGeometryBeforeUpdateBlocking());
}
......@@ -4257,6 +4263,9 @@ void X11Client::plainResize(int w, int h, ForceGeometry_t force)
if (bufferGeometryBeforeUpdateBlocking().size() != m_bufferGeometry.size()) {
discardWindowPixmap();
}
if (bufferGeometryBeforeUpdateBlocking() != bufferGeometry()) {
emit bufferGeometryChanged(this, bufferGeometryBeforeUpdateBlocking());
}
if (clientGeometryBeforeUpdateBlocking() != clientGeometry()) {
emit clientGeometryChanged(this, clientGeometryBeforeUpdateBlocking());
}
......
......@@ -463,6 +463,9 @@ void XdgSurfaceClient::updateGeometry(const QRect &rect)
updateWindowRules(Rules::Position | Rules::Size);
updateGeometryBeforeUpdateBlocking();
if (changedGeometries & XdgSurfaceGeometryBuffer) {
emit bufferGeometryChanged(this, oldBufferGeometry);
}
if (changedGeometries & XdgSurfaceGeometryClient) {
emit clientGeometryChanged(this, oldClientGeometry);
}
......
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