Apply selectivefakefullscreen patch

This commit is contained in:
Pijus Kamandulis 2021-03-28 14:02:08 +03:00
parent 54db675f10
commit db085c674b
3 changed files with 23 additions and 13 deletions

View File

@ -31,9 +31,9 @@ static const Rule rules[] = {
* WM_CLASS(STRING) = instance, class * WM_CLASS(STRING) = instance, class
* WM_NAME(STRING) = title * WM_NAME(STRING) = title
*/ */
/* class instance title tags mask isfloating monitor */ /* class instance title tags mask isfloating isfakefullscreen monitor */
{ "Gimp", NULL, NULL, 0, 1, -1 }, { "Gimp", NULL, NULL, 0, 1, 0, -1 },
{ "Firefox", NULL, NULL, 1 << 8, 0, -1 }, { "Firefox", NULL, NULL, 1 << 8, 0, 0, -1 },
}; };
/* layout(s) */ /* layout(s) */

View File

@ -31,9 +31,9 @@ static const Rule rules[] = {
* WM_CLASS(STRING) = instance, class * WM_CLASS(STRING) = instance, class
* WM_NAME(STRING) = title * WM_NAME(STRING) = title
*/ */
/* class instance title tags mask isfloating monitor */ /* class instance title tags mask isfloating isfakefullscreen monitor */
{ "Gimp", NULL, NULL, 0, 1, -1 }, { "Gimp", NULL, NULL, 0, 1, 0, -1 },
{ "Firefox", NULL, NULL, 1 << 8, 0, -1 }, { "Firefox", NULL, NULL, 1 << 8, 0, 0, -1 },
}; };
/* layout(s) */ /* layout(s) */

24
dwm.c
View File

@ -110,7 +110,7 @@ struct Client {
int basew, baseh, incw, inch, maxw, maxh, minw, minh; int basew, baseh, incw, inch, maxw, maxh, minw, minh;
int bw, oldbw; int bw, oldbw;
unsigned int tags; unsigned int tags;
int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, isfakefullscreen;
Client *next; Client *next;
Client *snext; Client *snext;
Monitor *mon; Monitor *mon;
@ -156,6 +156,7 @@ typedef struct {
const char *title; const char *title;
unsigned int tags; unsigned int tags;
int isfloating; int isfloating;
int isfakefullscreen;
int monitor; int monitor;
} Rule; } Rule;
@ -335,6 +336,7 @@ applyrules(Client *c)
&& (!r->instance || strstr(instance, r->instance))) && (!r->instance || strstr(instance, r->instance)))
{ {
c->isfloating = r->isfloating; c->isfloating = r->isfloating;
c->isfakefullscreen = r->isfakefullscreen;
c->tags |= r->tags; c->tags |= r->tags;
for (m = mons; m && m->num != r->monitor; m = m->next); for (m = mons; m && m->num != r->monitor; m = m->next);
if (m) if (m)
@ -611,7 +613,10 @@ clientmessage(XEvent *e)
if (cme->data.l[1] == netatom[NetWMFullscreen] if (cme->data.l[1] == netatom[NetWMFullscreen]
|| cme->data.l[2] == netatom[NetWMFullscreen]) || cme->data.l[2] == netatom[NetWMFullscreen])
setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */ setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */
|| (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen))); // || (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen)));
|| (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */
&& (!c->isfullscreen || c->isfakefullscreen))));
} else if (cme->message_type == netatom[NetActiveWindow]) { } else if (cme->message_type == netatom[NetActiveWindow]) {
if (c != selmon->sel && !c->isurgent) if (c != selmon->sel && !c->isurgent)
seturgent(c, 1); seturgent(c, 1);
@ -655,7 +660,7 @@ configurenotify(XEvent *e)
updatebars(); updatebars();
for (m = mons; m; m = m->next) { for (m = mons; m; m = m->next) {
for (c = m->clients; c; c = c->next) for (c = m->clients; c; c = c->next)
if (c->isfullscreen) if (c->isfullscreen && !c->isfakefullscreen)
resizeclient(c, m->mx, m->my, m->mw, m->mh); resizeclient(c, m->mx, m->my, m->mw, m->mh);
resizebarwin(m); resizebarwin(m);
} }
@ -1268,7 +1273,7 @@ movemouse(const Arg *arg)
if (!(c = selmon->sel)) if (!(c = selmon->sel))
return; return;
if (c->isfullscreen) /* no support moving fullscreen windows by mouse */ if (c->isfullscreen && !c->isfakefullscreen) /* no support moving fullscreen windows by mouse */
return; return;
restack(selmon); restack(selmon);
ocx = c->x; ocx = c->x;
@ -1479,7 +1484,7 @@ resizemouse(const Arg *arg)
if (!(c = selmon->sel)) if (!(c = selmon->sel))
return; return;
if (c->isfullscreen) /* no support resizing fullscreen windows by mouse */ if (c->isfullscreen && !c->isfakefullscreen) /* no support resizing fullscreen windows by mouse */
return; return;
restack(selmon); restack(selmon);
ocx = c->x; ocx = c->x;
@ -1686,6 +1691,8 @@ setfullscreen(Client *c, int fullscreen)
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 = 1; c->isfullscreen = 1;
if (c->isfakefullscreen)
return;
c->oldstate = c->isfloating; c->oldstate = c->isfloating;
c->oldbw = c->bw; c->oldbw = c->bw;
c->bw = 0; c->bw = 0;
@ -1696,6 +1703,8 @@ setfullscreen(Client *c, int fullscreen)
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 = 0; c->isfullscreen = 0;
if (c->isfakefullscreen)
return;
c->isfloating = c->oldstate; c->isfloating = c->oldstate;
c->bw = c->oldbw; c->bw = c->oldbw;
c->x = c->oldx; c->x = c->oldx;
@ -1837,7 +1846,8 @@ showhide(Client *c)
if (ISVISIBLE(c)) { if (ISVISIBLE(c)) {
/* show clients top down */ /* show clients top down */
XMoveWindow(dpy, c->win, c->x, c->y); XMoveWindow(dpy, c->win, c->x, c->y);
if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen) if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating)
&& (!c->isfullscreen || c->isfakefullscreen))
resize(c, c->x, c->y, c->w, c->h, 0); resize(c, c->x, c->y, c->w, c->h, 0);
showhide(c->snext); showhide(c->snext);
} else { } else {
@ -1942,7 +1952,7 @@ togglefloating(const Arg *arg)
{ {
if (!selmon->sel) if (!selmon->sel)
return; return;
if (selmon->sel->isfullscreen) /* no support for fullscreen windows */ if (selmon->sel->isfullscreen && !selmon->sel->isfakefullscreen) /* no support for fullscreen windows */
return; return;
selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed; selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
if (selmon->sel->isfloating) if (selmon->sel->isfloating)