fullscreen-compilation: exiting fullscreen after a fullscreen window has been moved to another monitor gives a window that appears to be floating, but it is not - addressing this with an arrange rather than restack plus restricting the size of floating clients following a fullscreen move between monitors

pull/19/head
bakkeby 4 years ago
parent cce049830f
commit c8187c6372

@ -1,4 +1,4 @@
From e55e96a618298576aadd090cab52d84e26ad44cd Mon Sep 17 00:00:00 2001
From 94b83f6248cc0a536b6cdc354182464e746aa659 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 | 165 ++++++++++++++++++++++++++++++++++++++++-----------
2 files changed, 135 insertions(+), 34 deletions(-)
dwm.c | 182 ++++++++++++++++++++++++++++++++++++++++-----------
2 files changed, 147 insertions(+), 39 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..6a908c6 100644
index 4465af1..ab1f42c 100644
--- a/dwm.c
+++ b/dwm.c
@@ -93,6 +93,7 @@ struct Client {
@ -221,7 +221,7 @@ index 4465af1..6a908c6 100644
detach(c);
detachstack(c);
c->mon = m;
@@ -1472,28 +1491,62 @@ setfocus(Client *c)
@@ -1472,28 +1491,69 @@ setfocus(Client *c)
void
setfullscreen(Client *c, int fullscreen)
{
@ -281,20 +281,32 @@ index 4465af1..6a908c6 100644
- c->isfloating = c->oldstate;
+ } else if (restorestate && (c->oldstate & (1 << 1))) {
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);
- arrange(c->mon);
+ c->isfloating = c->oldstate = c->oldstate & 1;
c->x = c->oldx;
c->y = c->oldy;
c->w = c->oldw;
c->h = c->oldh;
+ if (restorefakefullscreen || c->fakefullscreen == 3)
+ c->fakefullscreen = 1;
resizeclient(c, c->x, c->y, c->w, c->h);
- arrange(c->mon);
+ restack(c->mon);
+ /* The client may have been moved to another monitor whilst in fullscreen which if tiled
+ * we address by doing a full arrange of tiled clients. If the client is floating then the
+ * height and width may be larger than the monitor's window area, so we cap that by
+ * ensuring max / min values. */
+ if (c->isfloating) {
+ c->x = MAX(c->mon->wx, c->oldx);
+ c->y = MAX(c->mon->wy, c->oldy);
+ c->w = MIN(c->mon->ww - c->x - 2*c->bw, c->oldw);
+ c->h = MIN(c->mon->wh - c->y - 2*c->bw, c->oldh);
+ resizeclient(c, c->x, c->y, c->w, c->h);
+ restack(c->mon);
+ } else
+ arrange(c->mon);
}
}
@@ -1665,9 +1718,19 @@ tag(const Arg *arg)
@@ -1665,9 +1725,19 @@ tag(const Arg *arg)
void
tagmon(const Arg *arg)
{
@ -316,7 +328,7 @@ index 4465af1..6a908c6 100644
}
void
@@ -1705,18 +1768,51 @@ togglebar(const Arg *arg)
@@ -1705,18 +1775,51 @@ togglebar(const Arg *arg)
arrange(selmon);
}
@ -374,7 +386,7 @@ index 4465af1..6a908c6 100644
}
void
@@ -1747,10 +1843,13 @@ toggleview(const Arg *arg)
@@ -1747,10 +1850,13 @@ toggleview(const Arg *arg)
}
void

Loading…
Cancel
Save