1 From 33e140552786f20a34c15852e88aaa27f3bed029 Mon Sep 17 00:00:00 2001
2 From: Arnaud Fontaine <ar...@debian.org>
3 Date: Wed, 27 Apr 2011 15:44:35 +0900
4 Subject: [PATCH] Update the code following release of xcb-util 0.3.8.
6 xcb-util is now split into several repositories since 0.3.8. This
7 release also cleaned up the API a lot, thus update the code
10 Signed-off-by: Arnaud Fontaine <ar...@debian.org>
13 awesomeConfig.cmake | 7 ++---
14 client.c | 56 +++++++++++++++++++++---------------------
19 property.c | 68 +++++++++++++++++++++++++-------------------------
20 selection.c | 14 +++++-----
23 11 files changed, 86 insertions(+), 88 deletions(-)
25 diff --git a/awesome.c b/awesome.c
26 index f89080c..1258b4c 100644
29 @@ -154,7 +154,7 @@ scan(void)
31 if(!attr_r || attr_r->override_redirect
32 || attr_r->map_state == XCB_MAP_STATE_UNMAPPED
33 - || state == XCB_WM_STATE_WITHDRAWN)
34 + || state == XCB_ICCCM_WM_STATE_WITHDRAWN)
38 diff --git a/awesomeConfig.cmake b/awesomeConfig.cmake
39 index 68b5ee3..5672afc 100644
40 --- a/awesomeConfig.cmake
41 +++ b/awesomeConfig.cmake
42 @@ -127,7 +127,7 @@ execute_process(
44 # Use pkgconfig to get most of the libraries
45 pkg_check_modules(AWESOME_COMMON_REQUIRED REQUIRED
49 pkg_check_modules(AWESOME_REQUIRED REQUIRED
51 @@ -139,10 +139,9 @@ pkg_check_modules(AWESOME_REQUIRED REQUIRED
63 libstartup-notification-1.0>=0.10
64 diff --git a/client.c b/client.c
65 index 049e3d5..baae69f 100644
68 @@ -52,7 +52,7 @@ luaA_client_gc(lua_State *L)
69 client_t *c = luaA_checkudata(L, 1, &client_class);
70 button_array_wipe(&c->buttons);
71 key_array_wipe(&c->keys);
72 - xcb_get_wm_protocols_reply_wipe(&c->protocols);
73 + xcb_icccm_get_wm_protocols_reply_wipe(&c->protocols);
74 p_delete(&c->machine);
76 p_delete(&c->instance);
77 @@ -94,21 +94,21 @@ client_set_urgent(lua_State *L, int cidx, bool urgent)
78 if(c->urgent != urgent)
80 xcb_get_property_cookie_t hints =
81 - xcb_get_wm_hints_unchecked(globalconf.connection, c->window);
82 + xcb_icccm_get_wm_hints_unchecked(globalconf.connection, c->window);
85 ewmh_client_update_hints(c);
87 /* update ICCCM hints */
89 - xcb_get_wm_hints_reply(globalconf.connection, hints, &wmh, NULL);
90 + xcb_icccm_wm_hints_t wmh;
91 + xcb_icccm_get_wm_hints_reply(globalconf.connection, hints, &wmh, NULL);
94 - wmh.flags |= XCB_WM_HINT_X_URGENCY;
95 + wmh.flags |= XCB_ICCCM_WM_HINT_X_URGENCY;
97 - wmh.flags &= ~XCB_WM_HINT_X_URGENCY;
98 + wmh.flags &= ~XCB_ICCCM_WM_HINT_X_URGENCY;
100 - xcb_set_wm_hints(globalconf.connection, c->window, &wmh);
101 + xcb_icccm_set_wm_hints(globalconf.connection, c->window, &wmh);
103 hook_property(c, "urgent");
104 luaA_object_emit_signal(L, cidx, "property::urgent", 0);
105 @@ -721,7 +721,7 @@ HANDLE_GEOM(height)
107 * At this stage it's just safer to keep it in normal state and avoid confusion.
109 - window_state_set(c->window, XCB_WM_STATE_NORMAL);
110 + window_state_set(c->window, XCB_ICCCM_WM_STATE_NORMAL);
114 @@ -767,14 +767,14 @@ client_geometry_hints(client_t *c, area_t geometry)
115 int32_t real_basew = 0, real_baseh = 0;
117 /* base size is substituted with min size if not specified */
118 - if(c->size_hints.flags & XCB_SIZE_HINT_P_SIZE)
119 + if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_SIZE)
121 basew = c->size_hints.base_width;
122 baseh = c->size_hints.base_height;
126 - else if(c->size_hints.flags & XCB_SIZE_HINT_P_MIN_SIZE)
127 + else if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_MIN_SIZE)
129 basew = c->size_hints.min_width;
130 baseh = c->size_hints.min_height;
131 @@ -783,12 +783,12 @@ client_geometry_hints(client_t *c, area_t geometry)
134 /* min size is substituted with base size if not specified */
135 - if(c->size_hints.flags & XCB_SIZE_HINT_P_MIN_SIZE)
136 + if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_MIN_SIZE)
138 minw = c->size_hints.min_width;
139 minh = c->size_hints.min_height;
141 - else if(c->size_hints.flags & XCB_SIZE_HINT_P_SIZE)
142 + else if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_SIZE)
144 minw = c->size_hints.base_width;
145 minh = c->size_hints.base_height;
146 @@ -796,7 +796,7 @@ client_geometry_hints(client_t *c, area_t geometry)
150 - if(c->size_hints.flags & XCB_SIZE_HINT_P_ASPECT
151 + if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_ASPECT
152 && c->size_hints.min_aspect_den > 0
153 && c->size_hints.max_aspect_den > 0
154 && geometry.height - real_baseh > 0
155 @@ -838,7 +838,7 @@ client_geometry_hints(client_t *c, area_t geometry)
157 geometry.height = MAX(geometry.height, minh);
159 - if(c->size_hints.flags & XCB_SIZE_HINT_P_MAX_SIZE)
160 + if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_MAX_SIZE)
162 if(c->size_hints.max_width)
163 geometry.width = MIN(geometry.width, c->size_hints.max_width);
164 @@ -846,7 +846,7 @@ client_geometry_hints(client_t *c, area_t geometry)
165 geometry.height = MIN(geometry.height, c->size_hints.max_height);
168 - if(c->size_hints.flags & (XCB_SIZE_HINT_P_RESIZE_INC | XCB_SIZE_HINT_BASE_SIZE)
169 + if(c->size_hints.flags & (XCB_ICCCM_SIZE_HINT_P_RESIZE_INC | XCB_ICCCM_SIZE_HINT_BASE_SIZE)
170 && c->size_hints.width_inc && c->size_hints.height_inc)
172 uint16_t t1 = geometry.width, t2 = geometry.height;
173 @@ -969,9 +969,9 @@ client_set_minimized(lua_State *L, int cidx, bool s)
175 banning_need_update((c)->screen);
177 - window_state_set(c->window, XCB_WM_STATE_ICONIC);
178 + window_state_set(c->window, XCB_ICCCM_WM_STATE_ICONIC);
180 - window_state_set(c->window, XCB_WM_STATE_NORMAL);
181 + window_state_set(c->window, XCB_ICCCM_WM_STATE_NORMAL);
182 ewmh_client_update_hints(c);
183 if(strut_has_value(&c->strut))
184 screen_emit_signal(globalconf.L, c->screen, "property::workarea", 0);
185 @@ -1333,7 +1333,7 @@ client_unmanage(client_t *c)
187 /* Do this last to avoid races with clients. According to ICCCM, clients
188 * arent allowed to re-use the window until after this. */
189 - window_state_set(c->window, XCB_WM_STATE_WITHDRAWN);
190 + window_state_set(c->window, XCB_ICCCM_WM_STATE_WITHDRAWN);
192 /* set client as invalid */
194 @@ -2052,9 +2052,9 @@ luaA_client_get_size_hints(lua_State *L, client_t *c)
196 lua_createtable(L, 0, 1);
198 - if(c->size_hints.flags & XCB_SIZE_HINT_US_POSITION)
199 + if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_US_POSITION)
200 u_or_p = "user_position";
201 - else if(c->size_hints.flags & XCB_SIZE_HINT_P_POSITION)
202 + else if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_POSITION)
203 u_or_p = "program_position";
206 @@ -2068,9 +2068,9 @@ luaA_client_get_size_hints(lua_State *L, client_t *c)
210 - if(c->size_hints.flags & XCB_SIZE_HINT_US_SIZE)
211 + if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_US_SIZE)
212 u_or_p = "user_size";
213 - else if(c->size_hints.flags & XCB_SIZE_HINT_P_SIZE)
214 + else if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_SIZE)
215 u_or_p = "program_size";
218 @@ -2083,7 +2083,7 @@ luaA_client_get_size_hints(lua_State *L, client_t *c)
219 lua_setfield(L, -2, u_or_p);
222 - if(c->size_hints.flags & XCB_SIZE_HINT_P_MIN_SIZE)
223 + if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_MIN_SIZE)
225 lua_pushnumber(L, c->size_hints.min_width);
226 lua_setfield(L, -2, "min_width");
227 @@ -2091,7 +2091,7 @@ luaA_client_get_size_hints(lua_State *L, client_t *c)
228 lua_setfield(L, -2, "min_height");
231 - if(c->size_hints.flags & XCB_SIZE_HINT_P_MAX_SIZE)
232 + if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_MAX_SIZE)
234 lua_pushnumber(L, c->size_hints.max_width);
235 lua_setfield(L, -2, "max_width");
236 @@ -2099,7 +2099,7 @@ luaA_client_get_size_hints(lua_State *L, client_t *c)
237 lua_setfield(L, -2, "max_height");
240 - if(c->size_hints.flags & XCB_SIZE_HINT_P_RESIZE_INC)
241 + if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_RESIZE_INC)
243 lua_pushnumber(L, c->size_hints.width_inc);
244 lua_setfield(L, -2, "width_inc");
245 @@ -2107,7 +2107,7 @@ luaA_client_get_size_hints(lua_State *L, client_t *c)
246 lua_setfield(L, -2, "height_inc");
249 - if(c->size_hints.flags & XCB_SIZE_HINT_P_ASPECT)
250 + if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_ASPECT)
252 lua_pushnumber(L, c->size_hints.min_aspect_num);
253 lua_setfield(L, -2, "min_aspect_num");
254 @@ -2119,7 +2119,7 @@ luaA_client_get_size_hints(lua_State *L, client_t *c)
255 lua_setfield(L, -2, "max_aspect_den");
258 - if(c->size_hints.flags & XCB_SIZE_HINT_BASE_SIZE)
259 + if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_BASE_SIZE)
261 lua_pushnumber(L, c->size_hints.base_width);
262 lua_setfield(L, -2, "base_width");
263 @@ -2127,7 +2127,7 @@ luaA_client_get_size_hints(lua_State *L, client_t *c)
264 lua_setfield(L, -2, "base_height");
267 - if(c->size_hints.flags & XCB_SIZE_HINT_P_WIN_GRAVITY)
268 + if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_WIN_GRAVITY)
270 switch(c->size_hints.win_gravity)
272 diff --git a/client.h b/client.h
273 index d4ef52f..9674fac 100644
276 @@ -123,7 +123,7 @@ struct client_t
277 /** Window holding command needed to start it (session management related) */
278 xcb_window_t leader_window;
279 /** Client's WM_PROTOCOLS property */
280 - xcb_get_wm_protocols_reply_t protocols;
281 + xcb_icccm_get_wm_protocols_reply_t protocols;
282 /** Client logical screen */
284 /** Client physical screen */
285 @@ -248,8 +248,8 @@ client_raise(client_t *c)
287 client_isfixed(client_t *c)
289 - return (c->size_hints.flags & XCB_SIZE_HINT_P_MAX_SIZE
290 - && c->size_hints.flags & XCB_SIZE_HINT_P_MIN_SIZE
291 + return (c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_MAX_SIZE
292 + && c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_MIN_SIZE
293 && c->size_hints.max_width == c->size_hints.min_width
294 && c->size_hints.max_height == c->size_hints.min_height
295 && c->size_hints.max_width
296 diff --git a/common/xutil.c b/common/xutil.c
297 index 3d80e8d..c5a2127 100644
301 #include "common/util.h"
304 -#include <xcb/xcb_atom.h>
305 #include <xcb/xcb_icccm.h>
307 #include "common/xutil.h"
308 diff --git a/event.c b/event.c
309 index 8527ec5..a35918b 100644
312 @@ -721,7 +721,7 @@ event_handle_clientmessage(xcb_client_message_event_t *ev)
314 if((c = client_getbywin(ev->window))
316 - && ev->data.data32[0] == XCB_WM_STATE_ICONIC)
317 + && ev->data.data32[0] == XCB_ICCCM_WM_STATE_ICONIC)
319 luaA_object_push(globalconf.L, c);
320 client_set_minimized(globalconf.L, -1, true);
321 @@ -795,13 +795,13 @@ static void
322 xerror(xcb_generic_error_t *e)
325 - if(e->error_code == XCB_EVENT_ERROR_BAD_WINDOW
326 - || (e->error_code == XCB_EVENT_ERROR_BAD_MATCH
327 + if(e->error_code == XCB_WINDOW
328 + || (e->error_code == XCB_MATCH
329 && e->major_code == XCB_SET_INPUT_FOCUS)
330 - || (e->error_code == XCB_EVENT_ERROR_BAD_VALUE
331 + || (e->error_code == XCB_VALUE
332 && e->major_code == XCB_KILL_CLIENT)
333 || (e->major_code == XCB_CONFIGURE_WINDOW
334 - && e->error_code == XCB_EVENT_ERROR_BAD_MATCH))
335 + && e->error_code == XCB_MATCH))
338 warn("X error: request=%s, error=%s",
339 diff --git a/ewmh.c b/ewmh.c
340 index 0aa5de7..ba4776c 100644
343 @@ -226,7 +226,7 @@ ewmh_update_net_active_window(int phys_screen)
345 xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
346 xutil_screen_get(globalconf.connection, phys_screen)->root,
347 - _NET_ACTIVE_WINDOW, WINDOW, 32, 1, &win);
348 + _NET_ACTIVE_WINDOW, XCB_ATOM_WINDOW, 32, 1, &win);
352 @@ -425,7 +425,7 @@ ewmh_client_update_hints(client_t *c)
353 state[i++] = _NET_WM_STATE_DEMANDS_ATTENTION;
355 xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
356 - c->window, _NET_WM_STATE, ATOM, 32, i, state);
357 + c->window, _NET_WM_STATE, XCB_ATOM_ATOM, 32, i, state);
360 /** Update the client active desktop.
361 diff --git a/property.c b/property.c
362 index d5090c6..d2223ef 100644
365 @@ -105,14 +105,14 @@ property_update_wm_transient_for(client_t *c, xcb_get_property_reply_t *reply)
369 - if(!xcb_get_wm_transient_for_from_reply(&trans, reply))
370 + if(!xcb_icccm_get_wm_transient_for_from_reply(&trans, reply))
375 - if(!xcb_get_wm_transient_for_reply(globalconf.connection,
376 - xcb_get_wm_transient_for_unchecked(globalconf.connection,
378 + if(!xcb_icccm_get_wm_transient_for_reply(globalconf.connection,
379 + xcb_icccm_get_wm_transient_for_unchecked(globalconf.connection,
384 @@ -160,15 +160,15 @@ property_update_wm_normal_hints(client_t *c, xcb_get_property_reply_t *reply)
388 - if(!xcb_get_wm_size_hints_from_reply(&c->size_hints, reply))
389 + if(!xcb_icccm_get_wm_size_hints_from_reply(&c->size_hints, reply))
394 - if(!xcb_get_wm_normal_hints_reply(globalconf.connection,
395 - xcb_get_wm_normal_hints_unchecked(globalconf.connection,
397 - &c->size_hints, NULL))
398 + if(!xcb_icccm_get_wm_normal_hints_reply(globalconf.connection,
399 + xcb_icccm_get_wm_normal_hints_unchecked(globalconf.connection,
401 + &c->size_hints, NULL))
405 @@ -180,31 +180,31 @@ property_update_wm_normal_hints(client_t *c, xcb_get_property_reply_t *reply)
407 property_update_wm_hints(client_t *c, xcb_get_property_reply_t *reply)
409 - xcb_wm_hints_t wmh;
410 + xcb_icccm_wm_hints_t wmh;
414 - if(!xcb_get_wm_hints_from_reply(&wmh, reply))
415 + if(!xcb_icccm_get_wm_hints_from_reply(&wmh, reply))
420 - if(!xcb_get_wm_hints_reply(globalconf.connection,
421 - xcb_get_wm_hints_unchecked(globalconf.connection, c->window),
423 + if(!xcb_icccm_get_wm_hints_reply(globalconf.connection,
424 + xcb_icccm_get_wm_hints_unchecked(globalconf.connection, c->window),
429 luaA_object_push(globalconf.L, c);
430 - client_set_urgent(globalconf.L, -1, xcb_wm_hints_get_urgency(&wmh));
431 - if(wmh.flags & XCB_WM_HINT_STATE &&
432 - wmh.initial_state == XCB_WM_STATE_WITHDRAWN)
433 + client_set_urgent(globalconf.L, -1, xcb_icccm_wm_hints_get_urgency(&wmh));
434 + if(wmh.flags & XCB_ICCCM_WM_HINT_STATE &&
435 + wmh.initial_state == XCB_ICCCM_WM_STATE_WITHDRAWN)
436 client_set_border_width(globalconf.L, -1, 0);
438 - if(wmh.flags & XCB_WM_HINT_INPUT)
439 + if(wmh.flags & XCB_ICCCM_WM_HINT_INPUT)
440 c->nofocus = !wmh.input;
442 - if(wmh.flags & XCB_WM_HINT_WINDOW_GROUP)
443 + if(wmh.flags & XCB_ICCCM_WM_HINT_WINDOW_GROUP)
444 client_set_group_window(globalconf.L, -1, wmh.window_group);
446 lua_pop(globalconf.L, 1);
447 @@ -217,18 +217,18 @@ property_update_wm_hints(client_t *c, xcb_get_property_reply_t *reply)
449 property_update_wm_class(client_t *c, xcb_get_property_reply_t *reply)
451 - xcb_get_wm_class_reply_t hint;
452 + xcb_icccm_get_wm_class_reply_t hint;
456 - if(!xcb_get_wm_class_from_reply(&hint, reply))
457 + if(!xcb_icccm_get_wm_class_from_reply(&hint, reply))
462 - if(!xcb_get_wm_class_reply(globalconf.connection,
463 - xcb_get_wm_class_unchecked(globalconf.connection, c->window),
465 + if(!xcb_icccm_get_wm_class_reply(globalconf.connection,
466 + xcb_icccm_get_wm_class_unchecked(globalconf.connection, c->window),
471 @@ -238,7 +238,7 @@ property_update_wm_class(client_t *c, xcb_get_property_reply_t *reply)
473 /* only delete reply if we get it ourselves */
475 - xcb_get_wm_class_reply_wipe(&hint);
476 + xcb_icccm_get_wm_class_reply_wipe(&hint);
480 @@ -308,30 +308,30 @@ property_update_net_wm_pid(client_t *c,
482 property_update_wm_protocols(client_t *c, xcb_get_property_reply_t *reply)
484 - xcb_get_wm_protocols_reply_t protocols;
485 + xcb_icccm_get_wm_protocols_reply_t protocols;
486 xcb_get_property_reply_t *reply_copy;
490 reply_copy = p_dup(reply, 1);
492 - if(!xcb_get_wm_protocols_from_reply(reply_copy, &protocols))
494 + if(!xcb_icccm_get_wm_protocols_from_reply(reply_copy, &protocols))
496 p_delete(&reply_copy);
503 /* If this fails for any reason, we still got the old value */
504 - if(!xcb_get_wm_protocols_reply(globalconf.connection,
505 - xcb_get_wm_protocols_unchecked(globalconf.connection,
506 - c->window, WM_PROTOCOLS),
508 + if(!xcb_icccm_get_wm_protocols_reply(globalconf.connection,
509 + xcb_icccm_get_wm_protocols_unchecked(globalconf.connection,
510 + c->window, WM_PROTOCOLS),
515 - xcb_get_wm_protocols_reply_wipe(&c->protocols);
516 + xcb_icccm_get_wm_protocols_reply_wipe(&c->protocols);
517 memcpy(&c->protocols, &protocols, sizeof(protocols));
520 diff --git a/selection.c b/selection.c
521 index 527ec40..44b57c5 100644
524 @@ -86,18 +86,18 @@ luaA_selection_get(lua_State *L)
525 if(event_notify->selection == XCB_ATOM_PRIMARY
526 && event_notify->property != XCB_NONE)
528 - xcb_get_text_property_reply_t prop;
529 + xcb_icccm_get_text_property_reply_t prop;
530 xcb_get_property_cookie_t cookie =
531 - xcb_get_text_property(globalconf.connection,
532 - event_notify->requestor,
533 - event_notify->property);
534 + xcb_icccm_get_text_property(globalconf.connection,
535 + event_notify->requestor,
536 + event_notify->property);
538 - if(xcb_get_text_property_reply(globalconf.connection,
539 - cookie, &prop, NULL))
540 + if(xcb_icccm_get_text_property_reply(globalconf.connection,
541 + cookie, &prop, NULL))
543 lua_pushlstring(L, prop.name, prop.name_len);
545 - xcb_get_text_property_reply_wipe(&prop);
546 + xcb_icccm_get_text_property_reply_wipe(&prop);
548 xcb_delete_property(globalconf.connection,
549 event_notify->requestor,
550 diff --git a/systray.c b/systray.c
551 index 6ea3dd5..92b7d39 100644
554 @@ -197,7 +197,7 @@ systray_request_handle(xcb_window_t embed_win, int phys_screen, xembed_info_t *i
556 xcb_change_window_attributes(globalconf.connection, embed_win, XCB_CW_EVENT_MASK,
558 - window_state_set(embed_win, XCB_WM_STATE_WITHDRAWN);
559 + window_state_set(embed_win, XCB_ICCCM_WM_STATE_WITHDRAWN);
561 /* we grab the window, but also make sure it's automatically reparented back
562 * to the root window if we should die.
563 diff --git a/window.c b/window.c
564 index b86fa38..6a1909f 100644
567 @@ -60,7 +60,7 @@ uint32_t
568 window_state_get_reply(xcb_get_property_cookie_t cookie)
570 /* If no property is set, we just assume a sane default. */
571 - uint32_t result = XCB_WM_STATE_NORMAL;
572 + uint32_t result = XCB_ICCCM_WM_STATE_NORMAL;
573 xcb_get_property_reply_t *prop_r;
575 if((prop_r = xcb_get_property_reply(globalconf.connection, cookie, NULL)))
576 @@ -187,7 +187,7 @@ window_opacity_set(xcb_window_t win, double opacity)
578 uint32_t real_opacity = opacity * 0xffffffff;
579 xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, win,
580 - _NET_WM_WINDOW_OPACITY, CARDINAL, 32, 1L, &real_opacity);
581 + _NET_WM_WINDOW_OPACITY, XCB_ATOM_CARDINAL, 32, 1L, &real_opacity);
584 xcb_delete_property(globalconf.connection, win, _NET_WM_WINDOW_OPACITY);