URI: 
       small code-style changes - svkbd - simple virtual keyboard
  HTML git clone git://git.suckless.org/svkbd
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit 2a2acdacaa3655819af6ea308ffee98dbedb33f9
   DIR parent 81c96cec89dd280cab71170f50b9c088476d263c
  HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org>
       Date:   Sat,  3 Jul 2021 11:45:05 +0200
       
       small code-style changes
       
       Diffstat:
         M layout.mobile-intl.h                |      10 +++++-----
         M svkbd.c                             |      15 ++++++++-------
       
       2 files changed, 13 insertions(+), 12 deletions(-)
       ---
   DIR diff --git a/layout.mobile-intl.h b/layout.mobile-intl.h
       @@ -494,8 +494,9 @@ static Key keys_navigation[KEYS] = {
                { "↓", 0, XK_Down, 1 },
                { "Tab", 0, XK_Tab, 1 },
                { "↲ Enter", 0, XK_Return, 1},
       -  { 0 }, /* Last item (double 0) */
       -  { 0 }, /* Last item (double 0) */
       +
       +        { 0 }, /* Last item (double 0) */
       +        { 0 }, /* Last item (double 0) */
        };
        
        
       @@ -615,8 +616,7 @@ static Key* available_layers[LAYERS] = {
                keys_ru
        };
        
       -
        Buttonmod buttonmods[] = {
       -                { XK_Shift_L, Button2 },
       -                { XK_Alt_L, Button3 },
       +        { XK_Shift_L, Button2 },
       +        { XK_Alt_L, Button3 },
        };
   DIR diff --git a/svkbd.c b/svkbd.c
       @@ -74,7 +74,7 @@ static void drawkey(Key *k, Bool map);
        static void expose(XEvent *e);
        static Key *findkey(int x, int y);
        static void leavenotify(XEvent *e);
       -static void press(Key *k, KeySym mod);
       +static void press(Key *k, KeySym buttonmod);
        static double get_press_duration();
        static void run(void);
        static void setup(void);
       @@ -85,7 +85,7 @@ static void hideoverlay();
        static void cyclelayer();
        static void setlayer();
        static void togglelayer();
       -static void unpress(Key *k, KeySym mod);
       +static void unpress(Key *k, KeySym buttonmod);
        static void updatekeys();
        static void printkey(Key *k, KeySym mod);
        
       @@ -168,7 +168,8 @@ motionnotify(XEvent *e)
                }
        
                for (i = 0; i < numkeys; i++) {
       -                if (!IsModifierKey(keys[i].keysym) && keys[i].pressed == True && lostfocus != gainedfocus) {
       +                if (!IsModifierKey(keys[i].keysym) && keys[i].pressed == True &&
       +                    lostfocus != gainedfocus) {
                                printdbg("Pressed key lost focus: %ld\n", keys[i].keysym);
                                lostfocus = i;
                                ispressingkeysym = 0;
       @@ -575,7 +576,7 @@ unpress(Key *k, KeySym buttonmod)
                int i;
                Bool neutralizebuttonmod = False;
        
       -        if (k != NULL) {
       +        if (k) {
                        switch(k->keysym) {
                        case XK_Cancel:
                                cyclelayer();
       @@ -632,7 +633,7 @@ unpress(Key *k, KeySym buttonmod)
                        simulate_keyrelease(buttonmod);
                }
        
       -        if ((k == NULL) || (!IsModifierKey(k->keysym))) {
       +        if (k == NULL || !IsModifierKey(k->keysym)) {
                        for (i = 0; i < numkeys; i++) {
                                if (keys[i].pressed && IsModifierKey(keys[i].keysym)) {
                                        if (!(keys[i].keysym == buttonmod && neutralizebuttonmod))
       @@ -690,7 +691,7 @@ run(void)
                                                printdbg("%f\n", duration);
                                        overlayidx = hasoverlay(ispressingkeysym);
                                        duration = get_press_duration();
       -                                if ((overlayidx != -1) && (duration >= overlay_delay)) {
       +                                if (overlayidx != -1 && duration >= overlay_delay) {
                                                printdbg("press duration %f, activating overlay\n", duration);
                                                showoverlay(overlayidx);
                                                pressbegin.tv_sec = 0;
       @@ -1047,7 +1048,7 @@ showoverlay(int idx)
                        }
                }
        
       -        for (i = idx, j=0; i < OVERLAYS; i++, j++) {
       +        for (i = idx, j = 0; i < OVERLAYS; i++, j++) {
                        if (overlay[i].keysym == XK_Cancel) {
                                break;
                        }