aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/output.c
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-03-15 15:09:55 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2019-03-16 10:40:46 -0600
commit3106ef23a7b4f7f7efeb43d47e724f5b23c4fd78 (patch)
tree82335e0f8877d291a36e3c67f8cfefe07bbdde56 /sway/tree/output.c
parentFlush stdout in swaymsg when in subscribe mode (diff)
downloadsway-3106ef23a7b4f7f7efeb43d47e724f5b23c4fd78.tar.gz
sway-3106ef23a7b4f7f7efeb43d47e724f5b23c4fd78.tar.zst
sway-3106ef23a7b4f7f7efeb43d47e724f5b23c4fd78.zip
Fix output config retrieval for new outputs
This removes `output_find_config`, which would take the first matching output config it found. This is fine if only a name output config, identifier output config, or even just wildcard exist, but if there is a name output config and identifier output config, they are not merged. Instead, this introduces find_output_config, which is just a wrapper for `get_output_config`. This ensures that both the name and identifier output configs are respected. This fixes the following case: - For simplicity in this example, remove all output configs from config - Run `swaymsg output <name> bg #ff0000 solid_color` - Run `swaymsg output <identifier> scale 2` - Disconnect and reconnect output Without this, the output will have the background, but not the scale. With this, the output will have both the background and scale
Diffstat (limited to 'sway/tree/output.c')
-rw-r--r--sway/tree/output.c30
1 files changed, 0 insertions, 30 deletions
diff --git a/sway/tree/output.c b/sway/tree/output.c
index 227d487c..1202ba3c 100644
--- a/sway/tree/output.c
+++ b/sway/tree/output.c
@@ -267,36 +267,6 @@ void output_begin_destroy(struct sway_output *output) {
267 output->wlr_output = NULL; 267 output->wlr_output = NULL;
268} 268}
269 269
270struct output_config *output_find_config(struct sway_output *output) {
271 const char *name = output->wlr_output->name;
272 char identifier[128];
273 output_get_identifier(identifier, sizeof(identifier), output);
274
275 struct output_config *oc = NULL, *all = NULL;
276 for (int i = 0; i < config->output_configs->length; ++i) {
277 struct output_config *cur = config->output_configs->items[i];
278
279 if (strcasecmp(name, cur->name) == 0 ||
280 strcasecmp(identifier, cur->name) == 0) {
281 sway_log(SWAY_DEBUG, "Matched output config for %s", name);
282 oc = cur;
283 }
284 if (strcasecmp("*", cur->name) == 0) {
285 sway_log(SWAY_DEBUG, "Matched wildcard output config for %s", name);
286 all = cur;
287 }
288
289 if (oc && all) {
290 break;
291 }
292 }
293 if (!oc) {
294 oc = all;
295 }
296
297 return oc;
298}
299
300struct sway_output *output_from_wlr_output(struct wlr_output *output) { 270struct sway_output *output_from_wlr_output(struct wlr_output *output) {
301 return output->data; 271 return output->data;
302} 272}