Rework how geometry updates blocking is handled in X11Window
Process the geometry update as usual but just avoid confuguring the x windows. It simplifies the implementation of the move resize function and makes it more refactorable.
This commit is contained in:
parent
801fecf821
commit
6acc652487
2 changed files with 25 additions and 41 deletions
|
@ -4294,15 +4294,11 @@ bool X11Window::isMaximizable() const
|
|||
void X11Window::blockGeometryUpdates(bool block)
|
||||
{
|
||||
if (block) {
|
||||
if (m_blockGeometryUpdates == 0) {
|
||||
m_pendingMoveResizeMode = MoveResizeMode::None;
|
||||
}
|
||||
++m_blockGeometryUpdates;
|
||||
} else {
|
||||
if (--m_blockGeometryUpdates == 0) {
|
||||
if (m_pendingMoveResizeMode != MoveResizeMode::None) {
|
||||
moveResizeInternal(moveResizeGeometry(), m_pendingMoveResizeMode);
|
||||
m_pendingMoveResizeMode = MoveResizeMode::None;
|
||||
if (m_lastBufferGeometry != m_bufferGeometry || m_lastFrameGeometry != m_frameGeometry || m_lastClientGeometry != m_clientGeometry) {
|
||||
updateServerGeometry();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4330,46 +4326,40 @@ void X11Window::moveResizeInternal(const QRectF &rect, MoveResizeMode mode)
|
|||
}
|
||||
|
||||
QRectF frameGeometry = Xcb::fromXNative(Xcb::toXNative(rect));
|
||||
|
||||
QRectF clientGeometry = m_clientGeometry;
|
||||
if (shade_geometry_change) {
|
||||
; // nothing
|
||||
} else if (isShade()) {
|
||||
if (frameGeometry.height() == borderTop() + borderBottom()) {
|
||||
qCDebug(KWIN_CORE) << "Shaded geometry passed for size:";
|
||||
} else {
|
||||
m_clientGeometry = frameRectToClientRect(frameGeometry);
|
||||
clientGeometry = frameRectToClientRect(frameGeometry);
|
||||
frameGeometry.setHeight(borderTop() + borderBottom());
|
||||
}
|
||||
} else {
|
||||
m_clientGeometry = frameRectToClientRect(frameGeometry);
|
||||
clientGeometry = frameRectToClientRect(frameGeometry);
|
||||
}
|
||||
m_frameGeometry = frameGeometry;
|
||||
m_bufferGeometry = frameRectToBufferRect(frameGeometry);
|
||||
const QRectF bufferGeometry = frameRectToBufferRect(frameGeometry);
|
||||
|
||||
if (pendingMoveResizeMode() == MoveResizeMode::None && m_lastBufferGeometry == m_bufferGeometry && m_lastFrameGeometry == m_frameGeometry && m_lastClientGeometry == m_clientGeometry) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_output = workspace()->outputAt(frameGeometry.center());
|
||||
if (areGeometryUpdatesBlocked()) {
|
||||
setPendingMoveResizeMode(mode);
|
||||
if (m_bufferGeometry == bufferGeometry && m_clientGeometry == clientGeometry && m_frameGeometry == frameGeometry) {
|
||||
return;
|
||||
}
|
||||
|
||||
Q_EMIT frameGeometryAboutToChange();
|
||||
const QRectF oldBufferGeometry = m_lastBufferGeometry;
|
||||
const QRectF oldFrameGeometry = m_lastFrameGeometry;
|
||||
const QRectF oldClientGeometry = m_lastClientGeometry;
|
||||
const Output *oldOutput = m_lastOutput;
|
||||
|
||||
const QRectF oldBufferGeometry = m_bufferGeometry;
|
||||
const QRectF oldFrameGeometry = m_frameGeometry;
|
||||
const QRectF oldClientGeometry = m_clientGeometry;
|
||||
const Output *oldOutput = m_output;
|
||||
|
||||
m_frameGeometry = frameGeometry;
|
||||
m_clientGeometry = clientGeometry;
|
||||
m_bufferGeometry = bufferGeometry;
|
||||
m_output = workspace()->outputAt(frameGeometry.center());
|
||||
|
||||
updateServerGeometry();
|
||||
updateWindowRules(Rules::Position | Rules::Size);
|
||||
|
||||
m_lastBufferGeometry = m_bufferGeometry;
|
||||
m_lastFrameGeometry = m_frameGeometry;
|
||||
m_lastClientGeometry = m_clientGeometry;
|
||||
m_lastOutput = m_output;
|
||||
|
||||
if (isActive()) {
|
||||
workspace()->setActiveOutput(output());
|
||||
}
|
||||
|
@ -4392,6 +4382,10 @@ void X11Window::moveResizeInternal(const QRectF &rect, MoveResizeMode mode)
|
|||
|
||||
void X11Window::updateServerGeometry()
|
||||
{
|
||||
if (areGeometryUpdatesBlocked()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const QRectF oldBufferGeometry = m_lastBufferGeometry;
|
||||
|
||||
// Compute the old client rect, the client geometry is always inside the buffer geometry.
|
||||
|
@ -4424,6 +4418,10 @@ void X11Window::updateServerGeometry()
|
|||
// Unconditionally move the input window: it won't affect rendering
|
||||
m_decoInputExtent.move(pos().toPoint() + inputPos());
|
||||
}
|
||||
|
||||
m_lastBufferGeometry = m_bufferGeometry;
|
||||
m_lastFrameGeometry = m_frameGeometry;
|
||||
m_lastClientGeometry = m_clientGeometry;
|
||||
}
|
||||
|
||||
static bool changeMaximizeRecursion = false;
|
||||
|
|
|
@ -474,8 +474,6 @@ private:
|
|||
void cleanGrouping();
|
||||
void checkGroupTransients();
|
||||
void setTransient(xcb_window_t new_transient_for_id);
|
||||
MoveResizeMode pendingMoveResizeMode() const;
|
||||
void setPendingMoveResizeMode(MoveResizeMode mode);
|
||||
|
||||
NETWinInfo *info = nullptr;
|
||||
xcb_window_t m_transientForId;
|
||||
|
@ -529,12 +527,10 @@ private:
|
|||
QMetaObject::Connection m_edgeGeometryTrackingConnection;
|
||||
|
||||
QMarginsF m_clientFrameExtents;
|
||||
Output *m_lastOutput = nullptr;
|
||||
QRectF m_lastBufferGeometry;
|
||||
QRectF m_lastFrameGeometry;
|
||||
QRectF m_lastClientGeometry;
|
||||
int m_blockGeometryUpdates = 0; // > 0 = New geometry is remembered, but not actually set
|
||||
MoveResizeMode m_pendingMoveResizeMode = MoveResizeMode::None;
|
||||
|
||||
std::unique_ptr<X11DecorationRenderer> m_decorationRenderer;
|
||||
|
||||
|
@ -684,16 +680,6 @@ inline void X11Window::unblockGeometryUpdates()
|
|||
m_blockGeometryUpdates--;
|
||||
}
|
||||
|
||||
inline Window::MoveResizeMode X11Window::pendingMoveResizeMode() const
|
||||
{
|
||||
return m_pendingMoveResizeMode;
|
||||
}
|
||||
|
||||
inline void X11Window::setPendingMoveResizeMode(MoveResizeMode mode)
|
||||
{
|
||||
m_pendingMoveResizeMode = MoveResizeMode(uint(m_pendingMoveResizeMode) | uint(mode));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
Q_DECLARE_METATYPE(KWin::X11Window *)
|
||||
Q_DECLARE_METATYPE(QList<KWin::X11Window *>)
|
||||
|
|
Loading…
Reference in a new issue