summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStivvo <stivvo01@gmail.com>2020-09-04 23:32:29 +0200
committerGuido Cella <guido@guidocella.xyz>2020-12-19 18:06:09 +0100
commitd41cc60ec102d06b6c3e41c587fbb05b3a45e05e (patch)
treec35a590c53969f602c738f4d9fa16b6bce4ce8ea
parent2abfd475dedf86c84fc66da42c51cff87251659f (diff)
Handle new windows
Windows lose fullscreen state when a new window is created in the same tag
-rw-r--r--dwl.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/dwl.c b/dwl.c
index 25206d9..bd87590 100644
--- a/dwl.c
+++ b/dwl.c
@@ -228,11 +228,11 @@ static void cursorframe(struct wl_listener *listener, void *data);
static void destroylayersurfacenotify(struct wl_listener *listener, void *data);
static void destroynotify(struct wl_listener *listener, void *data);
static void destroyxdeco(struct wl_listener *listener, void *data);
-static void fullscreenotify(struct wl_listener *listener, void *data);
static Monitor *dirtomon(int dir);
static void focusclient(Client *c, int lift);
static void focusmon(const Arg *arg);
static void focusstack(const Arg *arg);
+static void fullscreenotify(struct wl_listener *listener, void *data);
static Client *focustop(Monitor *m);
static void getxdecomode(struct wl_listener *listener, void *data);
static void incnmaster(const Arg *arg);
@@ -251,6 +251,7 @@ static void moveresize(const Arg *arg);
static void outputmgrapply(struct wl_listener *listener, void *data);
static void outputmgrapplyortest(struct wlr_output_configuration_v1 *config, bool test);
static void outputmgrtest(struct wl_listener *listener, void *data);
+static void quitfullscreen(Client *c);
static void pointerfocus(Client *c, struct wlr_surface *surface,
double sx, double sy, uint32_t time);
static void quit(const Arg *arg);
@@ -888,6 +889,24 @@ createmon(struct wl_listener *listener, void *data)
}
void
+quitfullscreen(Client *c)
+{
+ wl_list_for_each(c, &clients, link) {
+ if (c->isfullscreen && VISIBLEON(c, c->mon)) {
+#ifdef XWAYLAND
+ if (c->type == X11Managed)
+ wlr_xwayland_surface_set_fullscreen(c->surface.xwayland, false);
+ else
+#endif
+ wlr_xdg_toplevel_set_fullscreen(c->surface.xdg, false);
+ c->bw = borderpx;
+ resize(c, c->prevx, c->prevy, c->prevwidth, c->prevheight, 0);
+ c->isfullscreen = 0;
+ }
+ }
+}
+
+void
createnotify(struct wl_listener *listener, void *data)
{
/* This event is raised when wlr_xdg_shell receives a new xdg surface from a
@@ -902,6 +921,7 @@ createnotify(struct wl_listener *listener, void *data)
c = xdg_surface->data = calloc(1, sizeof(*c));
c->surface.xdg = xdg_surface;
c->bw = borderpx;
+ quitfullscreen(c);
/* Tell the client not to try anything fancy */
wlr_xdg_toplevel_set_tiled(c->surface.xdg, WLR_EDGE_TOP |
@@ -986,7 +1006,6 @@ createxdeco(struct wl_listener *listener, void *data)
getxdecomode(&d->request_mode, wlr_deco);
}
-
void
cursorframe(struct wl_listener *listener, void *data)
{
@@ -2452,6 +2471,7 @@ createnotifyx11(struct wl_listener *listener, void *data)
c->surface.xwayland = xwayland_surface;
c->type = xwayland_surface->override_redirect ? X11Unmanaged : X11Managed;
c->bw = borderpx;
+ quitfullscreen(c);
/* Listen to the various events it can emit */
c->map.notify = maprequest;