$OpenBSD: patch-objects_client_c,v 1.7 2013/10/15 09:28:46 dcoppa Exp $

Revert to the old xcb-util-0.3.6 API

--- objects/client.c.orig	Sat Oct 12 18:48:49 2013
+++ objects/client.c	Tue Oct 15 09:51:13 2013
@@ -45,7 +45,7 @@ static void
 client_wipe(client_t *c)
 {
     key_array_wipe(&c->keys);
-    xcb_icccm_get_wm_protocols_reply_wipe(&c->protocols);
+    xcb_get_wm_protocols_reply_wipe(&c->protocols);
     p_delete(&c->machine);
     p_delete(&c->class);
     p_delete(&c->instance);
@@ -70,20 +70,20 @@ client_set_urgent(lua_State *L, int cidx, bool urgent)
     if(c->urgent != urgent)
     {
         xcb_get_property_cookie_t hints =
-            xcb_icccm_get_wm_hints_unchecked(globalconf.connection, c->window);
+            xcb_get_wm_hints_unchecked(globalconf.connection, c->window);
 
         c->urgent = urgent;
 
         /* update ICCCM hints */
-        xcb_icccm_wm_hints_t wmh;
-        xcb_icccm_get_wm_hints_reply(globalconf.connection, hints, &wmh, NULL);
+        xcb_wm_hints_t wmh;
+        xcb_get_wm_hints_reply(globalconf.connection, hints, &wmh, NULL);
 
         if(urgent)
-            wmh.flags |= XCB_ICCCM_WM_HINT_X_URGENCY;
+            wmh.flags |= XCB_WM_HINT_X_URGENCY;
         else
-            wmh.flags &= ~XCB_ICCCM_WM_HINT_X_URGENCY;
+            wmh.flags &= ~XCB_WM_HINT_X_URGENCY;
 
-        xcb_icccm_set_wm_hints(globalconf.connection, c->window, &wmh);
+        xcb_set_wm_hints(globalconf.connection, c->window, &wmh);
 
         luaA_object_emit_signal(L, cidx, "property::urgent", 0);
     }
@@ -565,7 +565,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_ICCCM_WM_STATE_NORMAL);
+    xwindow_set_state(c->window, XCB_WM_STATE_NORMAL);
 
     if(!startup)
     {
@@ -637,26 +637,26 @@ client_apply_size_hints(client_t *c, area_t geometry)
     /* Size hints are applied to the window without any decoration */
     client_remove_titlebar_geometry(c, &geometry);
 
-    if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_SIZE)
+    if(c->size_hints.flags & XCB_SIZE_HINT_P_SIZE)
     {
         basew = c->size_hints.base_width;
         baseh = c->size_hints.base_height;
         real_basew = basew;
         real_baseh = baseh;
     }
-    else if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_MIN_SIZE)
+    else if(c->size_hints.flags & XCB_SIZE_HINT_P_MIN_SIZE)
     {
         /* base size is substituted with min size if not specified */
         basew = c->size_hints.min_width;
         baseh = c->size_hints.min_height;
     }
 
-    if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_MIN_SIZE)
+    if(c->size_hints.flags & XCB_SIZE_HINT_P_MIN_SIZE)
     {
         minw = c->size_hints.min_width;
         minh = c->size_hints.min_height;
     }
-    else if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_SIZE)
+    else if(c->size_hints.flags & XCB_SIZE_HINT_P_SIZE)
     {
         /* min size is substituted with base size if not specified */
         minw = c->size_hints.base_width;
@@ -664,7 +664,7 @@ client_apply_size_hints(client_t *c, area_t geometry)
     }
 
     /* Handle the size aspect ratio */
-    if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_ASPECT
+    if(c->size_hints.flags & XCB_SIZE_HINT_P_ASPECT
             && c->size_hints.min_aspect_den > 0
             && c->size_hints.max_aspect_den > 0
             && geometry.height > real_baseh
@@ -705,7 +705,7 @@ client_apply_size_hints(client_t *c, area_t geometry)
     geometry.height = MAX(geometry.height, minh);
 
     /* Handle the maximum size */
-    if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_MAX_SIZE)
+    if(c->size_hints.flags & XCB_SIZE_HINT_P_MAX_SIZE)
     {
         if(c->size_hints.max_width)
             geometry.width = MIN(geometry.width, c->size_hints.max_width);
@@ -714,7 +714,7 @@ client_apply_size_hints(client_t *c, area_t geometry)
     }
 
     /* Handle the size increment */
-    if(c->size_hints.flags & (XCB_ICCCM_SIZE_HINT_P_RESIZE_INC | XCB_ICCCM_SIZE_HINT_BASE_SIZE)
+    if(c->size_hints.flags & (XCB_SIZE_HINT_P_RESIZE_INC | XCB_SIZE_HINT_BASE_SIZE)
        && c->size_hints.width_inc && c->size_hints.height_inc)
     {
         uint16_t t1 = geometry.width, t2 = geometry.height;
@@ -896,9 +896,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_ICCCM_WM_STATE_ICONIC);
+            xwindow_set_state(c->window, XCB_WM_STATE_ICONIC);
         else
-            xwindow_set_state(c->window, XCB_ICCCM_WM_STATE_NORMAL);
+            xwindow_set_state(c->window, XCB_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);
@@ -1201,7 +1201,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_ICCCM_WM_STATE_WITHDRAWN);
+        xwindow_set_state(c->window, XCB_WM_STATE_WITHDRAWN);
     }
 
     /* set client as invalid */
@@ -1856,9 +1856,9 @@ luaA_client_get_size_hints(lua_State *L, client_t *c)
 
     lua_createtable(L, 0, 1);
 
-    if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_US_POSITION)
+    if(c->size_hints.flags & XCB_SIZE_HINT_US_POSITION)
         u_or_p = "user_position";
-    else if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_POSITION)
+    else if(c->size_hints.flags & XCB_SIZE_HINT_P_POSITION)
         u_or_p = "program_position";
 
     if(u_or_p)
@@ -1872,9 +1872,9 @@ luaA_client_get_size_hints(lua_State *L, client_t *c)
         u_or_p = NULL;
     }
 
-    if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_US_SIZE)
+    if(c->size_hints.flags & XCB_SIZE_HINT_US_SIZE)
         u_or_p = "user_size";
-    else if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_SIZE)
+    else if(c->size_hints.flags & XCB_SIZE_HINT_P_SIZE)
         u_or_p = "program_size";
 
     if(u_or_p)
@@ -1887,7 +1887,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_ICCCM_SIZE_HINT_P_MIN_SIZE)
+    if(c->size_hints.flags & XCB_SIZE_HINT_P_MIN_SIZE)
     {
         lua_pushnumber(L, c->size_hints.min_width);
         lua_setfield(L, -2, "min_width");
@@ -1895,7 +1895,7 @@ luaA_client_get_size_hints(lua_State *L, client_t *c)
         lua_setfield(L, -2, "min_height");
     }
 
-    if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_MAX_SIZE)
+    if(c->size_hints.flags & XCB_SIZE_HINT_P_MAX_SIZE)
     {
         lua_pushnumber(L, c->size_hints.max_width);
         lua_setfield(L, -2, "max_width");
@@ -1903,7 +1903,7 @@ luaA_client_get_size_hints(lua_State *L, client_t *c)
         lua_setfield(L, -2, "max_height");
     }
 
-    if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_RESIZE_INC)
+    if(c->size_hints.flags & XCB_SIZE_HINT_P_RESIZE_INC)
     {
         lua_pushnumber(L, c->size_hints.width_inc);
         lua_setfield(L, -2, "width_inc");
@@ -1911,7 +1911,7 @@ luaA_client_get_size_hints(lua_State *L, client_t *c)
         lua_setfield(L, -2, "height_inc");
     }
 
-    if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_ASPECT)
+    if(c->size_hints.flags & XCB_SIZE_HINT_P_ASPECT)
     {
         lua_pushnumber(L, c->size_hints.min_aspect_num);
         lua_setfield(L, -2, "min_aspect_num");
@@ -1923,7 +1923,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_ICCCM_SIZE_HINT_BASE_SIZE)
+    if(c->size_hints.flags & XCB_SIZE_HINT_BASE_SIZE)
     {
         lua_pushnumber(L, c->size_hints.base_width);
         lua_setfield(L, -2, "base_width");
@@ -1931,7 +1931,7 @@ luaA_client_get_size_hints(lua_State *L, client_t *c)
         lua_setfield(L, -2, "base_height");
     }
 
-    if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_WIN_GRAVITY)
+    if(c->size_hints.flags & XCB_SIZE_HINT_P_WIN_GRAVITY)
     {
         switch(c->size_hints.win_gravity)
         {
