Handle new windows

Windows lose fullscreen state when a new window is created in the same
tag
main
Stivvo 2020-09-04 23:32:29 +02:00 committed by Guido Cella
parent 2abfd475de
commit d41cc60ec1
1 changed files with 22 additions and 2 deletions

24
dwl.c
View File

@ -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);
@ -887,6 +888,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)
{
@ -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;