Fix crash reported by Andrey.

Make focus-follows-mouse easier to find for
those who want it (cough, Ron Minnich, cough).
This commit is contained in:
rsc 2005-08-11 03:38:16 +00:00
parent b5b71ffbae
commit d52fb463ee
4 changed files with 25 additions and 8 deletions

View file

@ -150,6 +150,7 @@ extern int debug;
extern int solidsweep; extern int solidsweep;
extern int numvirtuals; extern int numvirtuals;
extern int scrolling; extern int scrolling;
extern int ffm; /* focus follows mouse */
extern Atom exit_rio; extern Atom exit_rio;
extern Atom restart_rio; extern Atom restart_rio;

View file

@ -282,6 +282,7 @@ newwindow(XCreateWindowEvent *e)
void void
destroy(Window w) destroy(Window w)
{ {
int i;
Client *c; Client *c;
curtime = CurrentTime; curtime = CurrentTime;
@ -289,6 +290,11 @@ destroy(Window w)
if(c == 0) if(c == 0)
return; return;
if(numvirtuals > 1)
for(i=0; i<numvirtuals; i++)
if(currents[i] == c)
currents[i] = 0;
rmclient(c); rmclient(c);
/* flush any errors generated by the window's sudden demise */ /* flush any errors generated by the window's sudden demise */
@ -470,12 +476,14 @@ enter(XCrossingEvent *e)
Client *c; Client *c;
curtime = e->time; curtime = e->time;
if(!ffm)
if(e->mode != NotifyGrab || e->detail != NotifyNonlinearVirtual) if(e->mode != NotifyGrab || e->detail != NotifyNonlinearVirtual)
return; return;
c = getclient(e->window, 0); c = getclient(e->window, 0);
if(c != 0 && c != current){ if(c != 0 && c != current){
/* someone grabbed the pointer; make them current */ /* someone grabbed the pointer; make them current */
XMapRaised(dpy, c->parent); if(!ffm)
XMapRaised(dpy, c->parent);
top(c); top(c);
active(c); active(c);
} }

View file

@ -40,6 +40,7 @@ int scrolling;
int num_screens; int num_screens;
int solidsweep = 0; int solidsweep = 0;
int numvirtuals = 0; int numvirtuals = 0;
int ffm = 0;
Atom exit_rio; Atom exit_rio;
Atom restart_rio; Atom restart_rio;
@ -95,6 +96,10 @@ main(int argc, char *argv[])
background = 1; background = 1;
else if(strcmp(argv[i], "-debug") == 0) else if(strcmp(argv[i], "-debug") == 0)
debug++; debug++;
/*
else if(strcmp(argv[i], "-ffm") == 0)
ffm++;
*/
else if(strcmp(argv[i], "-font") == 0 && i+1<argc){ else if(strcmp(argv[i], "-font") == 0 && i+1<argc){
i++; i++;
fname = argv[i]; fname = argv[i];
@ -335,8 +340,8 @@ initscreen(ScreenInfo *s, int i, int background)
attr.cursor = s->arrow; attr.cursor = s->arrow;
attr.event_mask = SubstructureRedirectMask attr.event_mask = SubstructureRedirectMask
| SubstructureNotifyMask | ColormapChangeMask | SubstructureNotifyMask | ColormapChangeMask
| ButtonPressMask | ButtonReleaseMask | PropertyChangeMask | | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask
KeyPressMask; | KeyPressMask | EnterWindowMask;
mask = CWCursor|CWEventMask; mask = CWCursor|CWEventMask;
XChangeWindowAttributes(dpy, s->root, mask, &attr); XChangeWindowAttributes(dpy, s->root, mask, &attr);
XSync(dpy, False); XSync(dpy, False);

View file

@ -319,7 +319,7 @@ unhide(int n, int map)
} }
numhidden--; numhidden--;
for(i = n; i < numhidden; i ++){ for(i = n; i < numhidden; i++){
hiddenc[i] = hiddenc[i+1]; hiddenc[i] = hiddenc[i+1];
b3items[B3FIXED+i] = b3items[B3FIXED+i+1]; b3items[B3FIXED+i] = b3items[B3FIXED+i+1];
} }
@ -368,8 +368,11 @@ button2(int n)
void void
switch_to_c(int n, Client *c) switch_to_c(int n, Client *c)
{ {
if(c && c->next) if(c == 0)
switch_to_c(n,c->next); return;
if(c->next)
switch_to_c(n, c->next);
if(c->parent == DefaultRootWindow(dpy)) if(c->parent == DefaultRootWindow(dpy))
return; return;
@ -384,8 +387,8 @@ switch_to_c(int n, Client *c)
int i; int i;
for(i = 0; i < numhidden; i++) for(i = 0; i < numhidden; i++)
if(c == hiddenc[i]) if(c == hiddenc[i])
break; break;
if(i == numhidden){ if(i == numhidden){
XMapWindow(dpy, c->window); XMapWindow(dpy, c->window);