view: Fix SSD margin computation

If `view->ssd_enabled` is false when calling `ssd_create()` then
`ssd_thickness()` returns zeroes which are stored in `ssd->margins`.

The quick fix is just to ensure we set `view->ssd_enabled` before
calling `ssd_create()`. At some point, it might be nice to refactor
so that `ssd_create()` does not reference `view->ssd_enabled`.
This commit is contained in:
John Lindgren 2022-11-26 22:49:10 -05:00 committed by Johan Malm
parent b203758ce1
commit cfa51ab628

View file

@ -559,12 +559,16 @@ view_set_decorations(struct view *view, bool decorations)
{
assert(view);
if (view->ssd_enabled != decorations && !view->fullscreen) {
/*
* Set view->ssd_enabled first since it is referenced
* within the call tree of ssd_create()
*/
view->ssd_enabled = decorations;
if (decorations) {
ssd_create(view, view == view->server->focused_view);
} else {
ssd_destroy(view);
}
view->ssd_enabled = decorations;
if (view->maximized) {
view_apply_maximized_geometry(view);
} else if (view->tiled) {