From 5d0a81c8bf4881d4a0716112e7cedfc3a096a838 Mon Sep 17 00:00:00 2001 From: Gregor Best Date: Sun, 8 Aug 2010 18:31:07 +0200 Subject: [PATCH] fix some deprecated atom constants Signed-off-by: Gregor Best Signed-off-by: Uli Schlachter --- common/xutil.h | 3 ++- ewmh.c | 36 ++++++++++++++++++------------------ objects/widget.c | 2 +- objects/widgets/systray.c | 2 +- property.c | 24 ++++++++++++------------ selection.c | 4 ++-- systray.c | 2 +- xwindow.c | 4 ++-- 8 files changed, 39 insertions(+), 38 deletions(-) diff --git a/common/xutil.h b/common/xutil.h index 2b1c0ce8..5d9b7598 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 287f2e94..202396fa 100644 --- a/ewmh.c +++ b/ewmh.c @@ -72,7 +72,7 @@ ewmh_client_update_hints(lua_State *L) state[i++] = _NET_WM_STATE_DEMANDS_ATTENTION; xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, - c->window, _NET_WM_STATE, ATOM, 32, i, state); + c->window, _NET_WM_STATE, XCB_ATOM_ATOM, 32, i, state); return 0; } @@ -108,7 +108,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); } static int @@ -125,7 +125,7 @@ ewmh_update_net_active_window(lua_State *L) xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, xutil_screen_get(globalconf.connection, c->phys_screen)->root, - _NET_ACTIVE_WINDOW, WINDOW, 32, 1, &win); + _NET_ACTIVE_WINDOW, XCB_ATOM_WINDOW, 32, 1, &win); return 0; } @@ -185,7 +185,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 */ @@ -195,11 +195,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 */ @@ -209,7 +209,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); @@ -236,7 +236,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. @@ -254,7 +254,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 @@ -264,7 +264,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 @@ -274,7 +274,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 @@ -467,7 +467,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 */ @@ -500,7 +500,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); } } @@ -518,10 +518,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))) @@ -598,7 +598,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); } @@ -651,7 +651,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 @@ -660,7 +660,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/objects/widget.c b/objects/widget.c index a0f0a3bd..bc648cdf 100644 --- a/objects/widget.c +++ b/objects/widget.c @@ -253,7 +253,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/objects/widgets/systray.c b/objects/widgets/systray.c index 3133172b..abe7dfde 100644 --- a/objects/widgets/systray.c +++ b/objects/widgets/systray.c @@ -74,7 +74,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/property.c b/property.c index ae0599df..c2f33a52 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); } @@ -279,7 +279,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); } @@ -430,15 +430,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 e6e4792b..443d20fc 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 8a018e08..2cbea340 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/xwindow.c b/xwindow.c index d6bba4a3..faa24bf1 100644 --- a/xwindow.c +++ b/xwindow.c @@ -157,7 +157,7 @@ xwindow_get_opacity(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); @@ -196,7 +196,7 @@ xwindow_set_opacity(xcb_window_t win, double opacity) { uint32_t real_opacity = opacity * 0xffffffff; xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, win, - _NET_WM_WINDOW_OPACITY, CARDINAL, 32, 1L, &real_opacity); + _NET_WM_WINDOW_OPACITY, XCB_ATOM_CARDINAL, 32, 1L, &real_opacity); } else xcb_delete_property(globalconf.connection, win, _NET_WM_WINDOW_OPACITY);