summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStivvo <stivvo01@gmail.com>2020-09-04 17:11:26 +0200
committerGuido Cella <guido@guidocella.xyz>2020-12-19 18:05:51 +0100
commit60a732ceb8a436ddc511d2be5feb31a6186f3bf6 (patch)
tree7d226947ccddeebe7bf3cb5bdb4f0e78717c88b7
parentde6db9740104843fced2f7594f58948beb021da4 (diff)
Restore windows after fullscreen
Store position and size of windows before going fullscreen. This is more efficient than arrange() and also works with floating windows All the clients keep their original position because arrange() isn't used after quitting fullscreen
-rw-r--r--dwl.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/dwl.c b/dwl.c
index 26d977d..554b9a0 100644
--- a/dwl.c
+++ b/dwl.c
@@ -112,6 +112,10 @@ typedef struct {
unsigned int tags;
int isfloating;
uint32_t resize; /* configure serial of a pending resize */
+ int prevx;
+ int prevy;
+ int prevwidth;
+ int prevheight;
} Client;
typedef struct {
@@ -1048,6 +1052,16 @@ fullscreenotify(struct wl_listener *listener, void *data) {
wlr_xdg_toplevel_set_fullscreen(
c->surface.xdg, !c->surface.xdg->toplevel->current.fullscreen);
c->bw = (int)c->surface.xdg->toplevel->current.fullscreen * borderpx;
+
+ if (c->surface.xdg->toplevel->current.fullscreen) { /* fullscreen off */
+ resize(c, c->prevx, c->prevy, c->prevwidth, c->prevheight, 0);
+ } else { /* fullscreen on */
+ c->prevx = c->geom.x;
+ c->prevy = c->geom.y;
+ c->prevheight = c->geom.height;
+ c->prevwidth = c->geom.width;
+ resize(c, c->mon->w.x, c->mon->w.y, c->mon->w.width, c->mon->w.height, 0);
+ }
}
Monitor *