summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2009-07-22 18:39:25 +0200
committerMichael Stapelberg <michael@stapelberg.de>2009-07-22 18:39:41 +0200
commit329a8994f7ad5454f83d576ad2b826585560424b (patch)
tree2145413dc3882c8c1e2431a6658a0994438a886c
parentc9ab465cbba2dc38c5564582531e1b44c8d63ce8 (diff)
Use the highest order actually used, not MAX_ORDER, for checking whether to flush (Thanks Mirko)
-rw-r--r--i3status.h4
-rw-r--r--src/config.c5
2 files changed, 6 insertions, 3 deletions
diff --git a/i3status.h b/i3status.h
index 9edea15..5d42881 100644
--- a/i3status.h
+++ b/i3status.h
@@ -11,7 +11,7 @@
#define generate(orderidx, name, function) \
do { \
- write_to_statusbar(order_to_str(order[orderidx], name), function, (j == (MAX_ORDER-1))); \
+ write_to_statusbar(order_to_str(order[orderidx], name), function, (j == (highest_order-1))); \
} while (0)
#define generate_order(condition, orderidx, name, function) \
@@ -63,6 +63,8 @@ extern struct battery_head batteries;
/* socket file descriptor for general purposes */
extern int general_socket;
+extern int highest_order;
+
extern const char *wlan_interface;
extern const char *eth_interface;
extern const char *wmii_path;
diff --git a/src/config.c b/src/config.c
index 99e3e07..8fff8d0 100644
--- a/src/config.c
+++ b/src/config.c
@@ -7,6 +7,8 @@
#include "i3status.h"
+int highest_order = 0;
+
/*
* Reads the configuration from the given file
*
@@ -111,9 +113,8 @@ int load_configuration(const char *configfile) {
}
OPT("order")
{
- #define SET_ORDER(opt, idx) { if (strcasecmp(token, opt) == 0) order[idx] = c++; }
+ #define SET_ORDER(opt, idx) { if (strcasecmp(token, opt) == 0) order[idx] = highest_order++; }
char *walk, *token;
- int c = 0;
walk = token = dest_value;
while (*walk != '\0') {
while ((*walk != ',') && (*walk != '\0'))