fakefullscreen: prevent focus from drifting away from client when going from fullscreen to fake fullscreen

This commit is contained in:
bakkeby 2020-09-10 09:41:00 +02:00
parent 2e314578ed
commit c257e2e390
2 changed files with 44 additions and 23 deletions

15
dwm.c
View File

@ -2494,7 +2494,13 @@ resizeclient(Client *c, int x, int y, int w, int h)
#if MONOCLE_LAYOUT #if MONOCLE_LAYOUT
|| &monocle == c->mon->lt[c->mon->sellt]->arrange || &monocle == c->mon->lt[c->mon->sellt]->arrange
#endif // MONOCLE_LAYOUT #endif // MONOCLE_LAYOUT
) && !c->isfullscreen && !c->isfloating )
#if FAKEFULLSCREEN_CLIENT_PATCH
&& (c->fakefullscreen == 1 || !c->isfullscreen) && c->fakefullscreen
#else
&& !c->isfullscreen
#endif // FAKEFULLSCREEN_CLIENT_PATCH
&& !c->isfloating
&& c->mon->lt[c->mon->sellt]->arrange) { && c->mon->lt[c->mon->sellt]->arrange) {
c->w = wc.width += c->bw * 2; c->w = wc.width += c->bw * 2;
c->h = wc.height += c->bw * 2; c->h = wc.height += c->bw * 2;
@ -2503,7 +2509,14 @@ resizeclient(Client *c, int x, int y, int w, int h)
#endif // NOBORDER_PATCH #endif // NOBORDER_PATCH
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
configure(c); configure(c);
#if FAKEFULLSCREEN_CLIENT_PATCH
if (c->fakefullscreen == 1)
XSync(dpy, True);
else
XSync(dpy, False);
#else
XSync(dpy, False); XSync(dpy, False);
#endif // FAKEFULLSCREEN_CLIENT_PATCH
} }
void void

View File

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