From 43bd806291ab1b4bf46cbe35cddebba9af97fd54 Mon Sep 17 00:00:00 2001 From: Stivvo Date: Fri, 4 Sep 2020 17:11:26 +0200 Subject: [PATCH] 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 --- dwl.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dwl.c b/dwl.c index e5163167f828e0b8c6e298f6b8d06588d9c1ae24..f139bf6fae64c0985cad6a3bf6640c4525f6e8aa 100644 --- a/dwl.c +++ b/dwl.c @@ -106,6 +106,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 { @@ -675,6 +679,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 *