fakefullscreen: do not interfere with client message, ref. #9

pull/19/head
bakkeby 4 years ago
parent 928fc2375f
commit 12b97f6124

@ -1,4 +1,4 @@
From ec36221238c668846bdb2fc4457365bcb8a8ac4d Mon Sep 17 00:00:00 2001
From f4c880ab88436d10732c4cccb75ec4c6fc48a92f Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Fri, 1 May 2020 22:24:50 +0200
Subject: [PATCH] fakefullscreenclient - enable fake fullscreen on a per client
@ -6,8 +6,8 @@ Subject: [PATCH] fakefullscreenclient - enable fake fullscreen on a per client
---
config.def.h | 1 +
dwm.c | 73 +++++++++++++++++++++++++++++++++++++++++++++-------
2 files changed, 64 insertions(+), 10 deletions(-)
dwm.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++------
2 files changed, 55 insertions(+), 7 deletions(-)
diff --git a/config.def.h b/config.def.h
index 1c0b587..dfd61f2 100644
@ -22,7 +22,7 @@ index 1c0b587..dfd61f2 100644
{ MODKEY, XK_0, view, {.ui = ~0 } },
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
diff --git a/dwm.c b/dwm.c
index 4465af1..8da5f36 100644
index 4465af1..3f3d324 100644
--- a/dwm.c
+++ b/dwm.c
@@ -93,6 +93,7 @@ struct Client {
@ -41,26 +41,7 @@ index 4465af1..8da5f36 100644
static void togglefloating(const Arg *arg);
static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg);
@@ -519,9 +521,15 @@ clientmessage(XEvent *e)
return;
if (cme->message_type == netatom[NetWMState]) {
if (cme->data.l[1] == netatom[NetWMFullscreen]
- || cme->data.l[2] == netatom[NetWMFullscreen])
- 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[2] == netatom[NetWMFullscreen]) {
+ 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 */
+ || (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */
+ && !c->isfullscreen
+ )));
+ }
} else if (cme->message_type == netatom[NetActiveWindow]) {
if (c != selmon->sel && !c->isurgent)
seturgent(c, 1);
@@ -565,7 +573,7 @@ configurenotify(XEvent *e)
@@ -565,7 +567,7 @@ configurenotify(XEvent *e)
updatebars();
for (m = mons; m; m = m->next) {
for (c = m->clients; c; c = c->next)
@ -69,7 +50,7 @@ index 4465af1..8da5f36 100644
resizeclient(c, m->mx, m->my, m->mw, m->mh);
XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh);
}
@@ -1143,7 +1151,7 @@ movemouse(const Arg *arg)
@@ -1143,7 +1145,7 @@ movemouse(const Arg *arg)
if (!(c = selmon->sel))
return;
@ -78,7 +59,7 @@ index 4465af1..8da5f36 100644
return;
restack(selmon);
ocx = c->x;
@@ -1284,7 +1292,10 @@ resizeclient(Client *c, int x, int y, int w, int h)
@@ -1284,7 +1286,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);
@ -90,7 +71,7 @@ index 4465af1..8da5f36 100644
}
void
@@ -1298,7 +1309,7 @@ resizemouse(const Arg *arg)
@@ -1298,7 +1303,7 @@ resizemouse(const Arg *arg)
if (!(c = selmon->sel))
return;
@ -99,7 +80,7 @@ index 4465af1..8da5f36 100644
return;
restack(selmon);
ocx = c->x;
@@ -1476,8 +1487,10 @@ setfullscreen(Client *c, int fullscreen)
@@ -1476,8 +1481,10 @@ setfullscreen(Client *c, int fullscreen)
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1);
c->isfullscreen = 1;
@ -111,7 +92,7 @@ index 4465af1..8da5f36 100644
c->bw = 0;
c->isfloating = 1;
resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
@@ -1486,8 +1499,12 @@ setfullscreen(Client *c, int fullscreen)
@@ -1486,8 +1493,12 @@ setfullscreen(Client *c, int fullscreen)
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
PropModeReplace, (unsigned char*)0, 0);
c->isfullscreen = 0;
@ -125,7 +106,7 @@ index 4465af1..8da5f36 100644
c->x = c->oldx;
c->y = c->oldy;
c->w = c->oldw;
@@ -1705,12 +1722,48 @@ togglebar(const Arg *arg)
@@ -1705,12 +1716,48 @@ togglebar(const Arg *arg)
arrange(selmon);
}

@ -1,4 +1,4 @@
From 3cceb1e481292b208271f23352abad5fff5c83e0 Mon Sep 17 00:00:00 2001
From 6dd0111a3be099a1bfb1dd0f88f5781b8845460e Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Sat, 5 Sep 2020 14:32:26 +0200
Subject: [PATCH] Compilation of fullscreen patches for dwm.
@ -26,8 +26,8 @@ This incorporates, and expands on, the following patches:
- losefullscreen
---
config.def.h | 4 +-
dwm.c | 152 ++++++++++++++++++++++++++++++++++++++++++---------
2 files changed, 128 insertions(+), 28 deletions(-)
dwm.c | 142 ++++++++++++++++++++++++++++++++++++++++++---------
2 files changed, 121 insertions(+), 25 deletions(-)
diff --git a/config.def.h b/config.def.h
index 1c0b587..5f28f2c 100644
@ -48,7 +48,7 @@ index 1c0b587..5f28f2c 100644
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
diff --git a/dwm.c b/dwm.c
index 4465af1..9f6fb5a 100644
index 4465af1..8be4ceb 100644
--- a/dwm.c
+++ b/dwm.c
@@ -93,6 +93,7 @@ struct Client {
@ -82,24 +82,7 @@ index 4465af1..9f6fb5a 100644
selmon = m;
focus(NULL);
}
@@ -519,9 +522,13 @@ clientmessage(XEvent *e)
return;
if (cme->message_type == netatom[NetWMState]) {
if (cme->data.l[1] == netatom[NetWMFullscreen]
- || cme->data.l[2] == netatom[NetWMFullscreen])
- 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[2] == netatom[NetWMFullscreen]) {
+ 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 */
+ || (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen)));
+ }
} else if (cme->message_type == netatom[NetActiveWindow]) {
if (c != selmon->sel && !c->isurgent)
seturgent(c, 1);
@@ -565,7 +572,7 @@ configurenotify(XEvent *e)
@@ -565,7 +568,7 @@ configurenotify(XEvent *e)
updatebars();
for (m = mons; m; m = m->next) {
for (c = m->clients; c; c = c->next)
@ -108,7 +91,7 @@ index 4465af1..9f6fb5a 100644
resizeclient(c, m->mx, m->my, m->mw, m->mh);
XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh);
}
@@ -754,7 +761,7 @@ drawbars(void)
@@ -754,7 +757,7 @@ drawbars(void)
void
enternotify(XEvent *e)
{
@ -117,7 +100,7 @@ index 4465af1..9f6fb5a 100644
Monitor *m;
XCrossingEvent *ev = &e->xcrossing;
@@ -763,8 +770,9 @@ enternotify(XEvent *e)
@@ -763,8 +766,9 @@ enternotify(XEvent *e)
c = wintoclient(ev->window);
m = c ? c->mon : wintomon(ev->window);
if (m != selmon) {
@ -128,7 +111,7 @@ index 4465af1..9f6fb5a 100644
} else if (!c || c == selmon->sel)
return;
focus(c);
@@ -786,7 +794,7 @@ focus(Client *c)
@@ -786,7 +790,7 @@ focus(Client *c)
if (!c || !ISVISIBLE(c))
for (c = selmon->stack; c && !ISVISIBLE(c); c = c->snext);
if (selmon->sel && selmon->sel != c)
@ -137,7 +120,7 @@ index 4465af1..9f6fb5a 100644
if (c) {
if (c->mon != selmon)
selmon = c->mon;
@@ -819,13 +827,15 @@ void
@@ -819,13 +823,15 @@ void
focusmon(const Arg *arg)
{
Monitor *m;
@ -154,7 +137,7 @@ index 4465af1..9f6fb5a 100644
focus(NULL);
}
@@ -1069,7 +1079,7 @@ manage(Window w, XWindowAttributes *wa)
@@ -1069,7 +1075,7 @@ manage(Window w, XWindowAttributes *wa)
XMoveResizeWindow(dpy, c->win, c->x + 2 * sw, c->y, c->w, c->h); /* some windows require this */
setclientstate(c, NormalState);
if (c->mon == selmon)
@ -163,7 +146,7 @@ index 4465af1..9f6fb5a 100644
c->mon->sel = c;
arrange(c->mon);
XMapWindow(dpy, c->win);
@@ -1120,13 +1130,15 @@ motionnotify(XEvent *e)
@@ -1120,13 +1126,15 @@ motionnotify(XEvent *e)
{
static Monitor *mon = NULL;
Monitor *m;
@ -180,7 +163,7 @@ index 4465af1..9f6fb5a 100644
focus(NULL);
}
mon = m;
@@ -1143,7 +1155,7 @@ movemouse(const Arg *arg)
@@ -1143,7 +1151,7 @@ movemouse(const Arg *arg)
if (!(c = selmon->sel))
return;
@ -189,7 +172,7 @@ index 4465af1..9f6fb5a 100644
return;
restack(selmon);
ocx = c->x;
@@ -1284,7 +1296,10 @@ resizeclient(Client *c, int x, int y, int w, int h)
@@ -1284,7 +1292,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);
@ -201,7 +184,7 @@ index 4465af1..9f6fb5a 100644
}
void
@@ -1298,7 +1313,7 @@ resizemouse(const Arg *arg)
@@ -1298,7 +1309,7 @@ resizemouse(const Arg *arg)
if (!(c = selmon->sel))
return;
@ -210,7 +193,7 @@ index 4465af1..9f6fb5a 100644
return;
restack(selmon);
ocx = c->x;
@@ -1412,7 +1427,7 @@ sendmon(Client *c, Monitor *m)
@@ -1412,7 +1423,7 @@ sendmon(Client *c, Monitor *m)
{
if (c->mon == m)
return;
@ -219,7 +202,7 @@ index 4465af1..9f6fb5a 100644
detach(c);
detachstack(c);
c->mon = m;
@@ -1476,8 +1491,10 @@ setfullscreen(Client *c, int fullscreen)
@@ -1476,8 +1487,10 @@ setfullscreen(Client *c, int fullscreen)
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1);
c->isfullscreen = 1;
@ -231,7 +214,7 @@ index 4465af1..9f6fb5a 100644
c->bw = 0;
c->isfloating = 1;
resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
@@ -1486,8 +1503,12 @@ setfullscreen(Client *c, int fullscreen)
@@ -1486,8 +1499,12 @@ setfullscreen(Client *c, int fullscreen)
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
PropModeReplace, (unsigned char*)0, 0);
c->isfullscreen = 0;
@ -245,7 +228,7 @@ index 4465af1..9f6fb5a 100644
c->x = c->oldx;
c->y = c->oldy;
c->w = c->oldw;
@@ -1665,9 +1686,19 @@ tag(const Arg *arg)
@@ -1665,9 +1682,19 @@ tag(const Arg *arg)
void
tagmon(const Arg *arg)
{
@ -267,7 +250,7 @@ index 4465af1..9f6fb5a 100644
}
void
@@ -1705,18 +1736,77 @@ togglebar(const Arg *arg)
@@ -1705,18 +1732,77 @@ togglebar(const Arg *arg)
arrange(selmon);
}
@ -351,7 +334,7 @@ index 4465af1..9f6fb5a 100644
}
void
@@ -1747,10 +1837,18 @@ toggleview(const Arg *arg)
@@ -1747,10 +1833,18 @@ toggleview(const Arg *arg)
}
void

Loading…
Cancel
Save