diff options
-rw-r--r-- | util/fbsetroot.cc | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/util/fbsetroot.cc b/util/fbsetroot.cc index cb55e16..e18e829 100644 --- a/util/fbsetroot.cc +++ b/util/fbsetroot.cc | |||
@@ -54,6 +54,11 @@ using std::cerr; | |||
54 | using std::endl; | 54 | using std::endl; |
55 | using std::string; | 55 | using std::string; |
56 | 56 | ||
57 | inline int getRootDepth(const FbTk::FbWindow& w) { | ||
58 | return (w.depth() == 32 ? 24 : w.depth()); | ||
59 | } | ||
60 | |||
61 | |||
57 | fbsetroot::fbsetroot(int argc, char **argv, char *dpy_name) | 62 | fbsetroot::fbsetroot(int argc, char **argv, char *dpy_name) |
58 | : FbTk::App(dpy_name), m_app_name(argv[0]) { | 63 | : FbTk::App(dpy_name), m_app_name(argv[0]) { |
59 | 64 | ||
@@ -213,7 +218,7 @@ void fbsetroot::solid() { | |||
213 | pixmap = new Pixmap(XCreatePixmap(display(), | 218 | pixmap = new Pixmap(XCreatePixmap(display(), |
214 | root.window(), | 219 | root.window(), |
215 | root.width(), root.height(), | 220 | root.width(), root.height(), |
216 | root.depth())); | 221 | getRootDepth(root))); |
217 | 222 | ||
218 | XFillRectangle(display(), *pixmap, gc.gc(), 0, 0, | 223 | XFillRectangle(display(), *pixmap, gc.gc(), 0, 0, |
219 | root.width(), root.height()); | 224 | root.width(), root.height()); |
@@ -262,7 +267,7 @@ void fbsetroot::modula(int x, int y) { | |||
262 | // bitmap used as tile, needs to have the same depth as background pixmap | 267 | // bitmap used as tile, needs to have the same depth as background pixmap |
263 | r_bitmap = XCreatePixmap(display(), | 268 | r_bitmap = XCreatePixmap(display(), |
264 | root.window(), 16, 16, | 269 | root.window(), 16, 16, |
265 | root.depth()); | 270 | (root.depth() == 32 ? 24 : root.depth())); |
266 | 271 | ||
267 | FbTk::Color f(fore, screen), b(back, screen); | 272 | FbTk::Color f(fore, screen), b(back, screen); |
268 | 273 | ||
@@ -286,7 +291,7 @@ void fbsetroot::modula(int x, int y) { | |||
286 | pixmap = new Pixmap(XCreatePixmap(display(), | 291 | pixmap = new Pixmap(XCreatePixmap(display(), |
287 | root.window(), | 292 | root.window(), |
288 | root.width(), root.height(), | 293 | root.width(), root.height(), |
289 | root.depth())); | 294 | getRootDepth(root))); |
290 | 295 | ||
291 | XFillRectangle(display(), *pixmap, gc.gc(), 0, 0, | 296 | XFillRectangle(display(), *pixmap, gc.gc(), 0, 0, |
292 | root.width(), root.height()); | 297 | root.width(), root.height()); |
@@ -332,7 +337,7 @@ void fbsetroot::gradient() { | |||
332 | pixmap = new Pixmap(XCreatePixmap(display(), | 337 | pixmap = new Pixmap(XCreatePixmap(display(), |
333 | root.window(), | 338 | root.window(), |
334 | root.width(), root.height(), | 339 | root.width(), root.height(), |
335 | root.depth())); | 340 | getRootDepth(root))); |
336 | 341 | ||
337 | 342 | ||
338 | XCopyArea(display(), tmp, *pixmap, gc.gc(), 0, 0, | 343 | XCopyArea(display(), tmp, *pixmap, gc.gc(), 0, 0, |