Apply fakefullscreenclient - dwm - My fork of dwm (frankenstein's monster)
 (HTM) git clone git://git.drkhsh.at/dwm.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 45ad2e43bdf363117e16c0bce98596e3ff49f542
 (DIR) parent eb91d7c080f58a182666c45ed41845a68206ae8e
 (HTM) Author: drkhsh <me@drkhsh.at>
       Date:   Mon, 10 Jan 2022 11:31:15 +0100
       
       Apply fakefullscreenclient
       
       Enable fake fullscreen on a per client basis
       
       https://github.com/bakkeby/patches/blob/master/dwm/dwm-fakefullscreenclient-6.3.diff
       
       Diffstat:
         M config.def.h                        |       1 +
         M dwm.c                               |      61 +++++++++++++++++++++++++++----
       
       2 files changed, 55 insertions(+), 7 deletions(-)
       ---
 (DIR) diff --git a/config.def.h b/config.def.h
       @@ -142,6 +142,7 @@ static const Key keys[] = {
                { MODKEY,                       XK_f,      setlayout,      {.v = &layouts[1]} },
                { MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} },
                { MODKEY,                       XK_space,  setlayout,      {0} },
       +        { MODKEY|ShiftMask,             XK_f,      togglefakefullscreen, {0} },
                { MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
                { MODKEY,                       XK_y,      togglefullscreen, {0} },
                { MODKEY,                       XK_0,      view,           {.ui = ~0 } },
 (DIR) diff --git a/dwm.c b/dwm.c
       @@ -118,6 +118,7 @@ struct Client {
                int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
                int issteam;
                int isgame;
       +        int fakefullscreen;
                Client *next;
                Client *snext;
                Monitor *mon;
       @@ -269,6 +270,7 @@ static Monitor *systraytomon(Monitor *m);
        static void tag(const Arg *arg);
        static void tagmon(const Arg *arg);
        static void togglebar(const Arg *arg);
       +static void togglefakefullscreen(const Arg *arg);
        static void togglefloating(const Arg *arg);
        static void togglefullscreen(const Arg *arg);
        static void toggletag(const Arg *arg);
       @@ -711,7 +713,7 @@ configurenotify(XEvent *e)
                                updatebars();
                                for (m = mons; m; m = m->next) {
                                        for (c = m->clients; c; c = c->next)
       -                                        if (c->isfullscreen)
       +                                        if (c->isfullscreen && c->fakefullscreen != 1)
                                                        resizeclient(c, m->mx, m->my, m->mw, m->mh);
                                        XMoveResizeWindow(dpy, m->barwin, m->bx, m->by, m->bw, bh);
                                }
       @@ -1484,7 +1486,7 @@ movemouse(const Arg *arg)
        
                if (!(c = selmon->sel))
                        return;
       -        if (c->isfullscreen) /* no support moving fullscreen windows by mouse */
       +        if (c->isfullscreen && c->fakefullscreen != 1) /* no support moving fullscreen windows by mouse */
                        return;
                restack(selmon);
                ocx = c->x;
       @@ -1649,7 +1651,10 @@ resizeclient(Client *c, int x, int y, int w, int h)
                wc.border_width = c->bw;
                XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
                configure(c);
       -        XSync(dpy, False);
       +        if (c->fakefullscreen == 1)
       +                XSync(dpy, True);
       +        else
       +                XSync(dpy, False);
        }
        
        void
       @@ -1663,7 +1668,7 @@ resizemouse(const Arg *arg)
        
                if (!(c = selmon->sel))
                        return;
       -        if (c->isfullscreen) /* no support resizing fullscreen windows by mouse */
       +        if (c->isfullscreen && c->fakefullscreen != 1) /* no support resizing fullscreen windows by mouse */
                        return;
                restack(selmon);
                ocx = c->x;
       @@ -1883,8 +1888,10 @@ setfullscreen(Client *c, int fullscreen)
                        XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
                                PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1);
                        c->isfullscreen = 1;
       -                c->oldstate = c->isfloating;
                        c->oldbw = c->bw;
       +                if (c->fakefullscreen == 1)
       +                        return;
       +                c->oldstate = c->isfloating;
                        c->bw = 0;
                        c->isfloating = 1;
                        resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
       @@ -1893,8 +1900,12 @@ setfullscreen(Client *c, int fullscreen)
                        XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
                                PropModeReplace, (unsigned char*)0, 0);
                        c->isfullscreen = 0;
       -                c->isfloating = c->oldstate;
                        c->bw = c->oldbw;
       +                if (c->fakefullscreen == 1)
       +                        return;
       +                if (c->fakefullscreen == 2)
       +                        c->fakefullscreen = 1;
       +                c->isfloating = c->oldstate;
                        c->x = c->oldx;
                        c->y = c->oldy;
                        c->w = c->oldw;
       @@ -2177,11 +2188,47 @@ togglebar(const Arg *arg)
        }
        
        void
       +togglefakefullscreen(const Arg *arg)
       +{
       +        Client *c = selmon->sel;
       +        if (!c)
       +                return;
       +
       +        if (c->fakefullscreen) {
       +                if (c->isfullscreen) {
       +                        if (c->isfloating && c->fakefullscreen == 1) {
       +                                c->oldstate = c->isfloating;
       +                                c->oldx = c->x;
       +                                c->oldy = c->y;
       +                                c->oldw = c->w;
       +                                c->oldh = c->h;
       +                        }
       +                        c->fakefullscreen = 0;
       +                }
       +                else
       +                        c->isfullscreen = 0;
       +        } else {
       +                c->fakefullscreen = 1;
       +                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);
       +                }
       +                c->isfullscreen = 0;
       +        }
       +        setfullscreen(c, !c->isfullscreen);
       +}
       +
       +void
        togglefloating(const Arg *arg)
        {
                if (!selmon->sel)
                        return;
       -        if (selmon->sel->isfullscreen) /* no support for fullscreen windows */
       +        if (selmon->sel->isfullscreen && selmon->sel->fakefullscreen != 1) /* no support for fullscreen windows */
                        return;
                selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
                if (selmon->sel->isfloating)