Fix X11Window wrapper window geometry

This amends 66a491bda6.

There are a few more cases that had been overlooked in the original patch.
This commit is contained in:
Vlad Zahorodnii 2024-02-06 10:13:13 +02:00
parent 9c0947ae15
commit 2556378dfa
4 changed files with 18 additions and 12 deletions

View file

@ -318,7 +318,7 @@ QString EffectWindow::windowClass() const
QRectF EffectWindow::contentsRect() const
{
return QRectF(d->m_window->clientPos(), d->m_window->clientSize());
return d->m_window->clientGeometry().translated(-d->m_window->bufferGeometry().topLeft());
}
NET::WindowType EffectWindow::windowType() const

View file

@ -607,10 +607,6 @@ public:
bool isOnActiveOutput() const;
Output *output() const;
void setOutput(Output *output);
QPointF clientPos() const
{
return QPointF(borderLeft(), borderTop());
}; // inside of geometry()
QSizeF clientSize() const;
/**
* Returns a rectangle that the window occupies on the screen, including drop-shadows.

View file

@ -1551,8 +1551,8 @@ void X11Window::updateShape()
XCB_SHAPE_SK_BOUNDING,
XCB_SHAPE_SK_BOUNDING,
frameId(),
Xcb::toXNative(clientPos().x()),
Xcb::toXNative(clientPos().y()),
Xcb::toXNative(wrapperPos().x()),
Xcb::toXNative(wrapperPos().y()),
window());
}
} else if (app_noborder) {
@ -1605,16 +1605,16 @@ void X11Window::updateInputShape()
XCB_SHAPE_SK_INPUT,
XCB_SHAPE_SK_BOUNDING,
shape_helper_window,
Xcb::toXNative(clientPos().x()),
Xcb::toXNative(clientPos().y()),
Xcb::toXNative(wrapperPos().x()),
Xcb::toXNative(wrapperPos().y()),
window());
xcb_shape_combine(c,
XCB_SHAPE_SO_UNION,
XCB_SHAPE_SK_INPUT,
XCB_SHAPE_SK_INPUT,
shape_helper_window,
Xcb::toXNative(clientPos().x()),
Xcb::toXNative(clientPos().y()),
Xcb::toXNative(wrapperPos().x()),
Xcb::toXNative(wrapperPos().y()),
window());
xcb_shape_combine(c, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_INPUT, XCB_SHAPE_SK_INPUT,
frameId(), 0, 0, shape_helper_window);
@ -2866,6 +2866,15 @@ QRectF X11Window::frameRectToBufferRect(const QRectF &rect) const
return frameRectToClientRect(rect);
}
/**
* Returns the position of the wrapper window relative to the frame window. On X11, it
* is the same as QPoint(borderLeft(), borderTop()). On Wayland, it's QPoint(0, 0).
*/
QPointF X11Window::wrapperPos() const
{
return m_clientGeometry.topLeft() - m_bufferGeometry.topLeft();
}
/**
* Returns the natural size of the window, if the window is not shaded it's the same
* as size().
@ -4848,7 +4857,7 @@ void X11Window::doInteractiveResizeSync(const QRectF &rect)
// to resize the frame window in order to forcefully reallocate offscreen storage. If we don't do
// this, then we might render partially updated client window. I know, it sucks.
m_frame.setGeometry(moveResizeBufferGeometry);
m_wrapper.setGeometry(QRectF(clientPos(), moveResizeClientGeometry.size()));
m_wrapper.setGeometry(moveResizeClientGeometry.translated(-moveResizeBufferGeometry.topLeft()));
m_client.setGeometry(QRectF(QPointF(0, 0), moveResizeClientGeometry.size()));
}

View file

@ -94,6 +94,7 @@ public:
QSizeF frameSizeToClientSize(const QSizeF &size) const override;
QSizeF clientSizeToFrameSize(const QSizeF &size) const override;
QRectF frameRectToBufferRect(const QRectF &rect) const;
QPointF wrapperPos() const;
QSizeF implicitSize() const;
xcb_visualid_t visual() const;