From be7fda45d818ebe6d1029b4813e5fed3e81c19db Mon Sep 17 00:00:00 2001 From: Arnaud Fontaine Date: Wed, 27 Apr 2011 13:49:56 +0900 Subject: [PATCH] Update the code following release of xcb-util 0.3.8. xcb-util is now split into several repositories since 0.3.8. This release also cleaned up the API a lot, thus update the code accordingly. Signed-off-by: Arnaud Fontaine Signed-off-by: Uli Schlachter --- awesome.c | 2 +- awesomeConfig.cmake | 7 +++--- common/xutil.c | 1 - event.c | 2 +- objects/client.c | 42 ++++++++++++++++----------------- objects/client.h | 6 ++--- property.c | 57 +++++++++++++++++++++++---------------------- selection.c | 16 ++++++------- systray.c | 2 +- xwindow.c | 2 +- 10 files changed, 68 insertions(+), 69 deletions(-) diff --git a/awesome.c b/awesome.c index 9327808a..292e3a6a 100644 --- a/awesome.c +++ b/awesome.c @@ -129,7 +129,7 @@ scan(void) if(!attr_r || attr_r->override_redirect || attr_r->map_state == XCB_MAP_STATE_UNMAPPED - || state == XCB_WM_STATE_WITHDRAWN) + || state == XCB_ICCCM_WM_STATE_WITHDRAWN) { geom_wins[i] = NULL; p_delete(&attr_r); diff --git a/awesomeConfig.cmake b/awesomeConfig.cmake index aeb0b2b4..ff23df94 100644 --- a/awesomeConfig.cmake +++ b/awesomeConfig.cmake @@ -126,7 +126,7 @@ execute_process( # Use pkgconfig to get most of the libraries pkg_check_modules(AWESOME_COMMON_REQUIRED REQUIRED - xcb>=1.4) + xcb>=1.6) pkg_check_modules(AWESOME_REQUIRED REQUIRED glib-2.0 @@ -137,10 +137,9 @@ pkg_check_modules(AWESOME_REQUIRED REQUIRED xcb-randr xcb-xtest xcb-xinerama - xcb-aux>=0.3.0 - xcb-atom>=0.3.0 + xcb-util>=0.3.8 xcb-keysyms>=0.3.4 - xcb-icccm>=0.3.6 + xcb-icccm>=0.3.8 xcb-image>=0.3.0 cairo-xcb libstartup-notification-1.0>=0.10 diff --git a/common/xutil.c b/common/xutil.c index fd53d9cd..8b62da76 100644 --- a/common/xutil.c +++ b/common/xutil.c @@ -25,7 +25,6 @@ #include "common/util.h" #include -#include #include #include "common/xutil.h" diff --git a/event.c b/event.c index 7ece36fe..4dfe2889 100644 --- a/event.c +++ b/event.c @@ -619,7 +619,7 @@ event_handle_clientmessage(xcb_client_message_event_t *ev) client_t *c; if((c = client_getbywin(ev->window)) && ev->format == 32 - && ev->data.data32[0] == XCB_WM_STATE_ICONIC) + && ev->data.data32[0] == XCB_ICCCM_WM_STATE_ICONIC) { luaA_object_push(globalconf.L, c); client_set_minimized(globalconf.L, -1, true); diff --git a/objects/client.c b/objects/client.c index 53e3df24..f0a9b6d9 100644 --- a/objects/client.c +++ b/objects/client.c @@ -41,7 +41,7 @@ static void client_wipe(client_t *c) { key_array_wipe(&c->keys); - xcb_get_wm_protocols_reply_wipe(&c->protocols); + xcb_icccm_get_wm_protocols_reply_wipe(&c->protocols); p_delete(&c->machine); p_delete(&c->class); p_delete(&c->instance); @@ -66,20 +66,20 @@ client_set_urgent(lua_State *L, int cidx, bool urgent) if(c->urgent != urgent) { xcb_get_property_cookie_t hints = - xcb_get_wm_hints_unchecked(globalconf.connection, c->window); + xcb_icccm_get_wm_hints_unchecked(globalconf.connection, c->window); c->urgent = urgent; /* update ICCCM hints */ - xcb_wm_hints_t wmh; - xcb_get_wm_hints_reply(globalconf.connection, hints, &wmh, NULL); + xcb_icccm_wm_hints_t wmh; + xcb_icccm_get_wm_hints_reply(globalconf.connection, hints, &wmh, NULL); if(urgent) - wmh.flags |= XCB_WM_HINT_X_URGENCY; + wmh.flags |= XCB_ICCCM_WM_HINT_X_URGENCY; else - wmh.flags &= ~XCB_WM_HINT_X_URGENCY; + wmh.flags &= ~XCB_ICCCM_WM_HINT_X_URGENCY; - xcb_set_wm_hints(globalconf.connection, c->window, &wmh); + xcb_icccm_set_wm_hints(globalconf.connection, c->window, &wmh); luaA_object_emit_signal(L, cidx, "property::urgent", 0); } @@ -507,7 +507,7 @@ HANDLE_GEOM(height) * * At this stage it's just safer to keep it in normal state and avoid confusion. */ - xwindow_set_state(c->window, XCB_WM_STATE_NORMAL); + xwindow_set_state(c->window, XCB_ICCCM_WM_STATE_NORMAL); if(!startup) { @@ -625,9 +625,9 @@ client_set_minimized(lua_State *L, int cidx, bool s) c->minimized = s; banning_need_update(); if(s) - xwindow_set_state(c->window, XCB_WM_STATE_ICONIC); + xwindow_set_state(c->window, XCB_ICCCM_WM_STATE_ICONIC); else - xwindow_set_state(c->window, XCB_WM_STATE_NORMAL); + xwindow_set_state(c->window, XCB_ICCCM_WM_STATE_NORMAL); if(strut_has_value(&c->strut)) screen_emit_signal(globalconf.L, c->screen, "property::workarea", 0); luaA_object_emit_signal(L, cidx, "property::minimized", 0); @@ -890,7 +890,7 @@ client_unmanage(client_t *c, bool window_valid) /* Do this last to avoid races with clients. According to ICCCM, clients * arent allowed to re-use the window until after this. */ - xwindow_set_state(c->window, XCB_WM_STATE_WITHDRAWN); + xwindow_set_state(c->window, XCB_ICCCM_WM_STATE_WITHDRAWN); } /* set client as invalid */ @@ -1411,9 +1411,9 @@ luaA_client_get_size_hints(lua_State *L, client_t *c) lua_createtable(L, 0, 1); - if(c->size_hints.flags & XCB_SIZE_HINT_US_POSITION) + if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_US_POSITION) u_or_p = "user_position"; - else if(c->size_hints.flags & XCB_SIZE_HINT_P_POSITION) + else if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_POSITION) u_or_p = "program_position"; if(u_or_p) @@ -1427,9 +1427,9 @@ luaA_client_get_size_hints(lua_State *L, client_t *c) u_or_p = NULL; } - if(c->size_hints.flags & XCB_SIZE_HINT_US_SIZE) + if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_US_SIZE) u_or_p = "user_size"; - else if(c->size_hints.flags & XCB_SIZE_HINT_P_SIZE) + else if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_SIZE) u_or_p = "program_size"; if(u_or_p) @@ -1442,7 +1442,7 @@ luaA_client_get_size_hints(lua_State *L, client_t *c) lua_setfield(L, -2, u_or_p); } - if(c->size_hints.flags & XCB_SIZE_HINT_P_MIN_SIZE) + if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_MIN_SIZE) { lua_pushnumber(L, c->size_hints.min_width); lua_setfield(L, -2, "min_width"); @@ -1450,7 +1450,7 @@ luaA_client_get_size_hints(lua_State *L, client_t *c) lua_setfield(L, -2, "min_height"); } - if(c->size_hints.flags & XCB_SIZE_HINT_P_MAX_SIZE) + if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_MAX_SIZE) { lua_pushnumber(L, c->size_hints.max_width); lua_setfield(L, -2, "max_width"); @@ -1458,7 +1458,7 @@ luaA_client_get_size_hints(lua_State *L, client_t *c) lua_setfield(L, -2, "max_height"); } - if(c->size_hints.flags & XCB_SIZE_HINT_P_RESIZE_INC) + if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_RESIZE_INC) { lua_pushnumber(L, c->size_hints.width_inc); lua_setfield(L, -2, "width_inc"); @@ -1466,7 +1466,7 @@ luaA_client_get_size_hints(lua_State *L, client_t *c) lua_setfield(L, -2, "height_inc"); } - if(c->size_hints.flags & XCB_SIZE_HINT_P_ASPECT) + if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_ASPECT) { lua_pushnumber(L, c->size_hints.min_aspect_num); lua_setfield(L, -2, "min_aspect_num"); @@ -1478,7 +1478,7 @@ luaA_client_get_size_hints(lua_State *L, client_t *c) lua_setfield(L, -2, "max_aspect_den"); } - if(c->size_hints.flags & XCB_SIZE_HINT_BASE_SIZE) + if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_BASE_SIZE) { lua_pushnumber(L, c->size_hints.base_width); lua_setfield(L, -2, "base_width"); @@ -1486,7 +1486,7 @@ luaA_client_get_size_hints(lua_State *L, client_t *c) lua_setfield(L, -2, "base_height"); } - if(c->size_hints.flags & XCB_SIZE_HINT_P_WIN_GRAVITY) + if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_WIN_GRAVITY) { switch(c->size_hints.win_gravity) { diff --git a/objects/client.h b/objects/client.h index 086c00a7..333def3d 100644 --- a/objects/client.h +++ b/objects/client.h @@ -85,7 +85,7 @@ struct client_t /** Window holding command needed to start it (session management related) */ xcb_window_t leader_window; /** Client's WM_PROTOCOLS property */ - xcb_get_wm_protocols_reply_t protocols; + xcb_icccm_get_wm_protocols_reply_t protocols; /** Key bindings */ key_array_t keys; /** Icon */ @@ -187,8 +187,8 @@ client_raise(client_t *c) static inline bool client_isfixed(client_t *c) { - return (c->size_hints.flags & XCB_SIZE_HINT_P_MAX_SIZE - && c->size_hints.flags & XCB_SIZE_HINT_P_MIN_SIZE + return (c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_MAX_SIZE + && c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_MIN_SIZE && c->size_hints.max_width == c->size_hints.min_width && c->size_hints.max_height == c->size_hints.min_height && c->size_hints.max_width diff --git a/property.c b/property.c index 9c4378d5..989bb7d0 100644 --- a/property.c +++ b/property.c @@ -98,7 +98,7 @@ HANDLE_PROPERTY(net_wm_pid) xcb_get_property_cookie_t property_get_wm_transient_for(client_t *c) { - return xcb_get_wm_transient_for_unchecked(globalconf.connection, c->window); + return xcb_icccm_get_wm_transient_for_unchecked(globalconf.connection, c->window); } void @@ -106,9 +106,9 @@ property_update_wm_transient_for(client_t *c, xcb_get_property_cookie_t cookie) { xcb_window_t trans; - if(!xcb_get_wm_transient_for_reply(globalconf.connection, - cookie, - &trans, NULL)) + if(!xcb_icccm_get_wm_transient_for_reply(globalconf.connection, + cookie, + &trans, NULL)) return; luaA_object_push(globalconf.L, c); @@ -146,7 +146,7 @@ property_update_wm_client_leader(client_t *c, xcb_get_property_cookie_t cookie) xcb_get_property_cookie_t property_get_wm_normal_hints(client_t *c) { - return xcb_get_wm_normal_hints_unchecked(globalconf.connection, c->window); + return xcb_icccm_get_wm_normal_hints_unchecked(globalconf.connection, c->window); } /** Update the size hints of a client. @@ -156,15 +156,15 @@ property_get_wm_normal_hints(client_t *c) void property_update_wm_normal_hints(client_t *c, xcb_get_property_cookie_t cookie) { - xcb_get_wm_normal_hints_reply(globalconf.connection, - cookie, - &c->size_hints, NULL); + xcb_icccm_get_wm_normal_hints_reply(globalconf.connection, + cookie, + &c->size_hints, NULL); } xcb_get_property_cookie_t property_get_wm_hints(client_t *c) { - return xcb_get_wm_hints_unchecked(globalconf.connection, c->window); + return xcb_icccm_get_wm_hints_unchecked(globalconf.connection, c->window); } /** Update the WM hints of a client. @@ -174,20 +174,20 @@ property_get_wm_hints(client_t *c) void property_update_wm_hints(client_t *c, xcb_get_property_cookie_t cookie) { - xcb_wm_hints_t wmh; + xcb_icccm_wm_hints_t wmh; - if(!xcb_get_wm_hints_reply(globalconf.connection, - cookie, - &wmh, NULL)) + if(!xcb_icccm_get_wm_hints_reply(globalconf.connection, + cookie, + &wmh, NULL)) return; luaA_object_push(globalconf.L, c); - client_set_urgent(globalconf.L, -1, xcb_wm_hints_get_urgency(&wmh)); + client_set_urgent(globalconf.L, -1, xcb_icccm_wm_hints_get_urgency(&wmh)); - if(wmh.flags & XCB_WM_HINT_INPUT) + if(wmh.flags & XCB_ICCCM_WM_HINT_INPUT) c->nofocus = !wmh.input; - if(wmh.flags & XCB_WM_HINT_WINDOW_GROUP) + if(wmh.flags & XCB_ICCCM_WM_HINT_WINDOW_GROUP) client_set_group_window(globalconf.L, -1, wmh.window_group); lua_pop(globalconf.L, 1); @@ -196,7 +196,7 @@ property_update_wm_hints(client_t *c, xcb_get_property_cookie_t cookie) xcb_get_property_cookie_t property_get_wm_class(client_t *c) { - return xcb_get_wm_class_unchecked(globalconf.connection, c->window); + return xcb_icccm_get_wm_class_unchecked(globalconf.connection, c->window); } /** Update WM_CLASS of a client. @@ -206,18 +206,18 @@ property_get_wm_class(client_t *c) void property_update_wm_class(client_t *c, xcb_get_property_cookie_t cookie) { - xcb_get_wm_class_reply_t hint; + xcb_icccm_get_wm_class_reply_t hint; - if(!xcb_get_wm_class_reply(globalconf.connection, - cookie, - &hint, NULL)) + if(!xcb_icccm_get_wm_class_reply(globalconf.connection, + cookie, + &hint, NULL)) return; luaA_object_push(globalconf.L, c); client_set_class_instance(globalconf.L, -1, hint.class_name, hint.instance_name); lua_pop(globalconf.L, 1); - xcb_get_wm_class_reply_wipe(&hint); + xcb_icccm_get_wm_class_reply_wipe(&hint); } static int @@ -284,7 +284,8 @@ property_update_net_wm_pid(client_t *c, xcb_get_property_cookie_t cookie) xcb_get_property_cookie_t property_get_wm_protocols(client_t *c) { - return xcb_get_wm_protocols_unchecked(globalconf.connection, c->window, WM_PROTOCOLS); + return xcb_icccm_get_wm_protocols_unchecked(globalconf.connection, + c->window, WM_PROTOCOLS); } /** Update the list of supported protocols for a client. @@ -294,15 +295,15 @@ property_get_wm_protocols(client_t *c) void property_update_wm_protocols(client_t *c, xcb_get_property_cookie_t cookie) { - xcb_get_wm_protocols_reply_t protocols; + xcb_icccm_get_wm_protocols_reply_t protocols; /* If this fails for any reason, we still got the old value */ - if(!xcb_get_wm_protocols_reply(globalconf.connection, - cookie, - &protocols, NULL)) + if(!xcb_icccm_get_wm_protocols_reply(globalconf.connection, + cookie, + &protocols, NULL)) return; - xcb_get_wm_protocols_reply_wipe(&c->protocols); + xcb_icccm_get_wm_protocols_reply_wipe(&c->protocols); memcpy(&c->protocols, &protocols, sizeof(protocols)); } diff --git a/selection.c b/selection.c index 22188692..59a04e7e 100644 --- a/selection.c +++ b/selection.c @@ -86,18 +86,18 @@ luaA_selection_get(lua_State *L) if(event_notify->selection == XCB_ATOM_PRIMARY && event_notify->property != XCB_NONE) { - xcb_get_text_property_reply_t prop; + xcb_icccm_get_text_property_reply_t prop; xcb_get_property_cookie_t cookie = - xcb_get_text_property(globalconf.connection, - event_notify->requestor, - event_notify->property); + xcb_icccm_get_text_property(globalconf.connection, + event_notify->requestor, + event_notify->property); - if(xcb_get_text_property_reply(globalconf.connection, - cookie, &prop, NULL)) - { + if(xcb_icccm_get_text_property_reply(globalconf.connection, + cookie, &prop, NULL)) + { lua_pushlstring(L, prop.name, prop.name_len); - xcb_get_text_property_reply_wipe(&prop); + xcb_icccm_get_text_property_reply_wipe(&prop); xcb_delete_property(globalconf.connection, event_notify->requestor, diff --git a/systray.c b/systray.c index fc7a87b5..280a7276 100644 --- a/systray.c +++ b/systray.c @@ -164,7 +164,7 @@ systray_request_handle(xcb_window_t embed_win, xembed_info_t *info) xcb_change_window_attributes(globalconf.connection, embed_win, XCB_CW_EVENT_MASK, select_input_val); - xwindow_set_state(embed_win, XCB_WM_STATE_WITHDRAWN); + xwindow_set_state(embed_win, XCB_ICCCM_WM_STATE_WITHDRAWN); /* we grab the window, but also make sure it's automatically reparented back * to the root window if we should die. diff --git a/xwindow.c b/xwindow.c index 3514dfb5..22b505ef 100644 --- a/xwindow.c +++ b/xwindow.c @@ -60,7 +60,7 @@ uint32_t xwindow_get_state_reply(xcb_get_property_cookie_t cookie) { /* If no property is set, we just assume a sane default. */ - uint32_t result = XCB_WM_STATE_NORMAL; + uint32_t result = XCB_ICCCM_WM_STATE_NORMAL; xcb_get_property_reply_t *prop_r; if((prop_r = xcb_get_property_reply(globalconf.connection, cookie, NULL)))