tFixing the not properly drawn rectangles. - svkbd - Simple X11 onscreen keyboard.
git clone git://r-36.net/svkbd
Log
Files
Refs
LICENSE
---
commit 76a8bc5c3c1b70f818b4cbbbe09ce7fbb3af74e1
parent 505741702f44e8f4f6bc0779ff979869b95b983a
Author: Christoph Lohmann <20h@r-36.net>
Date:   Thu, 24 Mar 2011 19:10:37 +0100

Fixing the not properly drawn rectangles.
Diffstat:
  svkbd.c                             |       8 +++++---

1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/svkbd.c b/svkbd.c
t@@ -177,6 +177,8 @@ drawkey(Key *k) {
         XSetForeground(dpy, dc.gc, col[ColBG]);
         XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
         XSetForeground(dpy, dc.gc, dc.norm[ColFG]);
+        r.height -= 1;
+        r.width -= 1;
         XDrawRectangles(dpy, dc.drawable, dc.gc, &r, 1);
         XSetForeground(dpy, dc.gc, col[ColFG]);
         if(k->label)
t@@ -410,15 +412,15 @@ updatekeys() {
                 for(x = 0; i < LENGTH(keys) && keys[i].keysym != 0; i++) {
                         keys[i].x = x;
                         keys[i].y = y;
-                        keys[i].w = keys[i].width * (ww - 1) / base;
+                        keys[i].w = keys[i].width * ww / base;
                         if(rows != 1)
                                 keys[i].h = h;
                         else
-                                keys[i].h = (wh - 1) - y;
+                                keys[i].h = wh - y;
                         x += keys[i].w;
                 }
                 if(base != 0)
-                        keys[i - 1].w = (ww - 1) - keys[i - 1].x;
+                        keys[i - 1].w = ww - keys[i - 1].x;
                 y += h;
         }
 }