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 numvirtuals;
extern int scrolling;
extern int ffm; /* focus follows mouse */
extern Atom exit_rio;
extern Atom restart_rio;

View file

@ -282,6 +282,7 @@ newwindow(XCreateWindowEvent *e)
void
destroy(Window w)
{
int i;
Client *c;
curtime = CurrentTime;
@ -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 */
@ -470,11 +476,13 @@ 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 */
if(!ffm)
XMapRaised(dpy, c->parent);
top(c);
active(c);

View file

@ -40,6 +40,7 @@ int scrolling;
int num_screens;
int solidsweep = 0;
int numvirtuals = 0;
int ffm = 0;
Atom exit_rio;
Atom restart_rio;
@ -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];
@ -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);

View file

@ -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];
}
@ -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;