Merge branch 'fix-segfault-in-fullscreennotify'

This commit is contained in:
Leonardo Hernández Hernández 2022-03-13 21:32:55 -06:00
commit 88f241d1cf
No known key found for this signature in database
GPG key ID: E538897EE11B9624
2 changed files with 21 additions and 1 deletions

View file

@ -103,6 +103,16 @@ client_is_float_type(Client *c)
return 0;
}
static inline int
client_wants_fullscreen(Client *c)
{
#ifdef XWAYLAND
if (client_is_x11(c))
return c->surface.xwayland->fullscreen;
#endif
return c->surface.xdg->toplevel->requested.fullscreen;
}
static inline int
client_is_unmanaged(Client *c)
{

12
dwl.c
View file

@ -1043,7 +1043,14 @@ void
fullscreennotify(struct wl_listener *listener, void *data)
{
Client *c = wl_container_of(listener, c, fullscreen);
setfullscreen(c, !c->isfullscreen);
int fullscreen = client_wants_fullscreen(c);
if (!c->mon) {
/* if the client is not mapped yet, let mapnotify() call setfullscreen() */
c->isfullscreen = fullscreen;
return;
}
setfullscreen(c, fullscreen);
}
Monitor *
@ -1318,6 +1325,9 @@ mapnotify(struct wl_listener *listener, void *data)
/* Set initial monitor, tags, floating status, and focus */
applyrules(c);
printstatus();
if (c->isfullscreen)
setfullscreen(c, 1);
}
void