]> git.lizzy.rs Git - bspwm.git/commitdiff
Remove a few useless header inclusion via deheader
authorBastien Dejean <nihilhill@gmail.com>
Thu, 19 Sep 2013 13:38:22 +0000 (15:38 +0200)
committerBastien Dejean <nihilhill@gmail.com>
Thu, 19 Sep 2013 13:38:22 +0000 (15:38 +0200)
19 files changed:
Makefile
Sourcedeps
bspwm.c
desktop.c
events.c
ewmh.c
helpers.c
history.c
messages.c
monitor.c
query.c
restore.c
rule.c [new file with mode: 0644]
rule.h [new file with mode: 0644]
rules.c [deleted file]
rules.h [deleted file]
settings.c
tree.c
window.c

index d68af405da834ce41ebee77d0ee7eb2bfb1ce89b..9be45477ba06407abbf21d1c564d8c2b710bfb67 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,7 @@ BASHCPL = $(PREFIX)/share/bash-completion/completions
 ZSHCPL = $(PREFIX)/share/zsh/site-functions
 
 WM_SRC = bspwm.c helpers.c settings.c monitor.c desktop.c tree.c history.c \
-        events.c window.c messages.c query.c restore.c rules.c ewmh.c
+        events.c window.c messages.c query.c restore.c rule.c ewmh.c
 WM_OBJ = $(WM_SRC:.c=.o)
 CL_SRC = bspc.c helpers.c
 CL_OBJ = $(CL_SRC:.c=.o)
index 8b3a882b2d89fde3cd4dd2578bce6e5ecdf1d19d..49a59f9ad73207fb1799b23b6b57eb997b099cb4 100644 (file)
@@ -1,15 +1,15 @@
 bspc.o: bspc.c common.h helpers.h
-bspwm.o: bspwm.c bspwm.h common.h desktop.h events.h ewmh.h helpers.h messages.h monitor.h rules.h settings.h tree.h types.h window.h
+bspwm.o: bspwm.c bspwm.h common.h desktop.h events.h ewmh.h helpers.h messages.h monitor.h rule.h settings.h tree.h types.h window.h
 desktop.o: desktop.c bspwm.h desktop.h ewmh.h helpers.h history.h tree.h types.h window.h
-events.o: events.c bspwm.h events.h ewmh.h helpers.h monitor.h query.h rules.h settings.h tree.h types.h window.h
+events.o: events.c bspwm.h events.h ewmh.h helpers.h monitor.h query.h settings.h tree.h types.h window.h
 ewmh.o: ewmh.c bspwm.h ewmh.h helpers.h settings.h tree.h types.h
 helpers.o: helpers.c bspwm.h helpers.h types.h
-history.o: history.c helpers.h history.h query.h types.h
-messages.o: messages.c bspwm.h common.h desktop.h events.h ewmh.h helpers.h messages.h monitor.h query.h restore.h rules.h settings.h tree.h types.h window.h
+history.o: history.c helpers.h query.h types.h
+messages.o: messages.c bspwm.h desktop.h events.h ewmh.h helpers.h messages.h monitor.h query.h restore.h rule.h settings.h tree.h types.h window.h
 monitor.o: monitor.c bspwm.h desktop.h ewmh.h helpers.h monitor.h tree.h types.h window.h
-query.o: query.c bspwm.h helpers.h history.h messages.h query.h settings.h tree.h types.h
+query.o: query.c bspwm.h helpers.h history.h messages.h query.h tree.h types.h
 restore.o: restore.c bspwm.h desktop.h ewmh.h helpers.h history.h monitor.h query.h restore.h settings.h tree.h types.h
-rules.o: rules.c bspwm.h ewmh.h helpers.h query.h rules.h types.h window.h
-settings.o: settings.c bspwm.h common.h helpers.h settings.h types.h
+rule.o: rule.c bspwm.h ewmh.h helpers.h query.h rule.h types.h window.h
+settings.o: settings.c bspwm.h helpers.h settings.h types.h
 tree.o: tree.c bspwm.h desktop.h ewmh.h helpers.h history.h query.h settings.h tree.h types.h window.h
-window.o: window.c bspwm.h ewmh.h helpers.h query.h rules.h settings.h tree.h types.h window.h
+window.o: window.c bspwm.h ewmh.h helpers.h query.h rule.h settings.h tree.h types.h window.h
diff --git a/bspwm.c b/bspwm.c
index d21cdd42778500ed6f05dd5737fb624bd81eba8c..36e46186f855fef3570a0aa1cfe1b2f288b1e0a7 100644 (file)
--- a/bspwm.c
+++ b/bspwm.c
@@ -2,28 +2,22 @@
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
-#include <signal.h>
 #include <fcntl.h>
 #include <ctype.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <sys/select.h>
-#include <xcb/xcb.h>
-#include <xcb/xcb_event.h>
-#include <xcb/xcb_ewmh.h>
-#include <xcb/randr.h>
 #include "types.h"
 #include "desktop.h"
 #include "monitor.h"
 #include "settings.h"
 #include "messages.h"
-#include "rules.h"
 #include "events.h"
 #include "common.h"
-#include "helpers.h"
-#include "window.h"
 #include "bspwm.h"
 #include "tree.h"
+#include "window.h"
+#include "rule.h"
 #include "ewmh.h"
 
 int main(int argc, char *argv[])
index 49ccfea52ec132185ffeeb25902591535dfedadb..d7dbccdd71c75460009b4309282ba19526d7ac2e 100644 (file)
--- a/desktop.c
+++ b/desktop.c
@@ -1,10 +1,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include "bspwm.h"
-#include "types.h"
 #include "desktop.h"
-#include "history.h"
 #include "tree.h"
+#include "history.h"
 #include "window.h"
 #include "ewmh.h"
 
index ec2794f30585db81f7845097739eddb82f0344cd..7410850948c140cbd01ef8e1c9fa97505dd99532 100644 (file)
--- a/events.c
+++ b/events.c
@@ -1,20 +1,13 @@
-#include <stdio.h>
 #include <stdlib.h>
-#include <string.h>
-#include <xcb/xcb.h>
-#include <xcb/randr.h>
-#include <xcb/xcb_event.h>
 #include <xcb/xcb_icccm.h>
 #include "types.h"
-#include "monitor.h"
 #include "bspwm.h"
 #include "settings.h"
-#include "helpers.h"
-#include "window.h"
 #include "events.h"
-#include "tree.h"
+#include "monitor.h"
+#include "window.h"
 #include "query.h"
-#include "rules.h"
+#include "tree.h"
 #include "ewmh.h"
 
 void handle_event(xcb_generic_event_t *evt)
diff --git a/ewmh.c b/ewmh.c
index 192cff12082284f351a11f3c9b9dd340db836108..903d492eb6e104f968b328aa9509b44a28672c51 100644 (file)
--- a/ewmh.c
+++ b/ewmh.c
@@ -1,8 +1,5 @@
-#include <stdio.h>
 #include <string.h>
 #include <unistd.h>
-#include <xcb/xcb_ewmh.h>
-#include "types.h"
 #include "bspwm.h"
 #include "settings.h"
 #include "tree.h"
index 6b8a8444e1f8f5e00d090fcae5a99d9f5bfac60e..2011b2e117553b300cb691331685c9fc519c9568 100644 (file)
--- a/helpers.c
+++ b/helpers.c
@@ -1,10 +1,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <math.h>
-#include <xcb/xcb.h>
-#include <xcb/xcb_event.h>
 #include "bspwm.h"
-#include "helpers.h"
 
 void warn(char *fmt, ...)
 {
index 6334a67bb3d5e4fdb44243f67b6b11443c043932..30355358a0bb1242d5d1444804367f08d1265883 100644 (file)
--- a/history.c
+++ b/history.c
@@ -1,7 +1,6 @@
 #include <stdlib.h>
 #include "types.h"
 #include "query.h"
-#include "history.h"
 
 focus_history_t *make_focus_history(void)
 {
index 2370dbda52c72baf63da5e1b82c0e7176ac60784..734cf111029dc401bd1c24f78627dafaff2ad789 100644 (file)
@@ -3,20 +3,17 @@
 #include <stdlib.h>
 #include <errno.h>
 #include "settings.h"
-#include "messages.h"
 #include "query.h"
-#include "restore.h"
-#include "common.h"
-#include "types.h"
+#include "bspwm.h"
+#include "tree.h"
 #include "desktop.h"
 #include "monitor.h"
-#include "bspwm.h"
-#include "ewmh.h"
-#include "helpers.h"
 #include "window.h"
+#include "rule.h"
+#include "restore.h"
 #include "events.h"
-#include "tree.h"
-#include "rules.h"
+#include "ewmh.h"
+#include "messages.h"
 
 bool cmd_window(char **args, int num)
 {
index 35d1e24324902253880b0d5860e22e2c901ac081..d93b9a3a3aad9bafb79948d508cbe49250dea1f0 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -1,10 +1,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include "bspwm.h"
-#include "types.h"
-#include "desktop.h"
 #include "tree.h"
 #include "monitor.h"
+#include "desktop.h"
 #include "window.h"
 #include "ewmh.h"
 
diff --git a/query.c b/query.c
index 15eb548e48eee57d72fe2980c612121e935ce8a7..a1e5f179b3e43b429172f4852f6100faaf109fbf 100644 (file)
--- a/query.c
+++ b/query.c
@@ -1,11 +1,9 @@
-#include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 #include "bspwm.h"
 #include "tree.h"
-#include "history.h"
-#include "settings.h"
 #include "messages.h"
+#include "history.h"
 #include "query.h"
 
 void query_monitors(coordinates_t loc, domain_t dom, char *rsp)
index b007e163ea13c362f802517e3a9e81774dab4cbc..2b6fb80ad15fcd45086e52830ea68c764005da96 100644 (file)
--- a/restore.c
+++ b/restore.c
@@ -1,14 +1,14 @@
 #include <ctype.h>
 #include <string.h>
+#include "bspwm.h"
 #include "types.h"
-#include "desktop.h"
 #include "monitor.h"
-#include "history.h"
+#include "desktop.h"
 #include "tree.h"
 #include "settings.h"
-#include "ewmh.h"
-#include "bspwm.h"
 #include "query.h"
+#include "history.h"
+#include "ewmh.h"
 #include "restore.h"
 
 void restore_tree(char *file_path)
diff --git a/rule.c b/rule.c
new file mode 100644 (file)
index 0000000..0303916
--- /dev/null
+++ b/rule.c
@@ -0,0 +1,191 @@
+#include <stdio.h>
+#include <string.h>
+#include <xcb/xcb_icccm.h>
+#include "bspwm.h"
+#include "ewmh.h"
+#include "window.h"
+#include "query.h"
+#include "rule.h"
+
+rule_t *make_rule(void)
+{
+    rule_t *r = malloc(sizeof(rule_t));
+    r->uid = ++rule_uid;
+    r->effect.floating = false;
+    r->effect.follow = false;
+    r->effect.focus = false;
+    r->effect.unmanage = false;
+    r->one_shot = false;
+    r->effect.desc[0] = '\0';
+    r->prev = NULL;
+    r->next = NULL;
+    return r;
+}
+
+void add_rule(rule_t *r)
+{
+    if (rule_head == NULL) {
+        rule_head = rule_tail = r;
+    } else {
+        rule_tail->next = r;
+        r->prev = rule_tail;
+        rule_tail = r;
+    }
+}
+
+void remove_rule(rule_t *r)
+{
+    if (r == NULL)
+        return;
+    rule_t *prev = r->prev;
+    rule_t *next = r->next;
+    if (prev != NULL)
+        prev->next = next;
+    if (next != NULL)
+        next->prev = prev;
+    if (r == rule_head)
+        rule_head = next;
+    if (r == rule_tail)
+        rule_tail = prev;
+    free(r);
+}
+
+void remove_rule_by_uid(unsigned int uid)
+{
+    remove_rule(find_rule(uid));
+}
+
+rule_t *find_rule(unsigned int uid)
+{
+    for (rule_t *r = rule_head; r != NULL; r = r->next)
+        if (r->uid == uid)
+            return r;
+    return NULL;
+}
+
+bool is_match(rule_t *r, xcb_window_t win)
+{
+    xcb_icccm_get_wm_class_reply_t reply;
+    int8_t success = 0;
+    if (streq(r->cause.name, MATCH_ALL) ||
+            ((success = xcb_icccm_get_wm_class_reply(dpy, xcb_icccm_get_wm_class(dpy, win), &reply, NULL)) == 1
+            && (streq(reply.class_name, r->cause.name)
+                || streq(reply.instance_name, r->cause.name)))) {
+        if (success == 1)
+            xcb_icccm_get_wm_class_reply_wipe(&reply);
+        return true;
+    }
+    return false;
+}
+
+void handle_rules(xcb_window_t win, monitor_t **m, desktop_t **d, bool *floating, bool *fullscreen, bool *locked, bool *follow, bool *transient, bool *takes_focus, bool *manage)
+{
+    xcb_ewmh_get_atoms_reply_t win_type;
+
+    if (xcb_ewmh_get_wm_window_type_reply(ewmh, xcb_ewmh_get_wm_window_type(ewmh, win), &win_type, NULL) == 1) {
+        for (unsigned int i = 0; i < win_type.atoms_len; i++) {
+            xcb_atom_t a = win_type.atoms[i];
+            if (a == ewmh->_NET_WM_WINDOW_TYPE_TOOLBAR
+                    || a == ewmh->_NET_WM_WINDOW_TYPE_UTILITY) {
+                *takes_focus = false;
+            } else if (a == ewmh->_NET_WM_WINDOW_TYPE_DIALOG) {
+                *floating = true;
+            } else if (a == ewmh->_NET_WM_WINDOW_TYPE_DOCK || a == ewmh->_NET_WM_WINDOW_TYPE_DESKTOP || a == ewmh->_NET_WM_WINDOW_TYPE_NOTIFICATION) {
+                *manage = false;
+                if (a == ewmh->_NET_WM_WINDOW_TYPE_DESKTOP)
+                    window_lower(win);
+            }
+        }
+        xcb_ewmh_get_atoms_reply_wipe(&win_type);
+    }
+
+    xcb_size_hints_t size_hints;
+
+    if (xcb_icccm_get_wm_normal_hints_reply(dpy, xcb_icccm_get_wm_normal_hints(dpy, win), &size_hints, NULL) == 1) {
+        if (size_hints.min_width > 0 && size_hints.min_height > 0
+                && size_hints.min_width == size_hints.max_width
+                && size_hints.min_height == size_hints.max_height)
+            *floating = true;
+    }
+
+    xcb_ewmh_get_atoms_reply_t win_state;
+
+    if (xcb_ewmh_get_wm_state_reply(ewmh, xcb_ewmh_get_wm_state(ewmh, win), &win_state, NULL) == 1) {
+        for (unsigned int i = 0; i < win_state.atoms_len; i++) {
+            xcb_atom_t a = win_state.atoms[i];
+            if (a == ewmh->_NET_WM_STATE_FULLSCREEN) {
+                *fullscreen = true;
+            }
+        }
+        xcb_ewmh_get_atoms_reply_wipe(&win_state);
+    }
+
+    xcb_window_t transient_for = XCB_NONE;
+    xcb_icccm_get_wm_transient_for_reply(dpy, xcb_icccm_get_wm_transient_for(dpy, win), &transient_for, NULL);
+    *transient = (transient_for == XCB_NONE ? false : true);
+    if (*transient)
+        *floating = true;
+
+    rule_t *rule = rule_head;
+
+    while (rule != NULL) {
+        if (is_match(rule, win)) {
+            rule_effect_t efc = rule->effect;
+            if (efc.floating)
+                *floating = true;
+            if (efc.fullscreen)
+                *fullscreen = true;
+            if (efc.locked)
+                *locked = true;
+            if (efc.follow)
+                *follow = true;
+            if (efc.focus)
+                *takes_focus = true;
+            if (efc.unmanage)
+                *manage = false;
+            if (efc.desc[0] != '\0') {
+                coordinates_t ref = {*m, *d, NULL};
+                coordinates_t loc;
+                if (desktop_from_desc(efc.desc, &ref, &loc)) {
+                    *m = loc.monitor;
+                    *d = loc.desktop;
+                }
+            }
+        }
+        rule_t *next = rule->next;
+        if (rule->one_shot)
+            remove_rule(rule);
+        rule = next;
+    }
+}
+
+void list_rules(char *pattern, char *rsp)
+{
+    char line[MAXLEN];
+
+    for (rule_t *r = rule_head; r != NULL; r = r->next) {
+        if (pattern != NULL && !streq(pattern, r->cause.name))
+            continue;
+        snprintf(line, sizeof(line), "%2X %s", r->uid, r->cause.name);
+        strncat(rsp, line, REMLEN(rsp));
+        if (r->effect.floating)
+            strncat(rsp, " --floating", REMLEN(rsp));
+        if (r->effect.fullscreen)
+            strncat(rsp, " --fullscreen", REMLEN(rsp));
+        if (r->effect.locked)
+            strncat(rsp, " --locked", REMLEN(rsp));
+        if (r->effect.follow)
+            strncat(rsp, " --follow", REMLEN(rsp));
+        if (r->effect.focus)
+            strncat(rsp, " --focus", REMLEN(rsp));
+        if (r->effect.unmanage)
+            strncat(rsp, " --unmanage", REMLEN(rsp));
+        if (r->one_shot)
+            strncat(rsp, " --one-shot", REMLEN(rsp));
+        if (r->effect.desc[0] != '\0') {
+            snprintf(line, sizeof(line), " -d %s", r->effect.desc);
+            strncat(rsp, line, REMLEN(rsp));
+        }
+        strncat(rsp, "\n", REMLEN(rsp));
+    }
+}
diff --git a/rule.h b/rule.h
new file mode 100644 (file)
index 0000000..dd49c8e
--- /dev/null
+++ b/rule.h
@@ -0,0 +1,16 @@
+#ifndef _RULE_H
+#define _RULE_H
+
+#define MATCH_ALL  "*"
+
+rule_t *make_rule(void);
+void add_rule(rule_t *);
+void remove_rule(rule_t *);
+void remove_rule_by_uid(unsigned int);
+void prune_rules(desktop_t *);
+rule_t *find_rule(unsigned int);
+bool is_match(rule_t *, xcb_window_t);
+void handle_rules(xcb_window_t, monitor_t **, desktop_t **, bool *, bool *, bool *, bool *, bool *, bool *, bool *);
+void list_rules(char *, char *);
+
+#endif
diff --git a/rules.c b/rules.c
deleted file mode 100644 (file)
index 5fb776b..0000000
--- a/rules.c
+++ /dev/null
@@ -1,193 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <xcb/xcb_icccm.h>
-#include <xcb/xcb_ewmh.h>
-#include "window.h"
-#include "types.h"
-#include "bspwm.h"
-#include "ewmh.h"
-#include "rules.h"
-#include "query.h"
-
-rule_t *make_rule(void)
-{
-    rule_t *r = malloc(sizeof(rule_t));
-    r->uid = ++rule_uid;
-    r->effect.floating = false;
-    r->effect.follow = false;
-    r->effect.focus = false;
-    r->effect.unmanage = false;
-    r->one_shot = false;
-    r->effect.desc[0] = '\0';
-    r->prev = NULL;
-    r->next = NULL;
-    return r;
-}
-
-void add_rule(rule_t *r)
-{
-    if (rule_head == NULL) {
-        rule_head = rule_tail = r;
-    } else {
-        rule_tail->next = r;
-        r->prev = rule_tail;
-        rule_tail = r;
-    }
-}
-
-void remove_rule(rule_t *r)
-{
-    if (r == NULL)
-        return;
-    rule_t *prev = r->prev;
-    rule_t *next = r->next;
-    if (prev != NULL)
-        prev->next = next;
-    if (next != NULL)
-        next->prev = prev;
-    if (r == rule_head)
-        rule_head = next;
-    if (r == rule_tail)
-        rule_tail = prev;
-    free(r);
-}
-
-void remove_rule_by_uid(unsigned int uid)
-{
-    remove_rule(find_rule(uid));
-}
-
-rule_t *find_rule(unsigned int uid)
-{
-    for (rule_t *r = rule_head; r != NULL; r = r->next)
-        if (r->uid == uid)
-            return r;
-    return NULL;
-}
-
-bool is_match(rule_t *r, xcb_window_t win)
-{
-    xcb_icccm_get_wm_class_reply_t reply;
-    int8_t success = 0;
-    if (streq(r->cause.name, MATCH_ALL) ||
-            ((success = xcb_icccm_get_wm_class_reply(dpy, xcb_icccm_get_wm_class(dpy, win), &reply, NULL)) == 1
-            && (streq(reply.class_name, r->cause.name)
-                || streq(reply.instance_name, r->cause.name)))) {
-        if (success == 1)
-            xcb_icccm_get_wm_class_reply_wipe(&reply);
-        return true;
-    }
-    return false;
-}
-
-void handle_rules(xcb_window_t win, monitor_t **m, desktop_t **d, bool *floating, bool *fullscreen, bool *locked, bool *follow, bool *transient, bool *takes_focus, bool *manage)
-{
-    xcb_ewmh_get_atoms_reply_t win_type;
-
-    if (xcb_ewmh_get_wm_window_type_reply(ewmh, xcb_ewmh_get_wm_window_type(ewmh, win), &win_type, NULL) == 1) {
-        for (unsigned int i = 0; i < win_type.atoms_len; i++) {
-            xcb_atom_t a = win_type.atoms[i];
-            if (a == ewmh->_NET_WM_WINDOW_TYPE_TOOLBAR
-                    || a == ewmh->_NET_WM_WINDOW_TYPE_UTILITY) {
-                *takes_focus = false;
-            } else if (a == ewmh->_NET_WM_WINDOW_TYPE_DIALOG) {
-                *floating = true;
-            } else if (a == ewmh->_NET_WM_WINDOW_TYPE_DOCK || a == ewmh->_NET_WM_WINDOW_TYPE_DESKTOP || a == ewmh->_NET_WM_WINDOW_TYPE_NOTIFICATION) {
-                *manage = false;
-                if (a == ewmh->_NET_WM_WINDOW_TYPE_DESKTOP)
-                    window_lower(win);
-            }
-        }
-        xcb_ewmh_get_atoms_reply_wipe(&win_type);
-    }
-
-    xcb_size_hints_t size_hints;
-
-    if (xcb_icccm_get_wm_normal_hints_reply(dpy, xcb_icccm_get_wm_normal_hints(dpy, win), &size_hints, NULL) == 1) {
-        if (size_hints.min_width > 0 && size_hints.min_height > 0
-                && size_hints.min_width == size_hints.max_width
-                && size_hints.min_height == size_hints.max_height)
-            *floating = true;
-    }
-
-    xcb_ewmh_get_atoms_reply_t win_state;
-
-    if (xcb_ewmh_get_wm_state_reply(ewmh, xcb_ewmh_get_wm_state(ewmh, win), &win_state, NULL) == 1) {
-        for (unsigned int i = 0; i < win_state.atoms_len; i++) {
-            xcb_atom_t a = win_state.atoms[i];
-            if (a == ewmh->_NET_WM_STATE_FULLSCREEN) {
-                *fullscreen = true;
-            }
-        }
-        xcb_ewmh_get_atoms_reply_wipe(&win_state);
-    }
-
-    xcb_window_t transient_for = XCB_NONE;
-    xcb_icccm_get_wm_transient_for_reply(dpy, xcb_icccm_get_wm_transient_for(dpy, win), &transient_for, NULL);
-    *transient = (transient_for == XCB_NONE ? false : true);
-    if (*transient)
-        *floating = true;
-
-    rule_t *rule = rule_head;
-
-    while (rule != NULL) {
-        if (is_match(rule, win)) {
-            rule_effect_t efc = rule->effect;
-            if (efc.floating)
-                *floating = true;
-            if (efc.fullscreen)
-                *fullscreen = true;
-            if (efc.locked)
-                *locked = true;
-            if (efc.follow)
-                *follow = true;
-            if (efc.focus)
-                *takes_focus = true;
-            if (efc.unmanage)
-                *manage = false;
-            if (efc.desc[0] != '\0') {
-                coordinates_t ref = {*m, *d, NULL};
-                coordinates_t loc;
-                if (desktop_from_desc(efc.desc, &ref, &loc)) {
-                    *m = loc.monitor;
-                    *d = loc.desktop;
-                }
-            }
-        }
-        rule_t *next = rule->next;
-        if (rule->one_shot)
-            remove_rule(rule);
-        rule = next;
-    }
-}
-
-void list_rules(char *pattern, char *rsp)
-{
-    char line[MAXLEN];
-
-    for (rule_t *r = rule_head; r != NULL; r = r->next) {
-        if (pattern != NULL && !streq(pattern, r->cause.name))
-            continue;
-        snprintf(line, sizeof(line), "%2X %s", r->uid, r->cause.name);
-        strncat(rsp, line, REMLEN(rsp));
-        if (r->effect.floating)
-            strncat(rsp, " --floating", REMLEN(rsp));
-        if (r->effect.fullscreen)
-            strncat(rsp, " --fullscreen", REMLEN(rsp));
-        if (r->effect.locked)
-            strncat(rsp, " --locked", REMLEN(rsp));
-        if (r->effect.follow)
-            strncat(rsp, " --follow", REMLEN(rsp));
-        if (r->effect.focus)
-            strncat(rsp, " --focus", REMLEN(rsp));
-        if (r->effect.unmanage)
-            strncat(rsp, " --unmanage", REMLEN(rsp));
-        if (r->one_shot)
-            strncat(rsp, " --one-shot", REMLEN(rsp));
-        if (r->effect.desc[0] != '\0') {
-            snprintf(line, sizeof(line), " -d %s", r->effect.desc);
-            strncat(rsp, line, REMLEN(rsp));
-        }
-        strncat(rsp, "\n", REMLEN(rsp));
-    }
-}
diff --git a/rules.h b/rules.h
deleted file mode 100644 (file)
index 286c125..0000000
--- a/rules.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef _RULES_H
-#define _RULES_H
-
-#define MATCH_ALL  "*"
-
-rule_t *make_rule(void);
-void add_rule(rule_t *);
-void remove_rule(rule_t *);
-void remove_rule_by_uid(unsigned int);
-void prune_rules(desktop_t *);
-rule_t *find_rule(unsigned int);
-bool is_match(rule_t *, xcb_window_t);
-void handle_rules(xcb_window_t, monitor_t **, desktop_t **, bool *, bool *, bool *, bool *, bool *, bool *, bool *);
-void list_rules(char *, char *);
-
-#endif
index 3f16a4e1b6b2db50f51b1b3b6c8a499f0b4e08bf..35f0ffc8105a109b26ee7924a6768c76b4f8b33a 100644 (file)
@@ -1,13 +1,8 @@
-#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 #include <sys/wait.h>
-#include <xcb/xcb.h>
-#include <xcb/xcb_event.h>
 #include "bspwm.h"
-#include "helpers.h"
-#include "common.h"
 #include "settings.h"
 
 void run_config(void)
diff --git a/tree.c b/tree.c
index 22d5cfb5264d4928f8c6bdd28036f561207be051..a24c9890d67538fb739eb5c0102b6d06022e9650 100644 (file)
--- a/tree.c
+++ b/tree.c
@@ -3,15 +3,13 @@
 #include <limits.h>
 #include <float.h>
 #include "settings.h"
-#include "helpers.h"
 #include "window.h"
-#include "types.h"
-#include "desktop.h"
-#include "history.h"
-#include "query.h"
 #include "bspwm.h"
 #include "ewmh.h"
 #include "tree.h"
+#include "desktop.h"
+#include "history.h"
+#include "query.h"
 
 node_t *make_node(void)
 {
index 61055d4eb111b709f4d23c29508c7466338292de..71a85f120bcc7f178ba6fe0ccd99b512cd00c649 100644 (file)
--- a/window.c
+++ b/window.c
@@ -1,17 +1,12 @@
-#include <stdio.h>
 #include <stdlib.h>
-#include <stdarg.h>
 #include <string.h>
-#include <xcb/xcb.h>
-#include <xcb/xcb_event.h>
-#include <xcb/xcb_icccm.h>
 #include "types.h"
 #include "tree.h"
 #include "bspwm.h"
 #include "settings.h"
 #include "ewmh.h"
-#include "rules.h"
 #include "query.h"
+#include "rule.h"
 #include "window.h"
 
 pointer_state_t *make_pointer_state(void)