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 <arnau@debian.org>
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Arnaud Fontaine 2011-04-27 13:49:56 +09:00 committed by Uli Schlachter
parent bc116c6ef1
commit be7fda45d8
10 changed files with 68 additions and 69 deletions

View File

@ -129,7 +129,7 @@ scan(void)
if(!attr_r || attr_r->override_redirect if(!attr_r || attr_r->override_redirect
|| attr_r->map_state == XCB_MAP_STATE_UNMAPPED || attr_r->map_state == XCB_MAP_STATE_UNMAPPED
|| state == XCB_WM_STATE_WITHDRAWN) || state == XCB_ICCCM_WM_STATE_WITHDRAWN)
{ {
geom_wins[i] = NULL; geom_wins[i] = NULL;
p_delete(&attr_r); p_delete(&attr_r);

View File

@ -126,7 +126,7 @@ execute_process(
# Use pkgconfig to get most of the libraries # Use pkgconfig to get most of the libraries
pkg_check_modules(AWESOME_COMMON_REQUIRED REQUIRED pkg_check_modules(AWESOME_COMMON_REQUIRED REQUIRED
xcb>=1.4) xcb>=1.6)
pkg_check_modules(AWESOME_REQUIRED REQUIRED pkg_check_modules(AWESOME_REQUIRED REQUIRED
glib-2.0 glib-2.0
@ -137,10 +137,9 @@ pkg_check_modules(AWESOME_REQUIRED REQUIRED
xcb-randr xcb-randr
xcb-xtest xcb-xtest
xcb-xinerama xcb-xinerama
xcb-aux>=0.3.0 xcb-util>=0.3.8
xcb-atom>=0.3.0
xcb-keysyms>=0.3.4 xcb-keysyms>=0.3.4
xcb-icccm>=0.3.6 xcb-icccm>=0.3.8
xcb-image>=0.3.0 xcb-image>=0.3.0
cairo-xcb cairo-xcb
libstartup-notification-1.0>=0.10 libstartup-notification-1.0>=0.10

View File

@ -25,7 +25,6 @@
#include "common/util.h" #include "common/util.h"
#include <xcb/xcb.h> #include <xcb/xcb.h>
#include <xcb/xcb_atom.h>
#include <xcb/xcb_icccm.h> #include <xcb/xcb_icccm.h>
#include "common/xutil.h" #include "common/xutil.h"

View File

@ -619,7 +619,7 @@ event_handle_clientmessage(xcb_client_message_event_t *ev)
client_t *c; client_t *c;
if((c = client_getbywin(ev->window)) if((c = client_getbywin(ev->window))
&& ev->format == 32 && 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); luaA_object_push(globalconf.L, c);
client_set_minimized(globalconf.L, -1, true); client_set_minimized(globalconf.L, -1, true);

View File

@ -41,7 +41,7 @@ static void
client_wipe(client_t *c) client_wipe(client_t *c)
{ {
key_array_wipe(&c->keys); 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->machine);
p_delete(&c->class); p_delete(&c->class);
p_delete(&c->instance); p_delete(&c->instance);
@ -66,20 +66,20 @@ client_set_urgent(lua_State *L, int cidx, bool urgent)
if(c->urgent != urgent) if(c->urgent != urgent)
{ {
xcb_get_property_cookie_t hints = 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; c->urgent = urgent;
/* update ICCCM hints */ /* update ICCCM hints */
xcb_wm_hints_t wmh; xcb_icccm_wm_hints_t wmh;
xcb_get_wm_hints_reply(globalconf.connection, hints, &wmh, NULL); xcb_icccm_get_wm_hints_reply(globalconf.connection, hints, &wmh, NULL);
if(urgent) if(urgent)
wmh.flags |= XCB_WM_HINT_X_URGENCY; wmh.flags |= XCB_ICCCM_WM_HINT_X_URGENCY;
else 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); 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. * 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) if(!startup)
{ {
@ -625,9 +625,9 @@ client_set_minimized(lua_State *L, int cidx, bool s)
c->minimized = s; c->minimized = s;
banning_need_update(); banning_need_update();
if(s) if(s)
xwindow_set_state(c->window, XCB_WM_STATE_ICONIC); xwindow_set_state(c->window, XCB_ICCCM_WM_STATE_ICONIC);
else 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)) if(strut_has_value(&c->strut))
screen_emit_signal(globalconf.L, c->screen, "property::workarea", 0); screen_emit_signal(globalconf.L, c->screen, "property::workarea", 0);
luaA_object_emit_signal(L, cidx, "property::minimized", 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 /* Do this last to avoid races with clients. According to ICCCM, clients
* arent allowed to re-use the window until after this. */ * 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 */ /* set client as invalid */
@ -1411,9 +1411,9 @@ luaA_client_get_size_hints(lua_State *L, client_t *c)
lua_createtable(L, 0, 1); 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"; 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"; u_or_p = "program_position";
if(u_or_p) if(u_or_p)
@ -1427,9 +1427,9 @@ luaA_client_get_size_hints(lua_State *L, client_t *c)
u_or_p = NULL; 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"; 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"; u_or_p = "program_size";
if(u_or_p) 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); 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_pushnumber(L, c->size_hints.min_width);
lua_setfield(L, -2, "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"); 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_pushnumber(L, c->size_hints.max_width);
lua_setfield(L, -2, "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"); 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_pushnumber(L, c->size_hints.width_inc);
lua_setfield(L, -2, "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"); 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_pushnumber(L, c->size_hints.min_aspect_num);
lua_setfield(L, -2, "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"); 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_pushnumber(L, c->size_hints.base_width);
lua_setfield(L, -2, "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"); 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) switch(c->size_hints.win_gravity)
{ {

View File

@ -85,7 +85,7 @@ struct client_t
/** Window holding command needed to start it (session management related) */ /** Window holding command needed to start it (session management related) */
xcb_window_t leader_window; xcb_window_t leader_window;
/** Client's WM_PROTOCOLS property */ /** Client's WM_PROTOCOLS property */
xcb_get_wm_protocols_reply_t protocols; xcb_icccm_get_wm_protocols_reply_t protocols;
/** Key bindings */ /** Key bindings */
key_array_t keys; key_array_t keys;
/** Icon */ /** Icon */
@ -187,8 +187,8 @@ client_raise(client_t *c)
static inline bool static inline bool
client_isfixed(client_t *c) client_isfixed(client_t *c)
{ {
return (c->size_hints.flags & XCB_SIZE_HINT_P_MAX_SIZE return (c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_MAX_SIZE
&& c->size_hints.flags & XCB_SIZE_HINT_P_MIN_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_width == c->size_hints.min_width
&& c->size_hints.max_height == c->size_hints.min_height && c->size_hints.max_height == c->size_hints.min_height
&& c->size_hints.max_width && c->size_hints.max_width

View File

@ -98,7 +98,7 @@ HANDLE_PROPERTY(net_wm_pid)
xcb_get_property_cookie_t xcb_get_property_cookie_t
property_get_wm_transient_for(client_t *c) 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 void
@ -106,9 +106,9 @@ property_update_wm_transient_for(client_t *c, xcb_get_property_cookie_t cookie)
{ {
xcb_window_t trans; xcb_window_t trans;
if(!xcb_get_wm_transient_for_reply(globalconf.connection, if(!xcb_icccm_get_wm_transient_for_reply(globalconf.connection,
cookie, cookie,
&trans, NULL)) &trans, NULL))
return; return;
luaA_object_push(globalconf.L, c); 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 xcb_get_property_cookie_t
property_get_wm_normal_hints(client_t *c) 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. /** Update the size hints of a client.
@ -156,15 +156,15 @@ property_get_wm_normal_hints(client_t *c)
void void
property_update_wm_normal_hints(client_t *c, xcb_get_property_cookie_t cookie) property_update_wm_normal_hints(client_t *c, xcb_get_property_cookie_t cookie)
{ {
xcb_get_wm_normal_hints_reply(globalconf.connection, xcb_icccm_get_wm_normal_hints_reply(globalconf.connection,
cookie, cookie,
&c->size_hints, NULL); &c->size_hints, NULL);
} }
xcb_get_property_cookie_t xcb_get_property_cookie_t
property_get_wm_hints(client_t *c) 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. /** Update the WM hints of a client.
@ -174,20 +174,20 @@ property_get_wm_hints(client_t *c)
void void
property_update_wm_hints(client_t *c, xcb_get_property_cookie_t cookie) 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, if(!xcb_icccm_get_wm_hints_reply(globalconf.connection,
cookie, cookie,
&wmh, NULL)) &wmh, NULL))
return; return;
luaA_object_push(globalconf.L, c); 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; 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); client_set_group_window(globalconf.L, -1, wmh.window_group);
lua_pop(globalconf.L, 1); 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 xcb_get_property_cookie_t
property_get_wm_class(client_t *c) 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. /** Update WM_CLASS of a client.
@ -206,18 +206,18 @@ property_get_wm_class(client_t *c)
void void
property_update_wm_class(client_t *c, xcb_get_property_cookie_t cookie) 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, if(!xcb_icccm_get_wm_class_reply(globalconf.connection,
cookie, cookie,
&hint, NULL)) &hint, NULL))
return; return;
luaA_object_push(globalconf.L, c); luaA_object_push(globalconf.L, c);
client_set_class_instance(globalconf.L, -1, hint.class_name, hint.instance_name); client_set_class_instance(globalconf.L, -1, hint.class_name, hint.instance_name);
lua_pop(globalconf.L, 1); lua_pop(globalconf.L, 1);
xcb_get_wm_class_reply_wipe(&hint); xcb_icccm_get_wm_class_reply_wipe(&hint);
} }
static int 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 xcb_get_property_cookie_t
property_get_wm_protocols(client_t *c) 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. /** Update the list of supported protocols for a client.
@ -294,15 +295,15 @@ property_get_wm_protocols(client_t *c)
void void
property_update_wm_protocols(client_t *c, xcb_get_property_cookie_t cookie) 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 this fails for any reason, we still got the old value */
if(!xcb_get_wm_protocols_reply(globalconf.connection, if(!xcb_icccm_get_wm_protocols_reply(globalconf.connection,
cookie, cookie,
&protocols, NULL)) &protocols, NULL))
return; return;
xcb_get_wm_protocols_reply_wipe(&c->protocols); xcb_icccm_get_wm_protocols_reply_wipe(&c->protocols);
memcpy(&c->protocols, &protocols, sizeof(protocols)); memcpy(&c->protocols, &protocols, sizeof(protocols));
} }

View File

@ -86,18 +86,18 @@ luaA_selection_get(lua_State *L)
if(event_notify->selection == XCB_ATOM_PRIMARY if(event_notify->selection == XCB_ATOM_PRIMARY
&& event_notify->property != XCB_NONE) && 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_property_cookie_t cookie =
xcb_get_text_property(globalconf.connection, xcb_icccm_get_text_property(globalconf.connection,
event_notify->requestor, event_notify->requestor,
event_notify->property); event_notify->property);
if(xcb_get_text_property_reply(globalconf.connection, if(xcb_icccm_get_text_property_reply(globalconf.connection,
cookie, &prop, NULL)) cookie, &prop, NULL))
{ {
lua_pushlstring(L, prop.name, prop.name_len); 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, xcb_delete_property(globalconf.connection,
event_notify->requestor, event_notify->requestor,

View File

@ -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, xcb_change_window_attributes(globalconf.connection, embed_win, XCB_CW_EVENT_MASK,
select_input_val); 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 /* we grab the window, but also make sure it's automatically reparented back
* to the root window if we should die. * to the root window if we should die.

View File

@ -60,7 +60,7 @@ uint32_t
xwindow_get_state_reply(xcb_get_property_cookie_t cookie) xwindow_get_state_reply(xcb_get_property_cookie_t cookie)
{ {
/* If no property is set, we just assume a sane default. */ /* 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; xcb_get_property_reply_t *prop_r;
if((prop_r = xcb_get_property_reply(globalconf.connection, cookie, NULL))) if((prop_r = xcb_get_property_reply(globalconf.connection, cookie, NULL)))