improved focus handling - ttabbed - Simple tabbing application for X11.
       
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 13e3aca1cbc322308729d2e6644a420daf811c93
 (DIR) parent c6be3a7d9f36725fa968383e979d1ce00488bd8b
 (HTM) Author: Enno Boland (tox) <tox@s01.de>
       Date:   Tue, 16 Feb 2010 19:53:03 +0100
       
       improved focus handling
       Diffstat:
         config.def.h                        |       1 +
         tabbed.c                            |      11 ++++++++---
       
       2 files changed, 9 insertions(+), 3 deletions(-)
       ---
 (DIR) diff --git a/config.def.h b/config.def.h
       @@ -11,6 +11,7 @@ static const Bool foreground   = False;
        #define MODKEY ControlMask
        static Key keys[] = { \
                /* modifier                     key        function        argument */
       +        { MODKEY|ShiftMask,             XK_Return, focusonce,      { 0 } },
                { MODKEY|ShiftMask,             XK_Return, spawn,          { .v = (char*[]){ "surf", "-e", winid, NULL} } },
                { MODKEY|ShiftMask,             XK_l,      rotate,         { .i = +1 } },
                { MODKEY|ShiftMask,             XK_h,      rotate,         { .i = -1 } },
 (DIR) diff --git a/tabbed.c b/tabbed.c
       @@ -399,7 +399,6 @@ focus(Client *c) {
                XStoreName(dpy, win, c->name);
                if(sel != c) {
                        lastsel = sel;
       -                puts("set");
                }
                sel = c;
                drawbar();
       @@ -605,6 +604,8 @@ manage(Window w) {
                        XSync(dpy, False);
                        focus(nextfocus ? c : sel);
                        nextfocus = foreground;
       +                if(!lastsel)
       +                        lastsel = c;
                }
        }
        
       @@ -794,9 +795,13 @@ unmanage(Client *c) {
                        pc->next = c->next;
                }
                if(c == lastsel)
       -                lastsel = pc;
       -        focus(lastsel);
       +                lastsel = clients;
       +        if(c == sel) {
       +                sel = pc;
       +                focus(lastsel);
       +        }
                free(c);
       +        drawbar();
                XSync(dpy, False);
        }