diff options
| author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-05-20 22:39:08 +1000 |
|---|---|---|
| committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-05-20 22:54:09 +1000 |
| commit | 9a06de63e7dc3e2953239d8e7012b1ec499c4ba1 (patch) | |
| tree | ec4939af2c5fd79cc889e55d38b51e0ae6f940a2 /main.c | |
| parent | 3afd535a3bd9dd3fc674ac7034b4e9d73a87ab6a (diff) | |
Swaylock: Log error if multiple images are defined for the same output
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -223,6 +223,23 @@ static void load_image(char *arg, struct swaylock_state *state) { image->path = strdup(arg); } + bool exists = false; + struct swaylock_image *iter_image; + wl_list_for_each(iter_image, &state->images, link) { + if (lenient_strcmp(iter_image->output_name, image->output_name) == 0) { + exists = true; + break; + } + } + if (exists) { + if (image->output_name) { + wlr_log(L_ERROR, "Multiple images defined for output %s", + image->output_name); + } else { + wlr_log(L_ERROR, "Multiple default images defined"); + } + } + // Bash doesn't replace the ~ with $HOME if the output name is supplied wordexp_t p; if (wordexp(image->path, &p, 0) == 0) { |
