diff options
author | Ken Moore <ken@pcbsd.org> | 2015-05-13 12:39:15 -0400 |
---|---|---|
committer | Ken Moore <ken@pcbsd.org> | 2015-05-13 12:39:15 -0400 |
commit | 76aac7b677197f187de19a0f9ec0323e40a39029 (patch) | |
tree | dc70b00623d17e0802d86743c4e34fe18e1e9f29 /lumina-desktop/panel-plugins/systemtray | |
parent | When using the time/date or date/time clock formats, put a newline instead of... (diff) | |
download | lumina-76aac7b677197f187de19a0f9ec0323e40a39029.tar.gz lumina-76aac7b677197f187de19a0f9ec0323e40a39029.tar.bz2 lumina-76aac7b677197f187de19a0f9ec0323e40a39029.zip |
A couple quick updates to the system tray:
1) Keep track of any events that come in during a check, and run another check when ready.
2) If an update event comes in for an icon which is not internally found, have it run the full check to see if it is missing an icon.
Diffstat (limited to 'lumina-desktop/panel-plugins/systemtray')
-rw-r--r-- | lumina-desktop/panel-plugins/systemtray/LSysTray.cpp | 12 | ||||
-rw-r--r-- | lumina-desktop/panel-plugins/systemtray/LSysTray.h | 2 |
2 files changed, 9 insertions, 5 deletions
diff --git a/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp b/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp index bdd605d0..74705b16 100644 --- a/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp +++ b/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp @@ -34,7 +34,7 @@ LSysTray::LSysTray(QWidget *parent, QString id, bool horizontal) : LPPlugin(pare upTimer = new QTimer(this); upTimer->setInterval(300000); //maximum time between refreshes is 5 minutes connect(upTimer, SIGNAL(timeout()), this, SLOT(checkAll()) ); - isRunning = false; stopping = false; checking = false; + isRunning = false; stopping = false; checking = false; pending = false; QTimer::singleShot(100, this, SLOT(start()) ); connect(LSession::handle(), SIGNAL(TrayListChanged()), this, SLOT(checkAll()) ); @@ -88,8 +88,9 @@ void LSysTray::stop(){ // PRIVATE FUNCTIONS // ======================== void LSysTray::checkAll(){ - if(!isRunning || stopping || checking){ return; } //Don't check if not running at the moment + if(!isRunning || stopping || checking){ pending = true; return; } //Don't check if not running at the moment checking = true; + pending = false; //Make sure this tray should handle the windows (was not disabled in the backend) bool TrayRunning = LSession::handle()->registerVisualTray(this->winId()); //qDebug() << "System Tray: Check tray apps"; @@ -156,6 +157,7 @@ void LSysTray::checkAll(){ }*/ //qDebug() << " - System Tray: check done"; checking = false; + if(pending){ QTimer::singleShot(0,this, SLOT(checkAll()) ); } } void LSysTray::UpdateTrayWindow(WId win){ @@ -164,9 +166,11 @@ void LSysTray::UpdateTrayWindow(WId win){ if(trayIcons[i]->appID()==win){ //qDebug() << "System Tray: Update Window " << win; trayIcons[i]->update(); - break; + return; //finished now } - } + } + //Could not find tray in the list, run the checkall routine to make sure we are not missing any + QTimer::singleShot(0,this, SLOT(checkAll()) ); } diff --git a/lumina-desktop/panel-plugins/systemtray/LSysTray.h b/lumina-desktop/panel-plugins/systemtray/LSysTray.h index 786ca730..2f7872b3 100644 --- a/lumina-desktop/panel-plugins/systemtray/LSysTray.h +++ b/lumina-desktop/panel-plugins/systemtray/LSysTray.h @@ -34,7 +34,7 @@ public: } private: - bool isRunning, stopping, checking; + bool isRunning, stopping, checking, pending; QList<TrayIcon*> trayIcons; QFrame *frame; QBoxLayout *LI; //layout items |