Call wlr_output_enable on enable/disable if needed

This commit is contained in:
Brian Ashworth 2018-09-05 14:00:00 -04:00
parent 610eb94617
commit c246cf84c8
2 changed files with 15 additions and 23 deletions

View file

@ -178,12 +178,21 @@ void apply_output_config(struct output_config *oc, struct sway_output *output) {
struct wlr_output *wlr_output = output->wlr_output; struct wlr_output *wlr_output = output->wlr_output;
if (oc && oc->enabled == 0) { if (oc && oc->enabled == 0) {
if (output->enabled) {
if (output->bg_pid != 0) { if (output->bg_pid != 0) {
terminate_swaybg(output->bg_pid); terminate_swaybg(output->bg_pid);
output->bg_pid = 0; output->bg_pid = 0;
} }
output_disable(output); output_disable(output);
wlr_output_layout_remove(root->output_layout, wlr_output); wlr_output_layout_remove(root->output_layout, wlr_output);
}
wlr_output_enable(wlr_output, false);
return;
} else if (!output->enabled) {
if (!oc || oc->dpms_state != DPMS_OFF) {
wlr_output_enable(wlr_output, true);
}
output_enable(output, oc);
return; return;
} }
@ -251,7 +260,7 @@ void apply_output_config(struct output_config *oc, struct sway_output *output) {
free(command); free(command);
} }
} }
if (oc && oc->dpms_state != DPMS_IGNORE) { if (oc) {
switch (oc->dpms_state) { switch (oc->dpms_state) {
case DPMS_ON: case DPMS_ON:
wlr_log(WLR_DEBUG, "Turning on screen"); wlr_log(WLR_DEBUG, "Turning on screen");
@ -292,17 +301,6 @@ void apply_output_config_to_outputs(struct output_config *oc) {
char *name = sway_output->wlr_output->name; char *name = sway_output->wlr_output->name;
output_get_identifier(id, sizeof(id), sway_output); output_get_identifier(id, sizeof(id), sway_output);
if (wildcard || !strcmp(name, oc->name) || !strcmp(id, oc->name)) { if (wildcard || !strcmp(name, oc->name) || !strcmp(id, oc->name)) {
if (!sway_output->enabled) {
if (!oc->enabled) {
if (!wildcard) {
break;
}
continue;
}
output_enable(sway_output, oc);
}
struct output_config *current = oc; struct output_config *current = oc;
if (wildcard) { if (wildcard) {
struct output_config *tmp = get_output_config(name, id); struct output_config *tmp = get_output_config(name, id);

View file

@ -54,12 +54,6 @@ struct sway_output *output_create(struct wlr_output *wlr_output) {
wl_list_insert(&root->all_outputs, &output->link); wl_list_insert(&root->all_outputs, &output->link);
if (!wl_list_empty(&wlr_output->modes)) {
struct wlr_output_mode *mode =
wl_container_of(wlr_output->modes.prev, mode, link);
wlr_output_set_mode(wlr_output, mode);
}
output->workspaces = create_list(); output->workspaces = create_list();
output->current.workspaces = create_list(); output->current.workspaces = create_list();