diff --git a/common/xutil.h b/common/xutil.h index 2b1c0ce8d..5d9b75982 100644 --- a/common/xutil.h +++ b/common/xutil.h @@ -27,6 +27,7 @@ #include #include #include +#include #include "common/array.h" #include "common/atoms.h" @@ -35,7 +36,7 @@ static inline char * xutil_get_text_property_from_reply(xcb_get_property_reply_t *reply) { if(reply - && (reply->type == STRING + && (reply->type == XCB_ATOM_STRING || reply->type == UTF8_STRING || reply->type == COMPOUND_TEXT) && reply->format == 8 diff --git a/ewmh.c b/ewmh.c index f38b93a14..0aa5de708 100644 --- a/ewmh.c +++ b/ewmh.c @@ -51,7 +51,7 @@ ewmh_update_desktop_geometry(int phys_screen) xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, xutil_screen_get(globalconf.connection, phys_screen)->root, - _NET_DESKTOP_GEOMETRY, CARDINAL, 32, countof(sizes), sizes); + _NET_DESKTOP_GEOMETRY, XCB_ATOM_CARDINAL, 32, countof(sizes), sizes); } void @@ -109,7 +109,7 @@ ewmh_init(int phys_screen) int i; xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, - xscreen->root, _NET_SUPPORTED, ATOM, 32, + xscreen->root, _NET_SUPPORTED, XCB_ATOM_ATOM, 32, countof(atom), atom); /* create our own window */ @@ -119,11 +119,11 @@ ewmh_init(int phys_screen) XCB_COPY_FROM_PARENT, xscreen->root_visual, 0, NULL); xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, - xscreen->root, _NET_SUPPORTING_WM_CHECK, WINDOW, 32, + xscreen->root, _NET_SUPPORTING_WM_CHECK, XCB_ATOM_WINDOW, 32, 1, &father); xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, - father, _NET_SUPPORTING_WM_CHECK, WINDOW, 32, + father, _NET_SUPPORTING_WM_CHECK, XCB_ATOM_WINDOW, 32, 1, &father); /* set the window manager name */ @@ -133,7 +133,7 @@ ewmh_init(int phys_screen) /* set the window manager PID */ i = getpid(); xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, - father, _NET_WM_PID, CARDINAL, 32, 1, &i); + father, _NET_WM_PID, XCB_ATOM_CARDINAL, 32, 1, &i); ewmh_update_desktop_geometry(phys_screen); } @@ -153,7 +153,7 @@ ewmh_update_net_client_list(int phys_screen) xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, xutil_screen_get(globalconf.connection, phys_screen)->root, - _NET_CLIENT_LIST, WINDOW, 32, n, wins); + _NET_CLIENT_LIST, XCB_ATOM_WINDOW, 32, n, wins); } /** Set the client list in stacking order, bottom to top. @@ -171,7 +171,7 @@ ewmh_update_net_client_list_stacking(int phys_screen) xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, xutil_screen_get(globalconf.connection, phys_screen)->root, - _NET_CLIENT_LIST_STACKING, WINDOW, 32, n, wins); + _NET_CLIENT_LIST_STACKING, XCB_ATOM_WINDOW, 32, n, wins); } void @@ -181,7 +181,7 @@ ewmh_update_net_numbers_of_desktop(int phys_screen) xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, xutil_screen_get(globalconf.connection, phys_screen)->root, - _NET_NUMBER_OF_DESKTOPS, CARDINAL, 32, 1, &count); + _NET_NUMBER_OF_DESKTOPS, XCB_ATOM_CARDINAL, 32, 1, &count); } void @@ -191,7 +191,7 @@ ewmh_update_net_current_desktop(int phys_screen) xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, xutil_screen_get(globalconf.connection, phys_screen)->root, - _NET_CURRENT_DESKTOP, CARDINAL, 32, 1, &idx); + _NET_CURRENT_DESKTOP, XCB_ATOM_CARDINAL, 32, 1, &idx); } void @@ -443,7 +443,7 @@ ewmh_client_update_desktop(client_t *c) if(is_client_tagged(c, tags->tab[i])) { xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, - c->window, _NET_WM_DESKTOP, CARDINAL, 32, 1, &i); + c->window, _NET_WM_DESKTOP, XCB_ATOM_CARDINAL, 32, 1, &i); return; } /* It doesn't have any tags, remove the property */ @@ -474,7 +474,7 @@ ewmh_update_strut(xcb_window_t window, strut_t *strut) }; xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, - window, _NET_WM_STRUT_PARTIAL, CARDINAL, 32, countof(state), state); + window, _NET_WM_STRUT_PARTIAL, XCB_ATOM_CARDINAL, 32, countof(state), state); } void @@ -491,10 +491,10 @@ ewmh_client_check_hints(client_t *c) _NET_WM_DESKTOP, XCB_GET_PROPERTY_TYPE_ANY, 0, 1); c1 = xcb_get_property_unchecked(globalconf.connection, false, c->window, - _NET_WM_STATE, ATOM, 0, UINT32_MAX); + _NET_WM_STATE, XCB_ATOM_ATOM, 0, UINT32_MAX); c2 = xcb_get_property_unchecked(globalconf.connection, false, c->window, - _NET_WM_WINDOW_TYPE, ATOM, 0, UINT32_MAX); + _NET_WM_WINDOW_TYPE, XCB_ATOM_ATOM, 0, UINT32_MAX); reply = xcb_get_property_reply(globalconf.connection, c0, NULL); if(reply && reply->value_len && (data = xcb_get_property_value(reply))) @@ -571,7 +571,7 @@ ewmh_process_client_strut(client_t *c, xcb_get_property_reply_t *strut_r) if(!strut_r) { xcb_get_property_cookie_t strut_q = xcb_get_property_unchecked(globalconf.connection, false, c->window, - _NET_WM_STRUT_PARTIAL, CARDINAL, 0, 12); + _NET_WM_STRUT_PARTIAL, XCB_ATOM_CARDINAL, 0, 12); strut_r = mstrut_r = xcb_get_property_reply(globalconf.connection, strut_q, NULL); } @@ -625,7 +625,7 @@ xcb_get_property_cookie_t ewmh_window_icon_get_unchecked(xcb_window_t w) { return xcb_get_property_unchecked(globalconf.connection, false, w, - _NET_WM_ICON, CARDINAL, 0, UINT32_MAX); + _NET_WM_ICON, XCB_ATOM_CARDINAL, 0, UINT32_MAX); } int @@ -634,7 +634,7 @@ ewmh_window_icon_from_reply(xcb_get_property_reply_t *r) uint32_t *data; uint64_t len; - if(!r || r->type != CARDINAL || r->format != 32 || r->length < 2) + if(!r || r->type != XCB_ATOM_CARDINAL || r->format != 32 || r->length < 2) return 0; data = (uint32_t *) xcb_get_property_value(r); diff --git a/property.c b/property.c index 9cbd63fcc..9614165c2 100644 --- a/property.c +++ b/property.c @@ -65,11 +65,11 @@ } -HANDLE_TEXT_PROPERTY(wm_name, WM_NAME, client_set_alt_name) +HANDLE_TEXT_PROPERTY(wm_name, XCB_ATOM_WM_NAME, client_set_alt_name) HANDLE_TEXT_PROPERTY(net_wm_name, _NET_WM_NAME, client_set_name) -HANDLE_TEXT_PROPERTY(wm_icon_name, WM_ICON_NAME, client_set_alt_icon_name) +HANDLE_TEXT_PROPERTY(wm_icon_name, XCB_ATOM_WM_ICON_NAME, client_set_alt_icon_name) HANDLE_TEXT_PROPERTY(net_wm_icon_name, _NET_WM_ICON_NAME, client_set_icon_name) -HANDLE_TEXT_PROPERTY(wm_client_machine, WM_CLIENT_MACHINE, client_set_machine) +HANDLE_TEXT_PROPERTY(wm_client_machine, XCB_ATOM_WM_CLIENT_MACHINE, client_set_machine) HANDLE_TEXT_PROPERTY(wm_window_role, WM_WINDOW_ROLE, client_set_role) #undef HANDLE_TEXT_PROPERTY @@ -138,7 +138,7 @@ property_update_wm_client_leader(client_t *c, xcb_get_property_reply_t *reply) if(no_reply) { client_leader_q = xcb_get_property_unchecked(globalconf.connection, false, c->window, - WM_CLIENT_LEADER, WINDOW, 0, 32); + WM_CLIENT_LEADER, XCB_ATOM_WINDOW, 1, 32); reply = xcb_get_property_reply(globalconf.connection, client_leader_q, NULL); } @@ -282,7 +282,7 @@ property_update_net_wm_pid(client_t *c, if(no_reply) { xcb_get_property_cookie_t prop_c = - xcb_get_property_unchecked(globalconf.connection, false, c->window, _NET_WM_PID, CARDINAL, 0L, 1L); + xcb_get_property_unchecked(globalconf.connection, false, c->window, _NET_WM_PID, XCB_ATOM_CARDINAL, 0L, 1L); reply = xcb_get_property_reply(globalconf.connection, prop_c, NULL); } @@ -433,15 +433,15 @@ property_handle_propertynotify(xcb_property_notify_event_t *ev) HANDLE_L(_XEMBED_INFO, property_handle_xembed_info) /* ICCCM stuff */ - HANDLE_L(WM_TRANSIENT_FOR, property_handle_wm_transient_for) + HANDLE_L(XCB_ATOM_WM_TRANSIENT_FOR, property_handle_wm_transient_for) HANDLE_L(WM_CLIENT_LEADER, property_handle_wm_client_leader) - HANDLE_L(WM_NORMAL_HINTS, property_handle_wm_normal_hints) - HANDLE_L(WM_HINTS, property_handle_wm_hints) - HANDLE_L(WM_NAME, property_handle_wm_name) - HANDLE_L(WM_ICON_NAME, property_handle_wm_icon_name) - HANDLE_L(WM_CLASS, property_handle_wm_class) + HANDLE_L(XCB_ATOM_WM_NORMAL_HINTS, property_handle_wm_normal_hints) + HANDLE_L(XCB_ATOM_WM_HINTS, property_handle_wm_hints) + HANDLE_L(XCB_ATOM_WM_NAME, property_handle_wm_name) + HANDLE_L(XCB_ATOM_WM_ICON_NAME, property_handle_wm_icon_name) + HANDLE_L(XCB_ATOM_WM_CLASS, property_handle_wm_class) HANDLE_L(WM_PROTOCOLS, property_handle_wm_protocols) - HANDLE_L(WM_CLIENT_MACHINE, property_handle_wm_client_machine) + HANDLE_L(XCB_ATOM_WM_CLIENT_MACHINE, property_handle_wm_client_machine) HANDLE_L(WM_WINDOW_ROLE, property_handle_wm_window_role) /* EWMH stuff */ diff --git a/selection.c b/selection.c index e6e4792bd..443d20fcb 100644 --- a/selection.c +++ b/selection.c @@ -52,7 +52,7 @@ luaA_selection_get(lua_State *L) } xcb_convert_selection(globalconf.connection, selection_window, - PRIMARY, UTF8_STRING, XSEL_DATA, XCB_CURRENT_TIME); + XCB_ATOM_PRIMARY, UTF8_STRING, XSEL_DATA, XCB_CURRENT_TIME); xcb_flush(globalconf.connection); xcb_generic_event_t *event; @@ -83,7 +83,7 @@ luaA_selection_get(lua_State *L) xcb_selection_notify_event_t *event_notify = (xcb_selection_notify_event_t *) event; - if(event_notify->selection == PRIMARY + if(event_notify->selection == XCB_ATOM_PRIMARY && event_notify->property != XCB_NONE) { xcb_get_text_property_reply_t prop; diff --git a/systray.c b/systray.c index 67b78399c..6ea3dd5f4 100644 --- a/systray.c +++ b/systray.c @@ -273,7 +273,7 @@ systray_iskdedockapp(xcb_window_t w) * thanks KDE. */ kde_check_q = xcb_get_property_unchecked(globalconf.connection, false, w, _KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR, - WINDOW, 0, 1); + XCB_ATOM_WINDOW, 0, 1); kde_check = xcb_get_property_reply(globalconf.connection, kde_check_q, NULL); diff --git a/widget.c b/widget.c index 282e3c97c..33d99953f 100644 --- a/widget.c +++ b/widget.c @@ -252,7 +252,7 @@ widget_render(wibox_t *wibox) xcb_get_property_cookie_t prop_c; xcb_screen_t *s = xutil_screen_get(globalconf.connection, ctx->phys_screen); prop_c = xcb_get_property_unchecked(globalconf.connection, false, s->root, _XROOTPMAP_ID, - PIXMAP, 0, 1); + XCB_ATOM_PIXMAP, 0, 1); if((prop_r = xcb_get_property_reply(globalconf.connection, prop_c, NULL))) { if(prop_r->value_len diff --git a/widgets/systray.c b/widgets/systray.c index 27cba124c..68e9a83d3 100644 --- a/widgets/systray.c +++ b/widgets/systray.c @@ -85,7 +85,7 @@ systray_draw(widget_t *widget, draw_context_t *ctx, /** \todo stop setting that property on each redraw */ xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, globalconf.screens.tab[p->ctx.phys_screen].systray.window, - _NET_SYSTEM_TRAY_ORIENTATION, CARDINAL, 32, 1, &orient); + _NET_SYSTEM_TRAY_ORIENTATION, XCB_ATOM_CARDINAL, 32, 1, &orient); } /** Delete a systray widget. diff --git a/window.c b/window.c index c87ed04ab..8b97f0e40 100644 --- a/window.c +++ b/window.c @@ -151,7 +151,7 @@ window_opacity_get(xcb_window_t win) xcb_get_property_cookie_t prop_c = xcb_get_property_unchecked(globalconf.connection, false, win, - _NET_WM_WINDOW_OPACITY, CARDINAL, 0L, 1L); + _NET_WM_WINDOW_OPACITY, XCB_ATOM_CARDINAL, 0L, 1L); xcb_get_property_reply_t *prop_r = xcb_get_property_reply(globalconf.connection, prop_c, NULL);