diff options
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/main.cpp b/src/main.cpp index 17d07bc..50816ec 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -37,7 +37,7 @@ static QMap<int, MainWindow*> currentWindows; static QTimer setupDelay; -static void createSimpleBackground(); +void createSimpleBackground(); static void watch(const QScreen *scrn); @@ -124,12 +124,23 @@ static void watch(const QScreen *scrn) }); } -static void createSimpleBackground() +void createSimpleBackground() { - QImage img = Global::getConfigGradient(); - if (img.isNull()) - return; - img = img.scaled(QApplication::desktop()->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + QImage img; + if (currentWindows.isEmpty()) { + img = Global::getConfigGradient(); + if (img.isNull()) { + img = QImage(QApplication::desktop()->size(), QImage::Format::Format_RGB32); + } else { + img = img.scaled(QApplication::desktop()->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + } + } else { + img = QImage(QApplication::desktop()->size(), QImage::Format::Format_RGB32); + QPainter p(&img); + for (auto *w : currentWindows) { + p.drawImage(w->geometry(), w->background(), QRect(QPoint(0, 0), w->geometry().size())); + } + } AddPixmapToBackground(img.constBits(), img.width(), img.height(), 24, img.bytesPerLine(), img.byteCount()); } |