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