diff --git a/debian/control b/debian/control index 06efef76..6ad86a06 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: i3-wm Section: utils Priority: optional Maintainer: Michael Stapelberg -Build-Depends: debhelper (>= 5), libxcb-wm0-dev (>= 0.3.3), libxcb-aux0-dev (>= 0.3.3), asciidoc +Build-Depends: debhelper (>= 5), libx11-dev, libxcb-wm0-dev (>= 0.3.3), libxcb-aux0-dev (>= 0.3.3), asciidoc Standards-Version: 3.8.0 Homepage: http://i3.zekjur.net/ diff --git a/include/xcb.h b/include/xcb.h index 31307e33..338114e5 100644 --- a/include/xcb.h +++ b/include/xcb.h @@ -58,5 +58,6 @@ void xcb_draw_line(xcb_connection_t *conn, xcb_drawable_t drawable, xcb_gcontext uint32_t colorpixel, uint32_t x, uint32_t y, uint32_t to_x, uint32_t to_y); void xcb_draw_rect(xcb_connection_t *conn, xcb_drawable_t drawable, xcb_gcontext_t gc, uint32_t colorpixel, uint32_t x, uint32_t y, uint32_t width, uint32_t height); +void fake_configure_notify(xcb_connection_t *conn, Rect r, xcb_window_t window); #endif diff --git a/src/handlers.c b/src/handlers.c index 8278a89a..ef28ae7c 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -447,27 +447,13 @@ int handle_configure_request(void *prophs, xcb_connection_t *conn, xcb_configure Client *client = table_get(byChild, event->window); if (client == NULL) { - LOG("No such client\n"); + LOG("This client is not mapped, so we don't care and just tell the client that he will get its size\n"); + Rect rect = {event->x, event->y, event->width, event->height}; + fake_configure_notify(conn, rect, event->window); return 1; } - xcb_configure_notify_event_t generated_event; - - generated_event.event = client->child; - generated_event.window = client->child; - generated_event.response_type = XCB_CONFIGURE_NOTIFY; - - generated_event.x = client->child_rect.x; - generated_event.y = client->child_rect.y; - generated_event.width = client->child_rect.width; - generated_event.height = client->child_rect.height; - - generated_event.border_width = 0; - generated_event.above_sibling = XCB_NONE; - generated_event.override_redirect = false; - - xcb_send_event(conn, false, client->child, XCB_EVENT_MASK_STRUCTURE_NOTIFY, (char*)&generated_event); - xcb_flush(conn); + fake_configure_notify(conn, client->child_rect, client->child); LOG("Told the client to stay at %dx%d with size %dx%d\n", client->child_rect.x, client->child_rect.y, client->child_rect.width, client->child_rect.height); diff --git a/src/layout.c b/src/layout.c index 547b7c52..4f1bdb36 100644 --- a/src/layout.c +++ b/src/layout.c @@ -263,22 +263,7 @@ static void resize_client(xcb_connection_t *conn, Client *client) { /* After configuring a child window we need to fake a configure_notify_event according to ICCCM 4.2.3. This seems rather broken, especially since X sends exactly the same configure_notify_event automatically according to xtrace. Anyone knows details? */ - xcb_configure_notify_event_t event; - - event.event = client->child; - event.window = client->child; - event.response_type = XCB_CONFIGURE_NOTIFY; - - event.x = rect->x; - event.y = rect->y; - event.width = rect->width; - event.height = rect->height; - - event.border_width = 0; - event.above_sibling = XCB_NONE; - event.override_redirect = false; - - xcb_send_event(conn, false, client->child, XCB_EVENT_MASK_STRUCTURE_NOTIFY, (char*)&event); + fake_configure_notify(conn, rect, client->child); } /* diff --git a/src/xcb.c b/src/xcb.c index 5b426098..802acc81 100644 --- a/src/xcb.c +++ b/src/xcb.c @@ -181,3 +181,29 @@ void xcb_draw_rect(xcb_connection_t *conn, xcb_drawable_t drawable, xcb_gcontext xcb_rectangle_t rect = {x, y, width, height}; xcb_poly_fill_rectangle(conn, drawable, gc, 1, &rect); } + +/* + * Generates a configure_notify event and sends it to the given window + * Applications need this to think they’ve configured themselves correctly. + * The truth is, however, that we will manage them. + * + */ +void fake_configure_notify(xcb_connection_t *conn, Rect r, xcb_window_t window) { + xcb_configure_notify_event_t generated_event; + + generated_event.event = window; + generated_event.window = window; + generated_event.response_type = XCB_CONFIGURE_NOTIFY; + + generated_event.x = r.x; + generated_event.y = r.y; + generated_event.width = r.width; + generated_event.height = r.height; + + generated_event.border_width = 0; + generated_event.above_sibling = XCB_NONE; + generated_event.override_redirect = false; + + xcb_send_event(conn, false, window, XCB_EVENT_MASK_STRUCTURE_NOTIFY, (char*)&generated_event); + xcb_flush(conn); +}