Skip to content

Commit

Permalink
Switch to previous output if current output disappears
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Ramsay <[email protected]>
  • Loading branch information
lack authored and any1 committed Nov 6, 2022
1 parent 7a15957 commit cb95ce9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,18 @@ static void registry_remove(void* data, struct wl_registry* registry,

struct output* out = output_find_by_id(&self->outputs, id);
if (out) {
nvnc_log(NVNC_LOG_INFO, "Output %s went away", out->name);
if (out == self->selected_output) {
nvnc_log(NVNC_LOG_WARNING, "Selected output %s went away",
out->name);
switch_to_prev_output(self);
} else
nvnc_log(NVNC_LOG_INFO, "Output %s went away", out->name);

wl_list_remove(&out->link);
output_destroy(out);

if (out == self->selected_output) {
nvnc_log(NVNC_LOG_ERROR, "Selected output went away. Exiting...");
nvnc_log(NVNC_LOG_ERROR, "No fallback outputs left. Exiting...");
wayvnc_exit(self);
}

Expand Down

0 comments on commit cb95ce9

Please sign in to comment.