]> git.sur5r.net Git - i3/i3/blob - src/sync.c
Merge branch 'release-4.16.1'
[i3/i3] / src / sync.c
1 /*
2  * vim:ts=4:sw=4:expandtab
3  *
4  * i3 - an improved dynamic tiling window manager
5  * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
6  *
7  * sync.c: i3 sync protocol: https://i3wm.org/docs/testsuite.html#i3_sync
8  *
9  */
10 #include "all.h"
11
12 void sync_respond(xcb_window_t window, uint32_t rnd) {
13     DLOG("[i3 sync protocol] Sending random value %d back to X11 window 0x%08x\n", rnd, window);
14
15     void *reply = scalloc(32, 1);
16     xcb_client_message_event_t *ev = reply;
17
18     ev->response_type = XCB_CLIENT_MESSAGE;
19     ev->window = window;
20     ev->type = A_I3_SYNC;
21     ev->format = 32;
22     ev->data.data32[0] = window;
23     ev->data.data32[1] = rnd;
24
25     xcb_send_event(conn, false, window, XCB_EVENT_MASK_NO_EVENT, (char *)ev);
26     xcb_flush(conn);
27     free(reply);
28 }