tfixing segment fault while resizing. - svkbd - Simple X11 onscreen keyboard.
 (HTM) git clone git://r-36.net/svkbd
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit fb55e57fc1cf493e4bda81cf4baaada4e99f10e3
 (DIR) parent 3619838eb7809043fae15ed0564fee9b6f237832
 (HTM) Author: Enno Boland (Gottox) <tox@s01.de>
       Date:   Mon,  4 Apr 2011 13:47:27 +0200
       
       fixing segment fault while resizing.
       Diffstat:
         Makefile                            |       6 +++---
         svkbd.c                             |      10 +++++-----
       
       2 files changed, 8 insertions(+), 8 deletions(-)
       ---
 (DIR) diff --git a/Makefile b/Makefile
       t@@ -6,7 +6,7 @@ include config.mk
        SRC = svkbd.c
        LAYOUTS = en de arrows
        
       -all: options svkbd.en
       +all: options svkbd-en
        
        options:
                @echo svkbd build options:
       t@@ -19,7 +19,7 @@ config.h: config.mk
                @echo creating $@ from config.def.h
                @cp config.def.h $@
        
       -svkbd.%: layout.%.h config.h ${SRC}
       +svkbd-%: layout.%.h config.h ${SRC}
                @echo creating layout.h from $<
                @cp $< layout.h
                @echo CC -o $@
       t@@ -29,7 +29,7 @@ clean:
                @echo cleaning
                @for i in ${LAYOUTS}; \
                do \
       -                rm -f svkbd.$$i 2> /dev/null; \
       +                rm -f svkbd-$$i 2> /dev/null; \
                done; true
                @rm -f ${OBJ} svkbd-${VERSION}.tar.gz 2> /dev/null; true
        
 (DIR) diff --git a/svkbd.c b/svkbd.c
       t@@ -91,7 +91,7 @@ static DC dc;
        static Window root, win;
        static Bool running = True;
        static KeySym pressedmod = 0;
       -static int rows, ww = 0, wh = 0, wx = 0, wy = 0;
       +static int rows = 0, ww = 0, wh = 0, wx = 0, wy = 0;
        static char *name = "svkbd";
        static char *wintype = "_NET_WM_WINDOW_TYPE_TOOLBAR";
        /* configuration, allows nested code to access above variables */
       t@@ -445,17 +445,17 @@ updatekeys() {
                int x = 0, y = 0, h, base;
        
                h = wh / rows;
       -        for(i = 0; i < LENGTH(keys); i++, rows--) {
       +        for(i = 0; i < LENGTH(keys); i++) {
                        for(j = i, base = 0; j < LENGTH(keys) && keys[j].keysym != 0; j++)
                                base += keys[j].width;
                        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 / base;
       -                        if(rows != 1)
       -                                keys[i].h = h;
       -                        else
       +                        if(rows == i + 1)
                                        keys[i].h = wh - y;
       +                        else
       +                                keys[i].h = h;
                                x += keys[i].w;
                        }
                        if(base != 0)