]> git.sur5r.net Git - i3/i3/blobdiff - src/util.c
implement 'move' command in the new parser
[i3/i3] / src / util.c
index e381aa52b5daaadd427aec0fecb51f1fe2c6eff5..c8f4ee389492962b8817b8be39737dcbed20362a 100644 (file)
@@ -21,9 +21,7 @@
 
 #include "all.h"
 
-//static iconv_t conversion_descriptor = 0;
-struct keyvalue_table_head by_parent = TAILQ_HEAD_INITIALIZER(by_parent);
-struct keyvalue_table_head by_child = TAILQ_HEAD_INITIALIZER(by_child);
+static iconv_t conversion_descriptor = 0;
 
 int min(int a, int b) {
         return (a < b ? a : b);
@@ -33,6 +31,13 @@ int max(int a, int b) {
         return (a > b ? a : b);
 }
 
+bool rect_contains(Rect rect, uint32_t x, uint32_t y) {
+        return (x >= rect.x &&
+                x <= (rect.x + rect.width) &&
+                y >= rect.y &&
+                y <= (rect.y + rect.height));
+}
+
 /*
  * Updates *destination with new_value and returns true if it was changed or false
  * if it was the same
@@ -73,46 +78,6 @@ char *sstrdup(const char *str) {
         return result;
 }
 
-#if 0
-
-/*
- * The table_* functions emulate the behaviour of libxcb-wm, which in libxcb 0.3.4 suddenly
- * vanished. Great.
- *
- */
-bool table_put(struct keyvalue_table_head *head, uint32_t key, void *value) {
-        struct keyvalue_element *element = scalloc(sizeof(struct keyvalue_element));
-        element->key = key;
-        element->value = value;
-
-        TAILQ_INSERT_TAIL(head, element, elements);
-        return true;
-}
-
-void *table_remove(struct keyvalue_table_head *head, uint32_t key) {
-        struct keyvalue_element *element;
-
-        TAILQ_FOREACH(element, head, elements)
-                if (element->key == key) {
-                        void *value = element->value;
-                        TAILQ_REMOVE(head, element, elements);
-                        free(element);
-                        return value;
-                }
-
-        return NULL;
-}
-
-void *table_get(struct keyvalue_table_head *head, uint32_t key) {
-        struct keyvalue_element *element;
-
-        TAILQ_FOREACH(element, head, elements)
-                if (element->key == key)
-                        return element->value;
-
-        return NULL;
-}
-#endif
 /*
  * Starts the given application by passing it through a shell. We use double fork
  * to avoid zombie processes. As the started application’s parent exits (immediately),
@@ -158,7 +123,6 @@ void check_error(xcb_connection_t *conn, xcb_void_cookie_t cookie, char *err_mes
         }
 }
 
-#if 0
 /*
  * Converts the given string to UCS-2 big endian for use with
  * xcb_image_text_16(). The amount of real glyphs is stored in real_strlen,
@@ -202,6 +166,7 @@ char *convert_utf8_to_ucs2(char *input, int *real_strlen) {
 
         return buffer;
 }
+#if 0
 
 /*
  * Returns the client which comes next in focus stack (= was selected before) for