From 76aac7b677197f187de19a0f9ec0323e40a39029 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 13 May 2015 12:39:15 -0400 Subject: 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. --- lumina-desktop/panel-plugins/systemtray/LSysTray.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lumina-desktop/panel-plugins/systemtray/LSysTray.cpp') 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()) ); } -- cgit