diff options
Diffstat (limited to 'sway/tree/output.c')
-rw-r--r-- | sway/tree/output.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/sway/tree/output.c b/sway/tree/output.c index 3c4614a8..f24be010 100644 --- a/sway/tree/output.c +++ b/sway/tree/output.c @@ -58,6 +58,7 @@ struct sway_output *output_create(struct wlr_output *wlr_output) { wlr_output->data = output; wl_signal_add(&wlr_output->events.destroy, &output->destroy); + wl_signal_init(&output->events.destroy); wl_list_insert(&root->all_outputs, &output->link); @@ -76,7 +77,6 @@ void output_enable(struct sway_output *output, struct output_config *oc) { for (size_t i = 0; i < len; ++i) { wl_list_init(&output->layers[i]); } - wl_signal_init(&output->events.destroy); output->enabled = true; list_add(root->outputs, output); @@ -88,11 +88,12 @@ void output_enable(struct sway_output *output, struct output_config *oc) { restore_workspaces(output); + struct sway_workspace *ws = NULL; if (!output->workspaces->length) { // Create workspace char *ws_name = workspace_next_name(wlr_output->name); wlr_log(WLR_DEBUG, "Creating default workspace %s", ws_name); - struct sway_workspace *ws = workspace_create(output, ws_name); + ws = workspace_create(output, ws_name); // Set each seat's focus if not already set struct sway_seat *seat = NULL; wl_list_for_each(seat, &server.input->seats, link) { @@ -104,9 +105,15 @@ void output_enable(struct sway_output *output, struct output_config *oc) { ipc_event_workspace(NULL, ws, "init"); } - apply_output_config(oc, output); + if (ws && config->default_orientation == L_NONE) { + // Since the output transformation and resolution could have changed + // due to applying the output config, the previously set layout for the + // created workspace may not be correct for `default_orientation auto` + ws->layout = output_get_default_layout(output); + } + input_manager_configure_xcursor(); wl_signal_add(&wlr_output->events.mode, &output->mode); @@ -218,6 +225,11 @@ void output_disable(struct sway_output *output) { root_for_each_container(untrack_output, output); + if (output->bg_pid) { + terminate_swaybg(output->bg_pid); + output->bg_pid = 0; + } + int index = list_find(root->outputs, output); list_del(root->outputs, index); |