tFixing the geometry parsing. - svkbd - Simple X11 onscreen keyboard.
git clone git://r-36.net/svkbd
Log
Files
Refs
LICENSE
---
commit 3a5d2f3ed8e539209c2e07a995532c91b20faf8f
parent cfe0f2d84ec576c3963ecdebe3e38f1006299f42
Author: Christoph Lohmann <20h@r-36.net>
Date:   Sun,  9 Oct 2011 17:59:03 +0200

Fixing the geometry parsing.
Diffstat:
  svkbd.c                             |      25 ++++++++++++++-----------

1 file changed, 14 insertions(+), 11 deletions(-)
---
diff --git a/svkbd.c b/svkbd.c
t@@ -449,24 +449,27 @@ setup(void) {
         initfont(font);
 
         /* init atoms */
-        netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
-        if(isdock)
+        if(isdock) {
+                netatom[NetWMWindowType] = XInternAtom(dpy,
+                                "_NET_WM_WINDOW_TYPE", False);
                 atype = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DOCK", False);
+        }
 
         /* init appearance */
         countrows();
         if(!ww)
-                ww = sw - wx;
+                ww = sw;
         if(ww < 0)
                 ww = sw + ww + 1;
-        if(!wx)
-                wx = 0;
-        if(wx < 0)
-                wx = sw + wx;
         if(!wh)
                 wh = sh * rows / 32;
         if(wh < 0)
                 wh = sh + wh + 1;
+
+        if(!wx)
+                wx = 0;
+        if(wx < 0)
+                wx = sw + wx - ww;
         if(!wy)
                 wy = sh - wh;
         if(wy < 0)
t@@ -592,10 +595,10 @@ main(int argc, char *argv[]) {
                                 ww = (int)wr;
                         if(bitm & HeightValue)
                                 wh = (int)hr;
-                        if(bitm & XNegative)
-                                wx *= -1;
-                        if(bitm & YNegative)
-                                wy *= -1;
+                        if(bitm & XNegative && wx == 0)
+                                wx = -1;
+                        if(bitm & YNegative && wy == 0)
+                                wy = -1;
                 } else if(!strcmp(argv[i], "-h")) {
                         usage(argv[0]);
                 }