i3
sync.c
Go to the documentation of this file.
1/*
2 * vim:ts=4:sw=4:expandtab
3 *
4 * i3 - an improved 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
12void 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}
void sync_respond(xcb_window_t window, uint32_t rnd)
Definition sync.c:12
xcb_connection_t * conn
XCB connection and root screen.
Definition main.c:54
#define DLOG(fmt,...)
Definition libi3.h:105
void * scalloc(size_t num, size_t size)
Safe-wrapper around calloc which exits if malloc returns NULL (meaning that there is no more memory a...