diff --git a/src/effect/effectwindow.cpp b/src/effect/effectwindow.cpp index e46687bdf5..e6a57629ca 100644 --- a/src/effect/effectwindow.cpp +++ b/src/effect/effectwindow.cpp @@ -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 diff --git a/src/window.h b/src/window.h index 5209cd87c8..1f6040b207 100644 --- a/src/window.h +++ b/src/window.h @@ -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. diff --git a/src/x11window.cpp b/src/x11window.cpp index d2c96b5cf7..9899e5e24b 100644 --- a/src/x11window.cpp +++ b/src/x11window.cpp @@ -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())); } diff --git a/src/x11window.h b/src/x11window.h index 9ca21519e5..5094dfe77c 100644 --- a/src/x11window.h +++ b/src/x11window.h @@ -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;