| 1 | #include <X11/Xlib.h> |
| 2 | |
| 3 | #include "background.hh" |
| 4 | |
| 5 | namespace uw { |
| 6 | Background::Background(const std::string &filename) |
| 7 | : filename(filename), i(s, filename), o(s, i) { |
| 8 | } |
| 9 | |
| 10 | Background::~Background() {} |
| 11 | |
| 12 | bool Background::setWallpaper(Mode mode) { |
| 13 | if (mode == Mode::FILL) { |
| 14 | o.fill(); |
| 15 | } else if (mode == Mode::CENTER) { |
| 16 | o.center(); |
| 17 | } else if (mode == Mode::TILE) { |
| 18 | o.tile(); |
| 19 | } else { |
| 20 | return false; |
| 21 | } |
| 22 | |
| 23 | XFlush(s.getDisplay()); |
| 24 | |
| 25 | return true; |
| 26 | } |
| 27 | } |