$OpenBSD: patch-objects_client_c,v 1.1 2013/05/22 15:05:50 dcoppa Exp $

Revert to the old xcb-util-0.3.6 API

--- objects/client.c.orig	Mon May 20 13:35:44 2013
+++ objects/client.c	Mon May 20 13:37:04 2013
@@ -46,7 +46,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);
@@ -71,20 +71,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);
     }
@@ -561,7 +561,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)
     {
@@ -633,26 +633,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;
@@ -660,7 +660,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
@@ -701,7 +701,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);
@@ -710,7 +710,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;
@@ -892,9 +892,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);
@@ -1197,7 +1197,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 */
@@ -1861,9 +1861,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)
@@ -1877,9 +1877,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)
@@ -1892,7 +1892,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");
@@ -1900,7 +1900,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");
@@ -1908,7 +1908,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");
@@ -1916,7 +1916,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");
@@ -1928,7 +1928,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");
@@ -1936,7 +1936,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)
         {
