setfullscreen: don't process the property twice

Some clients try to set _NET_WM_STATE_FULLSCREEN even when the window is
already in fullscreen.
For example, c->oldstate was set two times in a raw and window would
then always be floating.
We must check that it's not the case before processing it.
(original patch modified with suggestion from Markus Teich
<markus.teich@stusta.mhn.de>)
This commit is contained in:
Quentin Rameau 2015-11-07 14:09:08 +01:00 committed by Hiltjo Posthuma
parent 646b351cc7
commit dce4fb3737

4
dwm.c
View File

@ -1441,7 +1441,7 @@ setfocus(Client *c) {
void void
setfullscreen(Client *c, Bool fullscreen) { setfullscreen(Client *c, Bool fullscreen) {
if(fullscreen) { if(fullscreen && !c->isfullscreen) {
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32, XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1); PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1);
c->isfullscreen = True; c->isfullscreen = True;
@ -1452,7 +1452,7 @@ setfullscreen(Client *c, Bool fullscreen) {
resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh); resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
XRaiseWindow(dpy, c->win); XRaiseWindow(dpy, c->win);
} }
else { else if(!fullscreen && c->isfullscreen){
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32, XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
PropModeReplace, (unsigned char*)0, 0); PropModeReplace, (unsigned char*)0, 0);
c->isfullscreen = False; c->isfullscreen = False;