aboutsummaryrefslogtreecommitdiffstats
path: root/sway
diff options
context:
space:
mode:
authorLibravatar Quantum <quantum2048@gmail.com>2021-02-24 15:15:22 -0500
committerLibravatar Tudor Brindus <me@tbrindus.ca>2021-02-25 00:43:02 -0500
commite01a3c85f65f0cbf1c196021461669c2f93d4e4d (patch)
tree18d23151d020320bf0a9252f0ee77593b23f6ee5 /sway
parentoutput: Reconfigure xcursor when applying output config (diff)
downloadsway-e01a3c85f65f0cbf1c196021461669c2f93d4e4d.tar.gz
sway-e01a3c85f65f0cbf1c196021461669c2f93d4e4d.tar.zst
sway-e01a3c85f65f0cbf1c196021461669c2f93d4e4d.zip
render: handle containers without output when rendering titles
In e0a94bee8da3271f942c0881ee18a7e2d4138063, it was believed that if the container is being rendered, it must have an output. This turned out not to be the case. When rendering a container, all its children are rendered, even if the children is positioned off screen and thus not having any output. This is the cause of the crash in #6061. This commit introduces a null-check, which fixes #6061.
Diffstat (limited to 'sway')
-rw-r--r--sway/desktop/render.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sway/desktop/render.c b/sway/desktop/render.c
index 20832cc4..908ad819 100644
--- a/sway/desktop/render.c
+++ b/sway/desktop/render.c
@@ -519,7 +519,11 @@ static void render_titlebar(struct sway_output *output,
519 wlr_texture_get_size(title_texture, 519 wlr_texture_get_size(title_texture,
520 &texture_box.width, &texture_box.height); 520 &texture_box.width, &texture_box.height);
521 521
522 float title_scale = container_get_effective_output(con)->wlr_output->scale; 522 // The effective output may be NULL when con is not on any output.
523 // This can happen because we render all children of containers,
524 // even those that are out of the bounds of any output.
525 struct sway_output *effective = container_get_effective_output(con);
526 float title_scale = effective ? effective->wlr_output->scale : output_scale;
523 texture_box.width = texture_box.width * output_scale / title_scale; 527 texture_box.width = texture_box.width * output_scale / title_scale;
524 texture_box.height = texture_box.height * output_scale / title_scale; 528 texture_box.height = texture_box.height * output_scale / title_scale;
525 ob_title_width = texture_box.width; 529 ob_title_width = texture_box.width;