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 | 8d7fb99cffccfdb0505bf7f3bbaf66059550cf55 (patch) | |
tree | 35cc8ea9239288b974b4fcfa7fdebae401d61ef6 /main.c | |
parent | 17d1c55b4e21c43206f06d13f9be1ac5d8b1f6bf (diff) | |
download | swaybg-8d7fb99cffccfdb0505bf7f3bbaf66059550cf55.tar.gz swaybg-8d7fb99cffccfdb0505bf7f3bbaf66059550cf55.tar.bz2 |
swaybg: implement scaling mode "tile"
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -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); } |