clients/desktop-shell: fix crash on init when panel is disabled

The same output might be inited twice on init when the shell panel is disabled,
depending on the order the weston_desktop_shell and wl_output globals are
advertised. This triggers a protocol error as only one background can be created
per output.

Since initializing the output requires the weston_desktop_shell global (to
create the background and panel on this output), the output init call is done
conditionally in two places: in the global registry handler (to handle output
hotplug) and after the initial wl_display_roundtrip call to handle the case
where the weston_desktop_shell global was notified after the outputs.

We now check the output has already been initialized correctly by checking if
the background has been created, instead of the panel which is not always
created.

Signed-off-by: Arnaud Vrac <avrac@freebox.fr>
(cherry picked from commit 59207a7c7c)
This commit is contained in:
Arnaud Vrac 2023-11-22 19:53:56 +01:00 committed by Marius Vlad
parent 5281e61fd3
commit 54585a4cc9
1 changed files with 1 additions and 1 deletions

View File

@ -1586,7 +1586,7 @@ int main(int argc, char *argv[])
if (desktop.want_panel)
weston_desktop_shell_set_panel_position(desktop.shell, desktop.panel_position);
wl_list_for_each(output, &desktop.outputs, link)
if (!output->panel)
if (!output->background)
output_init(output, &desktop);
grab_surface_create(&desktop);