Add a reparent() method to Xcb::Window

Reparents the managed window to the passed in parent window.
This commit is contained in:
Martin Gräßlin 2013-09-10 09:20:12 +02:00
parent 4215599e97
commit 49da9a8fdb
3 changed files with 12 additions and 2 deletions

View file

@ -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->kde_net_wm_user_creation_time);
xcb_delete_property(c, m_client, atoms->net_frame_extents); xcb_delete_property(c, m_client, atoms->net_frame_extents);
xcb_delete_property(c, m_client, atoms->kde_net_wm_frame_strut); 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); xcb_change_save_set(c, XCB_SET_MODE_DELETE, m_client);
m_client.selectInput(XCB_EVENT_MASK_NO_EVENT); m_client.selectInput(XCB_EVENT_MASK_NO_EVENT);
if (on_shutdown) if (on_shutdown)

View file

@ -687,7 +687,7 @@ void Client::embedClient(xcb_window_t w, const XWindowAttributes& attr)
XCB_WINDOW_CLASS_INPUT_OUTPUT, visualid, cw_mask, cw_values); XCB_WINDOW_CLASS_INPUT_OUTPUT, visualid, cw_mask, cw_values);
m_wrapper.reset(wrapperId); 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 // 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 // Xlib code didn't. Let's preserve that behavior here for now so we don't end up

View file

@ -435,6 +435,7 @@ public:
void lower(); void lower();
void map(); void map();
void unmap(); 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. * 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); 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 inline
void Window::clear() void Window::clear()
{ {