From b04c73be3de62d2739b5bb85e40f0c9af1122903 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Sat, 23 Jul 2022 13:25:47 -0500 Subject: make sure we do not create a double fullscreen_bg and also make sure we do not destroy it if it does not exist Fixes: #274 --- dwl.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'dwl.c') diff --git a/dwl.c b/dwl.c index 35c72f0..7886b64 100644 --- a/dwl.c +++ b/dwl.c @@ -1879,14 +1879,19 @@ setfullscreen(Client *c, int fullscreen) * * For brevity we set a black background for all clients */ - c->fullscreen_bg = wlr_scene_rect_create(c->scene, - c->geom.width, c->geom.height, fullscreen_bg); - wlr_scene_node_lower_to_bottom(&c->fullscreen_bg->node); + if (!c->fullscreen_bg) { + c->fullscreen_bg = wlr_scene_rect_create(c->scene, + c->geom.width, c->geom.height, fullscreen_bg); + wlr_scene_node_lower_to_bottom(&c->fullscreen_bg->node); + } } else { /* restore previous size instead of arrange for floating windows since * client positions are set by the user and cannot be recalculated */ resize(c, c->prev, 0); - wlr_scene_node_destroy(&c->fullscreen_bg->node); + if (c->fullscreen_bg) { + wlr_scene_node_destroy(&c->fullscreen_bg->node); + c->fullscreen_bg = NULL; + } } arrange(c->mon); printstatus(); -- cgit v1.2.3