[wmfs.c,.h] Fix bug/segfault (when you switched into the tags, and close a clients, you could close an hidden client, and make a segfault if you return on the hidden client tag.)
This commit is contained in:
parent
315129a9aa
commit
eb1e708346
@ -33,6 +33,7 @@ set(CMAKE_C_FLAGS ${CFLAGS})
|
||||
set(LIBRARIES_TO_LINK
|
||||
X11
|
||||
confuse)
|
||||
|
||||
target_link_libraries(wmfs ${LIBRARIES_TO_LINK})
|
||||
|
||||
# Messages
|
||||
|
||||
4
event.c
4
event.c
@ -78,7 +78,7 @@ buttonpress(XEvent ev)
|
||||
{
|
||||
for(i = 0; i < conf.ntag + 1; ++i)
|
||||
{
|
||||
if(ev.xbutton.x > taglen[i-1]
|
||||
if(ev.xbutton.x > taglen[i-1] - 3
|
||||
&& ev.xbutton.x < taglen[i])
|
||||
{
|
||||
ITOA(s, i);
|
||||
@ -99,7 +99,7 @@ buttonpress(XEvent ev)
|
||||
/* layout switch */
|
||||
if(ev.xbutton.x >= taglen[conf.ntag] - 3
|
||||
&& ev.xbutton.x < taglen[conf.ntag] +
|
||||
(strlen((getlayoutsym(layout[seltag])))*fonty+3)-3)
|
||||
(strlen((getlayoutsym(layout[seltag])))*fonty+3) - 3)
|
||||
{
|
||||
if(ev.xbutton.button == Button1
|
||||
|| ev.xbutton.button == Button4)
|
||||
|
||||
12
wmfs.c
12
wmfs.c
@ -43,7 +43,7 @@ arrange(void)
|
||||
else
|
||||
hide(c);
|
||||
|
||||
focus(selbytag[seltag]);
|
||||
focus(NULL);
|
||||
layoutfunc[seltag]();
|
||||
}
|
||||
|
||||
@ -116,7 +116,6 @@ focus(Client *c)
|
||||
grabbuttons(c, True);
|
||||
|
||||
sel = c;
|
||||
selbytag[seltag] = c;
|
||||
|
||||
if(c)
|
||||
{
|
||||
@ -128,6 +127,8 @@ focus(Client *c)
|
||||
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
|
||||
updatetitle(c);
|
||||
}
|
||||
else
|
||||
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -900,8 +901,6 @@ tag(char *cmd)
|
||||
return;
|
||||
seltag = tmp;
|
||||
}
|
||||
if(selbytag[seltag])
|
||||
focus(selbytag[seltag]);
|
||||
|
||||
arrange();
|
||||
return;
|
||||
@ -1054,9 +1053,11 @@ unhide(Client *c)
|
||||
void
|
||||
unmanage(Client *c)
|
||||
{
|
||||
if(ishide(c))
|
||||
return;
|
||||
|
||||
XSetErrorHandler(errorhandlerdummy);
|
||||
sel = (sel == c) ? c->next : NULL;
|
||||
selbytag[seltag] = (selbytag[seltag] == c) ? c->next : NULL;
|
||||
if(conf.ttbarheight)
|
||||
{
|
||||
XUnmapWindow(dpy, c->tbar);
|
||||
@ -1139,7 +1140,6 @@ updatebar(void)
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* if c is 0, you can execute this function for the first time
|
||||
* else the button is just updated */
|
||||
void
|
||||
|
||||
3
wmfs.h
3
wmfs.h
@ -265,7 +265,7 @@ Window bar;
|
||||
int screen;
|
||||
int mw, mh;
|
||||
Conf conf;
|
||||
Key keys[512];
|
||||
Key keys[1024];
|
||||
|
||||
/* Atoms / Cursors */
|
||||
Atom wm_atom[WMLast];
|
||||
@ -286,7 +286,6 @@ int taglen[MAXTAG];
|
||||
/* Important Client */
|
||||
Client *clients;
|
||||
Client *sel;
|
||||
Client *selbytag[MAXTAG];
|
||||
|
||||
/* Layout/Tile Important variables */
|
||||
float mwfact[MAXTAG];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user