From 8f144460d7610ece14bea44fd263caa64f13726e Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Tue, 9 Jul 2024 22:29:44 +0300 Subject: [PATCH] Initialize X11Window::m_client geometry Initialize X11Window::m_client geometry with a proper value so, later, the X11Window::configure() function can properly determine whether the client window is resized. --- src/utils/xcbutils.h | 5 +++-- src/x11window.cpp | 7 ++++--- src/x11window.h | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/utils/xcbutils.h b/src/utils/xcbutils.h index 3b06390518..71a70cc424 100644 --- a/src/utils/xcbutils.h +++ b/src/utils/xcbutils.h @@ -1632,7 +1632,7 @@ public: * object or when reset is called again. If @p destroy is @c false the window will not * be destroyed. It is then the responsibility of the caller to destroy the window. */ - void reset(xcb_window_t window = XCB_WINDOW_NONE, bool destroy = true); + void reset(xcb_window_t window = XCB_WINDOW_NONE, bool destroy = true, const QRect &geometry = QRect()); /** * @returns @c true if a window is managed, @c false otherwise. */ @@ -1777,11 +1777,12 @@ inline xcb_window_t Window::doCreate(const QRect &geometry, uint16_t windowClass return w; } -inline void Window::reset(xcb_window_t window, bool shouldDestroy) +inline void Window::reset(xcb_window_t window, bool shouldDestroy, const QRect &geometry) { destroy(); m_window = window; m_destroy = shouldDestroy; + m_geometry = geometry; } inline void Window::setGeometry(const QRect &geometry) diff --git a/src/x11window.cpp b/src/x11window.cpp index feee869c20..9b162c93b5 100644 --- a/src/x11window.cpp +++ b/src/x11window.cpp @@ -605,7 +605,7 @@ bool X11Window::manage(xcb_window_t w, bool isMapped) // From this place on, manage() must not return false blockGeometryUpdates(); - embedClient(w, attr->visual, attr->colormap, windowGeometry->depth); + embedClient(w, attr->visual, attr->colormap, windowGeometry.rect(), windowGeometry->depth); m_visual = attr->visual; bit_depth = windowGeometry->depth; @@ -1194,12 +1194,13 @@ bool X11Window::manage(xcb_window_t w, bool isMapped) } // Called only from manage() -void X11Window::embedClient(xcb_window_t w, xcb_visualid_t visualid, xcb_colormap_t colormap, uint8_t depth) +void X11Window::embedClient(xcb_window_t w, xcb_visualid_t visualid, xcb_colormap_t colormap, const QRect &nativeGeometry, uint8_t depth) { Q_ASSERT(m_client == XCB_WINDOW_NONE); Q_ASSERT(frameId() == XCB_WINDOW_NONE); Q_ASSERT(m_wrapper == XCB_WINDOW_NONE); - m_client.reset(w, false); + + m_client.reset(w, false, nativeGeometry); const uint32_t zero_value = 0; diff --git a/src/x11window.h b/src/x11window.h index ec84e96093..2882a3114c 100644 --- a/src/x11window.h +++ b/src/x11window.h @@ -396,7 +396,7 @@ private: static void sendClientMessage(xcb_window_t w, xcb_atom_t a, xcb_atom_t protocol, uint32_t data1 = 0, uint32_t data2 = 0, uint32_t data3 = 0); - void embedClient(xcb_window_t w, xcb_visualid_t visualid, xcb_colormap_t colormap, uint8_t depth); + void embedClient(xcb_window_t w, xcb_visualid_t visualid, xcb_colormap_t colormap, const QRect &nativeGeometry, uint8_t depth); void detectNoBorder(); void updateFrameExtents(); void setClientFrameExtents(const NETStrut &strut);