2 * vim:ts=4:sw=4:expandtab
9 #include <xcb/xproto.h>
12 * Try to get the socket path from X11 and return NULL if it doesn’t work.
14 * The memory for the socket path is dynamically allocated and has to be
15 * free()d by the caller.
18 char *socket_path_from_x11();
21 * Safe-wrapper around malloc which exits if malloc returns NULL (meaning that
22 * there is no more memory available)
25 void *smalloc(size_t size);
28 * Safe-wrapper around calloc which exits if malloc returns NULL (meaning that
29 * there is no more memory available)
32 void *scalloc(size_t size);
35 * Safe-wrapper around realloc which exits if realloc returns NULL (meaning
36 * that there is no more memory available).
39 void *srealloc(void *ptr, size_t size);
42 * Safe-wrapper around strdup which exits if malloc returns NULL (meaning that
43 * there is no more memory available)
46 char *sstrdup(const char *str);
49 * Formats a message (payload) of the given size and type and sends it to i3 via
50 * the given socket file descriptor.
52 * Returns -1 when write() fails, errno will remain.
53 * Returns 0 on success.
56 int ipc_send_message(int sockfd, uint32_t message_size,
57 uint32_t message_type, const uint8_t *payload);
60 * Reads a message from the given socket file descriptor and stores its length
61 * (reply_length) as well as a pointer to its contents (reply).
63 * Returns -1 when read() fails, errno will remain.
64 * Returns -2 when the IPC protocol is violated (invalid magic, unexpected
65 * message type, EOF instead of a message). Additionally, the error will be
67 * Returns 0 on success.
70 int ipc_recv_message(int sockfd, uint32_t message_type,
71 uint32_t *reply_length, uint8_t **reply);
74 * Generates a configure_notify event and sends it to the given window
75 * Applications need this to think they’ve configured themselves correctly.
76 * The truth is, however, that we will manage them.
79 void fake_configure_notify(xcb_connection_t *conn, xcb_rectangle_t r, xcb_window_t window, int border_width);