The email somehow got lost. Resending:
Hi,
Here is a patch that fixes negative float option values. Previously
because of a small calculation error, when negative values were
allowed for a float option (say with precision 5), when the user
entered -21, the value would change to -15, then -10, then -5, then 0,
instead of just changing to -20 and staying there. This patch fixes
that.
Regards,
Erkin
diff --git a/src/option.c b/src/option.c
index b9ef8e8..ac12b68 100644
--- a/src/option.c
+++ b/src/option.c
@@ -121,9 +121,10 @@ compSetFloatOption (CompOption *opti
CompOptionValue *value)
{
float v, p;
+ int sign = (value->f < 0 ? -1 : 1);
p = 1.0f / option->rest.f.precision;
- v = ((int) (value->f * p + 0.5f)) / p;
+ v = ((int) (value->f * p + sign * 0.5f)) / p;
if (v < option->rest.f.min ||
v > option->rest.f.max ||
_______________________________________________
compiz mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/compiz