diff options
author | 2019-10-26 13:59:19 +0200 | |
---|---|---|
committer | 2019-10-27 10:51:02 -0400 | |
commit | 58a40ce07b2e20e6fca70fba4c2775510928d33e (patch) | |
tree | 5bb86b3f7bd50e1c1d0ef3984b16e8c66c6a9fe4 | |
parent | Fix tiled containers resize with mouse (diff) | |
download | sway-58a40ce07b2e20e6fca70fba4c2775510928d33e.tar.gz sway-58a40ce07b2e20e6fca70fba4c2775510928d33e.tar.zst sway-58a40ce07b2e20e6fca70fba4c2775510928d33e.zip |
Fix apply_output_config return value when enabling output
apply_output_config would call output_enable and always return true,
even if the output couldn't be enabled.
-rw-r--r-- | include/sway/output.h | 2 | ||||
-rw-r--r-- | sway/config/output.c | 3 | ||||
-rw-r--r-- | sway/tree/output.c | 10 |
3 files changed, 8 insertions, 7 deletions
diff --git a/include/sway/output.h b/include/sway/output.h index b94824b4..c52b3094 100644 --- a/include/sway/output.h +++ b/include/sway/output.h | |||
@@ -90,7 +90,7 @@ struct sway_output *all_output_by_name_or_id(const char *name_or_id); | |||
90 | 90 | ||
91 | void output_sort_workspaces(struct sway_output *output); | 91 | void output_sort_workspaces(struct sway_output *output); |
92 | 92 | ||
93 | void output_enable(struct sway_output *output, struct output_config *oc); | 93 | bool output_enable(struct sway_output *output, struct output_config *oc); |
94 | 94 | ||
95 | void output_disable(struct sway_output *output); | 95 | void output_disable(struct sway_output *output); |
96 | 96 | ||
diff --git a/sway/config/output.c b/sway/config/output.c index 12a875b7..3c36692f 100644 --- a/sway/config/output.c +++ b/sway/config/output.c | |||
@@ -249,8 +249,7 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) { | |||
249 | if (!oc || oc->dpms_state != DPMS_OFF) { | 249 | if (!oc || oc->dpms_state != DPMS_OFF) { |
250 | wlr_output_enable(wlr_output, true); | 250 | wlr_output_enable(wlr_output, true); |
251 | } | 251 | } |
252 | output_enable(output, oc); | 252 | return output_enable(output, oc); |
253 | return true; | ||
254 | } | 253 | } |
255 | 254 | ||
256 | if (oc && oc->dpms_state == DPMS_ON) { | 255 | if (oc && oc->dpms_state == DPMS_ON) { |
diff --git a/sway/tree/output.c b/sway/tree/output.c index 24adc08d..33fdee5e 100644 --- a/sway/tree/output.c +++ b/sway/tree/output.c | |||
@@ -60,7 +60,7 @@ static void restore_workspaces(struct sway_output *output) { | |||
60 | struct sway_workspace *ws = root->noop_output->workspaces->items[0]; | 60 | struct sway_workspace *ws = root->noop_output->workspaces->items[0]; |
61 | workspace_detach(ws); | 61 | workspace_detach(ws); |
62 | output_add_workspace(output, ws); | 62 | output_add_workspace(output, ws); |
63 | 63 | ||
64 | // If the floater was made floating while on the NOOP output, its width | 64 | // If the floater was made floating while on the NOOP output, its width |
65 | // and height will be zero and it should be reinitialized as a floating | 65 | // and height will be zero and it should be reinitialized as a floating |
66 | // container to get the appropriate size and location. Additionally, if | 66 | // container to get the appropriate size and location. Additionally, if |
@@ -104,9 +104,9 @@ struct sway_output *output_create(struct wlr_output *wlr_output) { | |||
104 | return output; | 104 | return output; |
105 | } | 105 | } |
106 | 106 | ||
107 | void output_enable(struct sway_output *output, struct output_config *oc) { | 107 | bool output_enable(struct sway_output *output, struct output_config *oc) { |
108 | if (!sway_assert(!output->enabled, "output is already enabled")) { | 108 | if (!sway_assert(!output->enabled, "output is already enabled")) { |
109 | return; | 109 | return false; |
110 | } | 110 | } |
111 | struct wlr_output *wlr_output = output->wlr_output; | 111 | struct wlr_output *wlr_output = output->wlr_output; |
112 | size_t len = sizeof(output->layers) / sizeof(output->layers[0]); | 112 | size_t len = sizeof(output->layers) / sizeof(output->layers[0]); |
@@ -117,7 +117,7 @@ void output_enable(struct sway_output *output, struct output_config *oc) { | |||
117 | output->enabled = true; | 117 | output->enabled = true; |
118 | if (!apply_output_config(oc, output)) { | 118 | if (!apply_output_config(oc, output)) { |
119 | output->enabled = false; | 119 | output->enabled = false; |
120 | return; | 120 | return false; |
121 | } | 121 | } |
122 | 122 | ||
123 | output->configured = true; | 123 | output->configured = true; |
@@ -155,6 +155,8 @@ void output_enable(struct sway_output *output, struct output_config *oc) { | |||
155 | 155 | ||
156 | arrange_layers(output); | 156 | arrange_layers(output); |
157 | arrange_root(); | 157 | arrange_root(); |
158 | |||
159 | return true; | ||
158 | } | 160 | } |
159 | 161 | ||
160 | static void evacuate_sticky(struct sway_workspace *old_ws, | 162 | static void evacuate_sticky(struct sway_workspace *old_ws, |