]> git.sur5r.net Git - i3/i3/blobdiff - include/util.h
re-add focus follows mouse handling
[i3/i3] / include / util.h
index 0b3357493f46ca71768516e7218d379b76dd6d65..cca6985db674fc3192b325041dcf45e5ef1c80cf 100644 (file)
@@ -3,7 +3,7 @@
  *
  * i3 - an improved dynamic tiling window manager
  *
- * (c) 2009 Michael Stapelberg and contributors
+ * © 2009 Michael Stapelberg and contributors
  *
  * See file LICENSE for license information.
  *
 } \
 while (0)
 
-/** ##__VA_ARGS__ means: leave out __VA_ARGS__ completely if it is empty, that
-   is, delete the preceding comma */
-#define LOG(fmt, ...) slog("%s:%s:%d - " fmt, __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__)
-
-TAILQ_HEAD(keyvalue_table_head, keyvalue_element);
-extern struct keyvalue_table_head by_parent;
-extern struct keyvalue_table_head by_child;
-
 int min(int a, int b);
 int max(int a, int b);
+bool rect_contains(Rect rect, uint32_t x, uint32_t y);
 
 /**
- * Logs the given message to stdout while prefixing the current time to it.
- * This is to be called by LOG() which includes filename/linenumber
+ * Updates *destination with new_value and returns true if it was changed or false
+ * if it was the same
  *
  */
-void slog(char *fmt, ...);
+bool update_if_necessary(uint32_t *destination, const uint32_t new_value);
 
 /**
  * Safe-wrapper around malloc which exits if malloc returns NULL (meaning that
@@ -67,31 +60,18 @@ void *smalloc(size_t size);
 void *scalloc(size_t size);
 
 /**
- * Safe-wrapper around strdup which exits if malloc returns NULL (meaning that
- * there is no more memory available)
- *
- */
-char *sstrdup(const char *str);
-
-/**
- * Inserts an element into the given keyvalue-table using the given key.
- *
- */
-bool table_put(struct keyvalue_table_head *head, uint32_t key, void *value);
-
-/**
- * Removes the element from the given keyvalue-table with the given key and
- * returns its value;
+ * Safe-wrapper around realloc which exits if realloc returns NULL (meaning
+ * that there is no more memory available).
  *
  */
-void *table_remove(struct keyvalue_table_head *head, uint32_t key);
+void *srealloc(void *ptr, size_t size);
 
 /**
- * Returns the value of the element of the given keyvalue-table with the given
- * key.
+ * Safe-wrapper around strdup which exits if malloc returns NULL (meaning that
+ * there is no more memory available)
  *
  */
-void *table_get(struct keyvalue_table_head *head, uint32_t key);
+char *sstrdup(const char *str);
 
 /**
  * Starts the given application by passing it through a shell. We use double
@@ -122,6 +102,7 @@ void check_error(xcb_connection_t *conn, xcb_void_cookie_t cookie,
  */
 char *convert_utf8_to_ucs2(char *input, int *real_strlen);
 
+#if 0
 /**
  * Returns the client which comes next in focus stack (= was selected before) for
  * the given container, optionally excluding the given client.
@@ -129,7 +110,9 @@ char *convert_utf8_to_ucs2(char *input, int *real_strlen);
  */
 Client *get_last_focused_client(xcb_connection_t *conn, Container *container,
                                 Client *exclude);
+#endif
 
+#if 0
 /**
  * Sets the given client as focused by updating the data structures correctly,
  * updating the X input focus and finally re-decorating both windows (to
@@ -160,5 +143,18 @@ void switch_layout_mode(xcb_connection_t *conn, Container *container, int mode);
  */
 Client *get_matching_client(xcb_connection_t *conn,
                             const char *window_classtitle, Client *specific);
+#endif
+
+/*
+ * Restart i3 in-place
+ * appends -a to argument list to disable autostart
+ *
+ */
+void i3_restart();
+
+#if defined(__OpenBSD__)
+/* OpenBSD does not provide memmem(), so we provide FreeBSD’s implementation */
+void *memmem(const void *l, size_t l_len, const void *s, size_t s_len);
+#endif
 
 #endif