mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2026-05-08 18:18:09 +02:00
desktop-shell: handle NULL output in center_on_output()
This is a tentative crash fix for a case where there are no enabled weston_outputs at all. If no output is given, just put the surface at 0,0. At least it should become mostly visible if an output is plugged in, if not centered. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com> Reviewed-by: Ian Ray <ian.ray@ge.com>
This commit is contained in:
parent
99372bab4c
commit
30aa59759a
1 changed files with 5 additions and 0 deletions
|
|
@ -4190,6 +4190,11 @@ center_on_output(struct weston_view *view, struct weston_output *output)
|
|||
int32_t surf_x, surf_y, width, height;
|
||||
float x, y;
|
||||
|
||||
if (!output) {
|
||||
weston_view_set_position(view, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
surface_subsurfaces_boundingbox(view->surface, &surf_x, &surf_y, &width, &height);
|
||||
|
||||
x = output->x + (output->width - width) / 2 - surf_x / 2;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue