]> git.sur5r.net Git - i3/i3status/commitdiff
Use the highest order actually used, not MAX_ORDER, for checking whether to flush...
authorMichael Stapelberg <michael@stapelberg.de>
Wed, 22 Jul 2009 16:39:25 +0000 (18:39 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Wed, 22 Jul 2009 16:39:41 +0000 (18:39 +0200)
i3status.h
src/config.c

index 9edea1587780dcff11a8b56f264b5ae47048c9c4..5d42881182c8a1d7a21d639c5d2f479e2bbc15f3 100644 (file)
@@ -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;
index 99e3e075119b018f19877101d15afc146775c233..8fff8d0e1e6d16466a3242087fe1fb4e47c643e6 100644 (file)
@@ -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'))