shithub: neindaw

Download patch

ref: e63eebc7d9edd09fddd84cf1b59ecbf4ad5d980b
parent: fd272a818645bf34eb7479ecb2467f81396506a0
author: Sigrid Haflínudóttir <[email protected]>
date: Wed Jan 15 10:13:52 EST 2020

button/checkbox: stick to 0/1

--- a/uiglue.c
+++ b/uiglue.c
@@ -88,7 +88,9 @@
 	}
 
 	if (ui->zone != nil) {
-		if (ui->type != UIButton && ui->type != UICheckBox) {
+		if (ui->type == UIButton || ui->type == UICheckBox) {
+			*ui->zone = v > 0 ? 1 : 0;
+		} else {
 			if (v < ui->min) {
 				if (failoor)
 					return -1;
@@ -98,8 +100,8 @@
 					return -1;
 				v = ui->max;
 			}
+			*ui->zone = v;
 		}
-		*ui->zone = v;
 	}
 
 	return 0;