diff options
author | Christoph Gysin <christoph.gysin@gmail.com> | 2015-11-25 21:07:34 +0200 |
---|---|---|
committer | Christoph Gysin <christoph.gysin@gmail.com> | 2015-11-25 22:31:39 +0200 |
commit | 8630bc37524434096165acff5493eff399387df2 (patch) | |
tree | 89745b29083e0f8f9b29024b5153dbd3b496a153 | |
parent | 621062f18d3511a2b0fae0a18f168e07f1ff1b0d (diff) |
swaybg: implement scaling mode "tile"
-rw-r--r-- | swaybg/main.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/swaybg/main.c b/swaybg/main.c index 481fdf9a..7cfe1320 100644 --- a/swaybg/main.c +++ b/swaybg/main.c @@ -16,6 +16,7 @@ enum scaling_mode_t { SCALING_MODE_STRETCH, SCALING_MODE_FILL, SCALING_MODE_CENTER, + SCALING_MODE_TILE, }; void sway_terminate(void) { @@ -67,6 +68,8 @@ int main(int argc, const char **argv) { scaling_mode = SCALING_MODE_FILL; } else if (strcmp(scaling_mode_str, "center") == 0) { scaling_mode = SCALING_MODE_CENTER; + } else if (strcmp(scaling_mode_str, "tile") == 0) { + scaling_mode = SCALING_MODE_TILE; } else { sway_abort("Unsupported scaling mode: %s", scaling_mode_str); } @@ -107,6 +110,13 @@ int main(int argc, const char **argv) { (double) window->width/2 - width/2, (double) window->height/2 - height/2); break; + case SCALING_MODE_TILE: + { + cairo_pattern_t *pattern = cairo_pattern_create_for_surface(image); + cairo_pattern_set_extend(pattern, CAIRO_EXTEND_REPEAT); + cairo_set_source(window->cairo, pattern); + } + break; default: sway_abort("Scaling mode '%s' not implemented yet!", scaling_mode_str); } |