diff options
-rw-r--r-- | include/sway/tree/container.h | 1 | ||||
-rw-r--r-- | sway/desktop/render.c | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index 5c368df2..2c973f71 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h | |||
@@ -285,6 +285,7 @@ bool container_is_fullscreen_or_child(struct sway_container *container); | |||
285 | /** | 285 | /** |
286 | * Return the output which will be used for scale purposes. | 286 | * Return the output which will be used for scale purposes. |
287 | * This is the most recently entered output. | 287 | * This is the most recently entered output. |
288 | * If the container is not on any output, return NULL. | ||
288 | */ | 289 | */ |
289 | struct sway_output *container_get_effective_output(struct sway_container *con); | 290 | struct sway_output *container_get_effective_output(struct sway_container *con); |
290 | 291 | ||
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; |