xcb: use predefined XCB_ATOM_ atoms, don’t request them
This commit is contained in:
parent
c8e6de1382
commit
7951445849
@ -21,14 +21,5 @@ xmacro(UTF8_STRING)
|
||||
xmacro(WM_STATE)
|
||||
xmacro(WM_CLIENT_LEADER)
|
||||
xmacro(WM_TAKE_FOCUS)
|
||||
xmacro(WM_HINTS)
|
||||
xmacro(WM_NORMAL_HINTS)
|
||||
xmacro(WM_TRANSIENT_FOR)
|
||||
xmacro(ATOM)
|
||||
xmacro(WINDOW)
|
||||
xmacro(WM_NAME)
|
||||
xmacro(WM_CLASS)
|
||||
xmacro(STRING)
|
||||
xmacro(CARDINAL)
|
||||
xmacro(I3_SOCKET_PATH)
|
||||
xmacro(I3_CONFIG_PATH)
|
||||
|
@ -22,4 +22,14 @@
|
||||
#define xcb_icccm_wm_hints_get_urgency xcb_wm_hints_get_urgency
|
||||
#define xcb_icccm_get_wm_transient_for_from_reply xcb_get_wm_transient_for_from_reply
|
||||
|
||||
#define XCB_ATOM_CARDINAL CARDINAL
|
||||
#define XCB_ATOM_WINDOW WINDOW
|
||||
#define XCB_ATOM_WM_TRANSIENT_FOR WM_TRANSIENT_FOR
|
||||
#define XCB_ATOM_WM_NAME WM_NAME
|
||||
#define XCB_ATOM_WM_CLASS WM_CLASS
|
||||
#define XCB_ATOM_WM_HINTS WM_HINTS
|
||||
#define XCB_ATOM_ATOM ATOM
|
||||
#define XCB_ATOM_WM_NORMAL_HINTS WM_NORMAL_HINTS
|
||||
#define XCB_ATOM_STRING STRING
|
||||
|
||||
#endif
|
||||
|
@ -534,7 +534,7 @@ update_netwm_state:
|
||||
values[num++] = A__NET_WM_STATE_FULLSCREEN;
|
||||
|
||||
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, con->window->id,
|
||||
A__NET_WM_STATE, A_ATOM, 32, num, values);
|
||||
A__NET_WM_STATE, XCB_ATOM_ATOM, 32, num, values);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -31,7 +31,7 @@ void ewmh_update_current_desktop() {
|
||||
TAILQ_FOREACH(ws, &(output_get_content(output)->nodes_head), nodes) {
|
||||
if (ws == focused_ws) {
|
||||
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root,
|
||||
A__NET_CURRENT_DESKTOP, A_CARDINAL, 32, 1, &idx);
|
||||
A__NET_CURRENT_DESKTOP, XCB_ATOM_CARDINAL, 32, 1, &idx);
|
||||
return;
|
||||
}
|
||||
++idx;
|
||||
@ -48,7 +48,7 @@ void ewmh_update_current_desktop() {
|
||||
*/
|
||||
void ewmh_update_active_window(xcb_window_t window) {
|
||||
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root,
|
||||
A__NET_ACTIVE_WINDOW, A_WINDOW, 32, 1, &window);
|
||||
A__NET_ACTIVE_WINDOW, XCB_ATOM_WINDOW, 32, 1, &window);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -104,7 +104,7 @@ void ewmh_update_workarea() {
|
||||
}
|
||||
}
|
||||
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root,
|
||||
A__NET_WORKAREA, A_CARDINAL, 32,
|
||||
A__NET_WORKAREA, XCB_ATOM_CARDINAL, 32,
|
||||
num_workspaces * (sizeof(Rect) / sizeof(uint32_t)),
|
||||
workarea);
|
||||
free(workarea);
|
||||
@ -122,7 +122,7 @@ void ewmh_update_client_list_stacking(xcb_window_t *stack, int num_windows) {
|
||||
XCB_PROP_MODE_REPLACE,
|
||||
root,
|
||||
A__NET_CLIENT_LIST_STACKING,
|
||||
A_WINDOW,
|
||||
XCB_ATOM_WINDOW,
|
||||
32,
|
||||
num_windows,
|
||||
stack);
|
||||
|
@ -856,7 +856,7 @@ static bool handle_transient_for(void *data, xcb_connection_t *conn, uint8_t sta
|
||||
|
||||
if (prop == NULL) {
|
||||
prop = xcb_get_property_reply(conn, xcb_get_property_unchecked(conn,
|
||||
false, window, A_WM_TRANSIENT_FOR, A_WINDOW, 0, 32), NULL);
|
||||
false, window, XCB_ATOM_WM_TRANSIENT_FOR, XCB_ATOM_WINDOW, 0, 32), NULL);
|
||||
if (prop == NULL)
|
||||
return false;
|
||||
}
|
||||
@ -887,7 +887,7 @@ static bool handle_clientleader_change(void *data, xcb_connection_t *conn, uint8
|
||||
|
||||
if (prop == NULL) {
|
||||
prop = xcb_get_property_reply(conn, xcb_get_property_unchecked(conn,
|
||||
false, window, A_WM_CLIENT_LEADER, A_WINDOW, 0, 32), NULL);
|
||||
false, window, A_WM_CLIENT_LEADER, XCB_ATOM_WINDOW, 0, 32), NULL);
|
||||
if (prop == NULL)
|
||||
return false;
|
||||
}
|
||||
@ -961,11 +961,11 @@ static struct property_handler_t property_handlers[] = {
|
||||
*/
|
||||
void property_handlers_init() {
|
||||
property_handlers[0].atom = A__NET_WM_NAME;
|
||||
property_handlers[1].atom = A_WM_HINTS;
|
||||
property_handlers[2].atom = A_WM_NAME;
|
||||
property_handlers[3].atom = A_WM_NORMAL_HINTS;
|
||||
property_handlers[1].atom = XCB_ATOM_WM_HINTS;
|
||||
property_handlers[2].atom = XCB_ATOM_WM_NAME;
|
||||
property_handlers[3].atom = XCB_ATOM_WM_NORMAL_HINTS;
|
||||
property_handlers[4].atom = A_WM_CLIENT_LEADER;
|
||||
property_handlers[5].atom = A_WM_TRANSIENT_FOR;
|
||||
property_handlers[5].atom = XCB_ATOM_WM_TRANSIENT_FOR;
|
||||
}
|
||||
|
||||
static void property_notify(uint8_t state, xcb_window_t window, xcb_atom_t atom) {
|
||||
|
@ -396,9 +396,9 @@ int main(int argc, char *argv[]) {
|
||||
#include "atoms.xmacro"
|
||||
#undef xmacro
|
||||
};
|
||||
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root, A__NET_SUPPORTED, A_ATOM, 32, 16, supported_atoms);
|
||||
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root, A__NET_SUPPORTED, XCB_ATOM_ATOM, 32, 16, supported_atoms);
|
||||
/* Set up the window manager’s name */
|
||||
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root, A__NET_SUPPORTING_WM_CHECK, A_WINDOW, 32, 1, &root);
|
||||
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root, A__NET_SUPPORTING_WM_CHECK, XCB_ATOM_WINDOW, 32, 1, &root);
|
||||
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root, A__NET_WM_NAME, A_UTF8_STRING, 8, strlen("i3"), "i3");
|
||||
|
||||
keysyms = xcb_key_symbols_alloc(conn);
|
||||
|
@ -142,9 +142,9 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
|
||||
state_cookie = GET_PROPERTY(A__NET_WM_STATE, UINT32_MAX);
|
||||
utf8_title_cookie = GET_PROPERTY(A__NET_WM_NAME, 128);
|
||||
leader_cookie = GET_PROPERTY(A_WM_CLIENT_LEADER, UINT32_MAX);
|
||||
transient_cookie = GET_PROPERTY(A_WM_TRANSIENT_FOR, UINT32_MAX);
|
||||
title_cookie = GET_PROPERTY(A_WM_NAME, 128);
|
||||
class_cookie = GET_PROPERTY(A_WM_CLASS, 128);
|
||||
transient_cookie = GET_PROPERTY(XCB_ATOM_WM_TRANSIENT_FOR, UINT32_MAX);
|
||||
title_cookie = GET_PROPERTY(XCB_ATOM_WM_NAME, 128);
|
||||
class_cookie = GET_PROPERTY(XCB_ATOM_WM_CLASS, 128);
|
||||
/* TODO: also get wm_normal_hints here. implement after we got rid of xcb-event */
|
||||
|
||||
DLOG("reparenting!\n");
|
||||
|
2
src/x.c
2
src/x.c
@ -518,7 +518,7 @@ void x_push_node(Con *con) {
|
||||
DLOG("pushing name %s for con %p\n", state->name, con);
|
||||
|
||||
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, con->frame,
|
||||
A_WM_NAME, A_STRING, 8, strlen(state->name), state->name);
|
||||
XCB_ATOM_WM_NAME, XCB_ATOM_STRING, 8, strlen(state->name), state->name);
|
||||
FREE(state->name);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user