diff --git a/client.cpp b/client.cpp index c95635e7f6..51ad4777de 100644 --- a/client.cpp +++ b/client.cpp @@ -288,7 +288,7 @@ void Client::releaseWindow(bool on_shutdown) xcb_delete_property(c, m_client, atoms->kde_net_wm_user_creation_time); xcb_delete_property(c, m_client, atoms->net_frame_extents); xcb_delete_property(c, m_client, atoms->kde_net_wm_frame_strut); - xcb_reparent_window(c, m_client, rootWindow(), x(), y()); + m_client.reparent(rootWindow(), x(), y()); xcb_change_save_set(c, XCB_SET_MODE_DELETE, m_client); m_client.selectInput(XCB_EVENT_MASK_NO_EVENT); if (on_shutdown) diff --git a/manage.cpp b/manage.cpp index bf79a8f0bf..965f85231b 100644 --- a/manage.cpp +++ b/manage.cpp @@ -687,7 +687,7 @@ void Client::embedClient(xcb_window_t w, const XWindowAttributes& attr) XCB_WINDOW_CLASS_INPUT_OUTPUT, visualid, cw_mask, cw_values); m_wrapper.reset(wrapperId); - xcb_reparent_window(conn, m_client, m_wrapper, 0, 0); + m_client.reparent(m_wrapper); // We could specify the event masks when we create the windows, but the original // Xlib code didn't. Let's preserve that behavior here for now so we don't end up diff --git a/xcbutils.h b/xcbutils.h index 86c909b535..bfafa3a70b 100644 --- a/xcbutils.h +++ b/xcbutils.h @@ -435,6 +435,7 @@ public: void lower(); void map(); void unmap(); + void reparent(xcb_window_t parent, int x = 0, int y = 0); /** * Clears the window area. Same as xcb_clear_area with x, y, width, height being @c 0. **/ @@ -613,6 +614,15 @@ void Window::unmap() xcb_unmap_window(connection(), m_window); } +inline +void Window::reparent(xcb_window_t parent, int x, int y) +{ + if (!isValid()) { + return; + } + xcb_reparent_window(connection(), m_window, parent, x, y); +} + inline void Window::clear() {