aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Moore <ken@pcbsd.org>2014-10-21 14:39:11 -0400
committerKen Moore <ken@pcbsd.org>2014-10-21 14:39:11 -0400
commitbdb69bb35e10cb0d517bf351ea66fa98934c94c9 (patch)
treedf5385f0bd3236bafb5ef801703d38e834c1afa7
parentAdd a workaround for a fluxbox bug: (diff)
downloadlumina-bdb69bb35e10cb0d517bf351ea66fa98934c94c9.tar.gz
lumina-bdb69bb35e10cb0d517bf351ea66fa98934c94c9.tar.bz2
lumina-bdb69bb35e10cb0d517bf351ea66fa98934c94c9.zip
Add randomization to the wallpaper image that is used on first start of a desktop.
-rw-r--r--lumina-desktop/LDesktop.cpp2
-rw-r--r--lumina-desktop/LSession.cpp3
2 files changed, 4 insertions, 1 deletions
diff --git a/lumina-desktop/LDesktop.cpp b/lumina-desktop/LDesktop.cpp
index 81d57cb8..c64f327f 100644
--- a/lumina-desktop/LDesktop.cpp
+++ b/lumina-desktop/LDesktop.cpp
@@ -395,7 +395,7 @@ void LDesktop::UpdateBackground(){
}
//Determine which background to use next
int index = bgL.indexOf(CBG);
- if( (index < 0) || (index >= bgL.length()-1) ){ index = 0; } //use the first file
+ if( (index < 0) || (index >= bgL.length()-1) ){ index = ( qrand() % bgL.length() ); } //pick a random file
else{ index++; } //use the next file in the list
QString bgFile;
if( bgL.isEmpty() && CBG.isEmpty()){ bgFile = "default"; }
diff --git a/lumina-desktop/LSession.cpp b/lumina-desktop/LSession.cpp
index 0507f920..00728d23 100644
--- a/lumina-desktop/LSession.cpp
+++ b/lumina-desktop/LSession.cpp
@@ -10,6 +10,7 @@
#include <Phonon/MediaObject>
#include <Phonon/AudioOutput>
#include <QThread>
+#include <QTime>
//X includes (these need to be last due to Qt compile issues)
#include <X11/Xlib.h>
@@ -57,6 +58,8 @@ LSession::~LSession(){
void LSession::setupSession(){
qDebug() << "Initializing Session";
+ //Seed random number generator (if needed)
+ qsrand( QTime::currentTime().msec() );
//Setup the QSettings default paths
QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, QDir::homePath()+"/.lumina");
sessionsettings = new QSettings("LuminaDE", "sessionsettings");
bgstack15