Assortment of fullscreen improvements

This commit is contained in:
bakkeby 2020-09-05 14:20:53 +02:00
parent dc277e6c8f
commit c14f40190e
3 changed files with 33 additions and 32 deletions

10
dwm.c
View File

@ -1122,7 +1122,7 @@ clientmessage(XEvent *e)
if (cme->data.l[1] == netatom[NetWMFullscreen]
|| cme->data.l[2] == netatom[NetWMFullscreen]) {
#if !FAKEFULLSCREEN_PATCH && FAKEFULLSCREEN_CLIENT_PATCH
if (c->fakefullscreen)
if (c->fakefullscreen == 1)
resizeclient(c, c->x, c->y, c->w, c->h);
else
setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */
@ -1202,7 +1202,7 @@ configurenotify(XEvent *e)
#if !FAKEFULLSCREEN_PATCH
for (c = m->clients; c; c = c->next)
#if FAKEFULLSCREEN_CLIENT_PATCH
if (c->isfullscreen && !c->fakefullscreen)
if (c->isfullscreen && c->fakefullscreen != 1)
#else
if (c->isfullscreen)
#endif // FAKEFULLSCREEN_CLIENT_PATCH
@ -2215,7 +2215,7 @@ movemouse(const Arg *arg)
return;
#if !FAKEFULLSCREEN_PATCH
#if FAKEFULLSCREEN_CLIENT_PATCH
if (c->isfullscreen && !c->fakefullscreen) /* no support moving fullscreen windows by mouse */
if (c->isfullscreen && c->fakefullscreen != 1) /* no support moving fullscreen windows by mouse */
return;
#else
if (c->isfullscreen) /* no support moving fullscreen windows by mouse */
@ -2479,7 +2479,7 @@ resizemouse(const Arg *arg)
return;
#if !FAKEFULLSCREEN_PATCH
#if FAKEFULLSCREEN_CLIENT_PATCH
if (c->isfullscreen && !c->fakefullscreen) /* no support resizing fullscreen windows by mouse */
if (c->isfullscreen && c->fakefullscreen != 1) /* no support resizing fullscreen windows by mouse */
return;
#else
if (c->isfullscreen) /* no support resizing fullscreen windows by mouse */
@ -3343,7 +3343,7 @@ togglefloating(const Arg *arg)
return;
#if !FAKEFULLSCREEN_PATCH
#if FAKEFULLSCREEN_CLIENT_PATCH
if (c->isfullscreen && !c->fakefullscreen) /* no support for fullscreen windows */
if (c->isfullscreen && c->fakefullscreen != 1) /* no support for fullscreen windows */
return;
#else
if (c->isfullscreen) /* no support for fullscreen windows */

View File

@ -1,26 +1,27 @@
void
togglefakefullscreen(const Arg *arg)
{
if (!selmon->sel)
Client *c = selmon->sel;
if (!c)
return;
if (selmon->sel->fakefullscreen) {
if (selmon->sel->isfullscreen)
selmon->sel->fakefullscreen = 0;
if (c->fakefullscreen) {
if (c->isfullscreen)
c->fakefullscreen = 0;
else
selmon->sel->isfullscreen = 0;
c->isfullscreen = 0;
} else {
if (selmon->sel->isfullscreen) {
selmon->sel->isfloating = selmon->sel->oldstate;
selmon->sel->bw = selmon->sel->oldbw;
selmon->sel->x = selmon->sel->oldx;
selmon->sel->y = selmon->sel->oldy;
selmon->sel->w = selmon->sel->oldw;
selmon->sel->h = selmon->sel->oldh;
resizeclient(selmon->sel, selmon->sel->x, selmon->sel->y, selmon->sel->w, selmon->sel->h);
if (c->isfullscreen) {
c->isfloating = c->oldstate;
c->bw = c->oldbw;
c->x = c->oldx;
c->y = c->oldy;
c->w = c->oldw;
c->h = c->oldh;
resizeclient(c, c->x, c->y, c->w, c->h);
}
selmon->sel->fakefullscreen = 1;
selmon->sel->isfullscreen = 0;
c->fakefullscreen = 1;
c->isfullscreen = 0;
}
setfullscreen(selmon->sel, !selmon->sel->isfullscreen);
setfullscreen(c, !c->isfullscreen);
}

View File

@ -1,24 +1,24 @@
void
togglefullscreen(const Arg *arg)
{
if (!selmon->sel)
Client *c = selmon->sel;
if (!c)
return;
#if !FAKEFULLSCREEN_PATCH && FAKEFULLSCREEN_CLIENT_PATCH
if (selmon->sel->fakefullscreen == 1) {
selmon->sel->fakefullscreen = 2;
if (selmon->sel->isfullscreen) {
selmon->sel->isfullscreen = 0;
}
} else if (selmon->sel->fakefullscreen == 2) {
selmon->sel->fakefullscreen = 0;
if (c->fakefullscreen == 1) {
c->fakefullscreen = 2;
if (c->isfullscreen)
c->isfullscreen = 0;
} else if (c->fakefullscreen == 2) {
c->fakefullscreen = 0;
togglefakefullscreen(NULL);
arrange(selmon);
return;
}
#endif // FAKEFULLSCREEN_CLIENT_PATCH
setfullscreen(selmon->sel, !selmon->sel->isfullscreen);
if (!selmon->sel->isfullscreen)
arrange(selmon);
setfullscreen(c, !c->isfullscreen);
if (!c->isfullscreen)
arrange(c->mon);
}