mirror of
https://github.com/swaywm/sway.git
synced 2024-11-10 20:44:01 +01:00
swaybg: implement scaling mode "tile"
This commit is contained in:
parent
621062f18d
commit
8630bc3752
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user