2 * vim:ts=4:sw=4:expandtab
4 * i3 - an improved dynamic tiling window manager
6 * © 2009-2011 Michael Stapelberg and contributors
8 * See file LICENSE for license information.
15 #include <xcb/xproto.h>
20 * Generates a configure_notify event and sends it to the given window
21 * Applications need this to think they’ve configured themselves correctly.
22 * The truth is, however, that we will manage them.
25 void fake_configure_notify(xcb_connection_t *conn, xcb_rectangle_t r, xcb_window_t window, int border_width) {
26 /* Every X11 event is 32 bytes long. Therefore, XCB will copy 32 bytes.
27 * In order to properly initialize these bytes, we allocate 32 bytes even
28 * though we only need less for an xcb_configure_notify_event_t */
29 void *event = scalloc(32);
30 xcb_configure_notify_event_t *generated_event = event;
32 generated_event->event = window;
33 generated_event->window = window;
34 generated_event->response_type = XCB_CONFIGURE_NOTIFY;
36 generated_event->x = r.x;
37 generated_event->y = r.y;
38 generated_event->width = r.width;
39 generated_event->height = r.height;
41 generated_event->border_width = border_width;
42 generated_event->above_sibling = XCB_NONE;
43 generated_event->override_redirect = false;
45 xcb_send_event(conn, false, window, XCB_EVENT_MASK_STRUCTURE_NOTIFY, (char*)generated_event);