URI: 
       tFix crash reported by Andrey. - plan9port - [fork] Plan 9 from user space
  HTML git clone git://src.adamsgaard.dk/plan9port
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit d52fb463eeda2168b7b0135d758a1e2a57be9af7
   DIR parent b5b71ffbaee0a7a34b93f22541effe76a54c39b5
  HTML Author: rsc <devnull@localhost>
       Date:   Thu, 11 Aug 2005 03:38:16 +0000
       
       Fix crash reported by Andrey.
       
       Make focus-follows-mouse easier to find for
       tthose who want it (cough, Ron Minnich, cough).
       
       Diffstat:
         M src/cmd/rio/dat.h                   |       1 +
         M src/cmd/rio/event.c                 |      10 +++++++++-
         M src/cmd/rio/main.c                  |       9 +++++++--
         M src/cmd/rio/menu.c                  |      13 ++++++++-----
       
       4 files changed, 25 insertions(+), 8 deletions(-)
       ---
   DIR diff --git a/src/cmd/rio/dat.h b/src/cmd/rio/dat.h
       t@@ -150,6 +150,7 @@ extern int                        debug;
        extern int                        solidsweep;
        extern int                        numvirtuals;
        extern int                        scrolling;
       +extern int                        ffm;        /* focus follows mouse */
        
        extern Atom                exit_rio;
        extern Atom                restart_rio;
   DIR diff --git a/src/cmd/rio/event.c b/src/cmd/rio/event.c
       t@@ -282,6 +282,7 @@ newwindow(XCreateWindowEvent *e)
        void
        destroy(Window w)
        {
       +        int i;
                Client *c;
        
                curtime = CurrentTime;
       t@@ -289,6 +290,11 @@ destroy(Window w)
                if(c == 0)
                        return;
        
       +        if(numvirtuals > 1)
       +                for(i=0; i<numvirtuals; i++)
       +                        if(currents[i] == c)
       +                                currents[i] = 0;
       +
                rmclient(c);
        
                /* flush any errors generated by the window's sudden demise */
       t@@ -470,12 +476,14 @@ enter(XCrossingEvent *e)
                Client *c;
        
                curtime = e->time;
       +        if(!ffm)
                if(e->mode != NotifyGrab || e->detail != NotifyNonlinearVirtual)
                        return;
                c = getclient(e->window, 0);
                if(c != 0 && c != current){
                        /* someone grabbed the pointer; make them current */
       -                XMapRaised(dpy, c->parent);
       +                if(!ffm)
       +                        XMapRaised(dpy, c->parent);
                        top(c);
                        active(c);
                }
   DIR diff --git a/src/cmd/rio/main.c b/src/cmd/rio/main.c
       t@@ -40,6 +40,7 @@ int                         scrolling;
        int                         num_screens;
        int                        solidsweep = 0;
        int                        numvirtuals = 0;
       +int                        ffm = 0;
        
        Atom                exit_rio;
        Atom                restart_rio;
       t@@ -95,6 +96,10 @@ main(int argc, char *argv[])
                                background = 1;
                        else if(strcmp(argv[i], "-debug") == 0)
                                debug++;
       +        /*
       +                else if(strcmp(argv[i], "-ffm") == 0)
       +                        ffm++;
       +        */
                        else if(strcmp(argv[i], "-font") == 0 && i+1<argc){
                                i++;
                                fname = argv[i];
       t@@ -335,8 +340,8 @@ initscreen(ScreenInfo *s, int i, int background)
                attr.cursor = s->arrow;
                attr.event_mask = SubstructureRedirectMask
                        | SubstructureNotifyMask | ColormapChangeMask
       -                | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask |
       -                KeyPressMask;
       +                | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask 
       +                | KeyPressMask | EnterWindowMask;
                mask = CWCursor|CWEventMask;
                XChangeWindowAttributes(dpy, s->root, mask, &attr);
                XSync(dpy, False);
   DIR diff --git a/src/cmd/rio/menu.c b/src/cmd/rio/menu.c
       t@@ -319,7 +319,7 @@ unhide(int n, int map)
                }
        
                numhidden--;
       -        for(i = n; i < numhidden; i ++){
       +        for(i = n; i < numhidden; i++){
                        hiddenc[i] = hiddenc[i+1];
                        b3items[B3FIXED+i] = b3items[B3FIXED+i+1];
                }
       t@@ -368,8 +368,11 @@ button2(int n)
        void
        switch_to_c(int n, Client *c)
        {
       -        if(c && c->next)
       -                switch_to_c(n,c->next);
       +        if(c == 0)
       +                return;
       +
       +        if(c->next)
       +                switch_to_c(n, c->next);
        
                if(c->parent == DefaultRootWindow(dpy))
                        return;
       t@@ -384,8 +387,8 @@ switch_to_c(int n, Client *c)
                        int i;
        
                        for(i = 0; i < numhidden; i++)
       -                if(c == hiddenc[i]) 
       -                        break;
       +                        if(c == hiddenc[i]) 
       +                                break;
        
                        if(i == numhidden){
                                XMapWindow(dpy, c->window);