diff --git a/events.cpp b/events.cpp index aa814e2dd6..eeb4fd5233 100644 --- a/events.cpp +++ b/events.cpp @@ -741,14 +741,8 @@ void Client::configureRequestEvent(xcb_configure_request_event_t *e) } if (e->value_mask & XCB_CONFIG_WINDOW_BORDER_WIDTH) { - // TODO: port to XCB // first, get rid of a window border - XWindowChanges wc; - unsigned int value_mask = 0; - - wc.border_width = 0; - value_mask = XCB_CONFIG_WINDOW_BORDER_WIDTH; - XConfigureWindow(display(), window(), value_mask, & wc); + m_client.setBorderWidth(0); } if (e->value_mask & (XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_HEIGHT | XCB_CONFIG_WINDOW_WIDTH)) diff --git a/manage.cpp b/manage.cpp index a79f451592..b54fc0cb5a 100644 --- a/manage.cpp +++ b/manage.cpp @@ -643,7 +643,7 @@ void Client::embedClient(xcb_window_t w, const XWindowAttributes& attr) m_client.selectInput(zero_value); m_client.unmap(); - xcb_configure_window(conn, m_client, XCB_CONFIG_WINDOW_BORDER_WIDTH, &zero_value); + m_client.setBorderWidth(zero_value); // Note: These values must match the order in the xcb_cw_t enum const uint32_t cw_values[] = { diff --git a/xcbutils.h b/xcbutils.h index 281185e065..027105cf85 100644 --- a/xcbutils.h +++ b/xcbutils.h @@ -437,6 +437,7 @@ public: void unmap(); void reparent(xcb_window_t parent, int x = 0, int y = 0); void deleteProperty(xcb_atom_t property); + void setBorderWidth(uint32_t width); /** * Clears the window area. Same as xcb_clear_area with x, y, width, height being @c 0. **/ @@ -633,6 +634,15 @@ void Window::deleteProperty(xcb_atom_t property) xcb_delete_property(connection(), m_window, property); } +inline +void Window::setBorderWidth(uint32_t width) +{ + if (!isValid()) { + return; + } + xcb_configure_window(connection(), m_window, XCB_CONFIG_WINDOW_BORDER_WIDTH, &width); +} + inline void Window::clear() {