X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=include%2Futil.h;h=91b533a1bcae9ce8be8441320847212dd9519792;hb=568cafd4ec1f9d818f4b2ee4167a7b5666f7836a;hp=937e654b6f8975412fd859380ba80277a267a9d3;hpb=c145f7e5297ef06aaf84689762a736d5bc8cbb83;p=i3%2Fi3 diff --git a/include/util.h b/include/util.h index 937e654b..91b533a1 100644 --- a/include/util.h +++ b/include/util.h @@ -34,12 +34,10 @@ } \ while (0) -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); +Rect rect_add(Rect a, Rect b); /** * Updates *destination with new_value and returns true if it was changed or false @@ -76,26 +74,6 @@ void *srealloc(void *ptr, size_t size); */ 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; - * - */ -void *table_remove(struct keyvalue_table_head *head, uint32_t key); - -/** - * Returns the value of the element of the given keyvalue-table with the given - * key. - * - */ -void *table_get(struct keyvalue_table_head *head, uint32_t key); - /** * 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 @@ -125,59 +103,25 @@ 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. - * - */ -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 - * signalize the user the new focus situation) - * - */ -void set_focus(xcb_connection_t *conn, Client *client, bool set_anyways); - -/** - * Called when the user switches to another mode or when the container is - * destroyed and thus needs to be cleaned up. - * - */ -void leave_stack_mode(xcb_connection_t *conn, Container *container); - -/** - * Switches the layout of the given container taking care of the necessary - * house-keeping +/* + * This function resolves ~ in pathnames. + * It may resolve wildcards in the first part of the path, but if no match + * or multiple matches are found, it just returns a copy of path as given. * */ -void switch_layout_mode(xcb_connection_t *conn, Container *container, int mode); +char *resolve_tilde(const char *path); -/** - * Gets the first matching client for the given window class/window title. - * If the paramater specific is set to a specific client, only this one - * will be checked. +/* + * Checks if the given path exists by calling stat(). * */ -Client *get_matching_client(xcb_connection_t *conn, - const char *window_classtitle, Client *specific); -#endif +bool path_exists(const char *path); /* * 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 +void i3_restart(bool forget_layout); #endif