diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/xkbtext.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/xkbtext.c b/src/xkbtext.c index 013cdef..6741d1a 100644 --- a/src/xkbtext.c +++ b/src/xkbtext.c @@ -758,9 +758,17 @@ XkbGeomFPText(int val, unsigned format) } else { whole = val / XkbGeomPtsPerMM; - frac = val % XkbGeomPtsPerMM; - if (frac != 0) - snprintf(buf, bufsize, "%d.%d", whole, frac); + frac = abs(val % XkbGeomPtsPerMM); + if (frac != 0) { + if (val < 0) + { + int wholeabs; + wholeabs = abs(whole); + snprintf(buf, bufsize, "-%d.%d", wholeabs, frac); + } + else + snprintf(buf, bufsize, "%d.%d", whole, frac); + } else snprintf(buf, bufsize, "%d", whole); } |