From 127ed29fb98cfde11e8726040c9b461606c245f3 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Wed, 25 Aug 2010 19:26:15 +0200 Subject: [PATCH] Make stippled_borders a lua setting --- src/conky.cc | 19 ++++--------------- src/conky.h | 2 +- src/specials.cc | 2 +- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/conky.cc b/src/conky.cc index 19d8b5ba..b088ed43 100644 --- a/src/conky.cc +++ b/src/conky.cc @@ -430,12 +430,9 @@ static conky::simple_config_setting gap_y("gap_y", 60, true); /* border */ static conky::simple_config_setting draw_borders("draw_borders", false, false); static conky::simple_config_setting draw_graph_borders("draw_graph_borders", true, false); -static int stippled_borders; -int get_stippled_borders(void) -{ - return stippled_borders; -} +conky::range_config_setting stippled_borders("stippled_borders", 0, + std::numeric_limits::max(), 0, true); static conky::simple_config_setting draw_shades("draw_shades", true, false); static conky::simple_config_setting draw_outline("draw_outline", false, false); @@ -1865,8 +1862,8 @@ static void draw_text(void) /* draw borders */ if (draw_borders.get(*state) && bw > 0) { - if (stippled_borders) { - char ss[2] = { (char)stippled_borders, (char)stippled_borders }; + if (stippled_borders.get(*state)) { + char ss[2] = { stippled_borders.get(*state), stippled_borders.get(*state) }; XSetLineAttributes(display, window.gc, bw, LineOnOffDash, CapButt, JoinMiter); XSetDashes(display, window.gc, 0, ss, 2); @@ -2631,7 +2628,6 @@ static void set_default_configurations(void) set_first_font("6x10"); minimum_width = 5; minimum_height = 5; - stippled_borders = 0; #endif /* BUILD_X11 */ free(current_mail_spool); @@ -2917,13 +2913,6 @@ char load_config_file(const char *f) CONF_ERR; } } - CONF("stippled_borders") { - if (value) { - stippled_borders = strtol(value, 0, 0); - } else { - stippled_borders = 4; - } - } #ifdef BUILD_IMLIB2 CONF("imlib_cache_size") { if (value) { diff --git a/src/conky.h b/src/conky.h index 784cbf70..5294aa55 100644 --- a/src/conky.h +++ b/src/conky.h @@ -284,7 +284,7 @@ enum _ifup_strictness { }; extern int ifup_strictness; -int get_stippled_borders(void); +extern conky::range_config_setting stippled_borders; void set_current_text_color(long colour); long get_current_text_color(void); diff --git a/src/specials.cc b/src/specials.cc index 1a4cfaeb..b74fd573 100644 --- a/src/specials.cc +++ b/src/specials.cc @@ -446,7 +446,7 @@ void scan_stippled_hr(struct text_object *obj, const char *arg) sh = (struct stippled_hr *)malloc(sizeof(struct stippled_hr)); memset(sh, 0, sizeof(struct stippled_hr)); - sh->arg = get_stippled_borders(); + sh->arg = stippled_borders.get(*state); sh->height = 1; if (arg) {