mirror of
https://github.com/cage-kiosk/cage.git
synced 2025-10-29 05:40:19 -04:00
output: do not always terminate when last output is destroyed
Only terminate if the last output was nested under the Wayland or X11 backend. If not, using DRM backend for example, terminating Cage when unplugging the last monitor or simply turning it off does not seem to be the right behavior.
This commit is contained in:
parent
7ec7e3df2b
commit
96ffaa340e
1 changed files with 16 additions and 1 deletions
17
output.c
17
output.c
|
|
@ -206,10 +206,25 @@ handle_output_layout_change(struct wl_listener *listener, void *data)
|
|||
update_output_manager_config(server);
|
||||
}
|
||||
|
||||
static bool
|
||||
is_nested_output(struct cg_output *output)
|
||||
{
|
||||
if (wlr_output_is_wl(output->wlr_output)) {
|
||||
return true;
|
||||
}
|
||||
#if WLR_HAS_X11_BACKEND
|
||||
if (wlr_output_is_x11(output->wlr_output)) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
static void
|
||||
output_destroy(struct cg_output *output)
|
||||
{
|
||||
struct cg_server *server = output->server;
|
||||
bool was_nested_output = is_nested_output(output);
|
||||
|
||||
output->wlr_output->data = NULL;
|
||||
|
||||
|
|
@ -223,7 +238,7 @@ output_destroy(struct cg_output *output)
|
|||
|
||||
free(output);
|
||||
|
||||
if (wl_list_empty(&server->outputs)) {
|
||||
if (wl_list_empty(&server->outputs) && was_nested_output) {
|
||||
wl_display_terminate(server->wl_display);
|
||||
} else if (server->output_mode == CAGE_MULTI_OUTPUT_MODE_LAST && !wl_list_empty(&server->outputs)) {
|
||||
struct cg_output *prev = wl_container_of(server->outputs.next, prev, link);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue