ref: d4e734b0d7a580854304b01a922dbb06da7a6a20
parent: e65baf9637f210075f3a61b2abd516e4418d7b02
author: Sigrid Haflínudóttir <[email protected]>
date: Wed Feb 26 18:55:47 EST 2020
cfg: used wrong checkbox state pointer
--- a/cfg/cfg.c
+++ b/cfg/cfg.c
@@ -19,6 +19,7 @@
const char *label;
int index;
+ int ivalue;
double value;
double init;
double min;
@@ -181,7 +182,7 @@
UI *c, *slider;
double v;
mu_Id id;
- int i, state, n, widths[32], maxwidth, x, dt;
+ int i, n, widths[32], maxwidth, x, dt;
char tmp[256];
dt = stringwidth(mu_style.font, ": ");
@@ -216,9 +217,8 @@
}
break;
case UICheckBox:
- state = !!c->value;
- if ((mu_checkbox(&state, c->label) & MU_RES_CHANGE) != 0 && write(c->ctl, state ? "1" : "0", 1) > 0)
- c->value = state;
+ if (mu_checkbox(&c->ivalue, c->label) & MU_RES_CHANGE && write(c->ctl, c->ivalue ? "1" : "0", 1) < 0)
+ c->value = c->ivalue;
break;
case UIVSlider: /* FIXME no vslider in µui yet */
case UIHSlider: