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.
This commit is contained in:
Vlad Zahorodnii 2024-07-09 22:29:44 +03:00
parent 53b61ce5d7
commit 8f144460d7
3 changed files with 8 additions and 6 deletions

View file

@ -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)

View file

@ -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;

View file

@ -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);