diff options
Diffstat (limited to 'lumina-desktop')
-rw-r--r-- | lumina-desktop/LWinInfo.cpp | 60 | ||||
-rw-r--r-- | lumina-desktop/LWinInfo.h | 47 | ||||
-rw-r--r-- | lumina-desktop/LXcbEventFilter.h | 10 | ||||
-rw-r--r-- | lumina-desktop/lumina-desktop.pro | 1 | ||||
-rw-r--r-- | lumina-desktop/main.cpp | 3 | ||||
-rw-r--r-- | lumina-desktop/panel-plugins/taskmanager/LTaskManagerPlugin.cpp | 26 | ||||
-rw-r--r-- | lumina-desktop/panel-plugins/taskmanager/LTaskManagerPlugin.h | 3 |
7 files changed, 91 insertions, 59 deletions
diff --git a/lumina-desktop/LWinInfo.cpp b/lumina-desktop/LWinInfo.cpp new file mode 100644 index 00000000..227dc2d9 --- /dev/null +++ b/lumina-desktop/LWinInfo.cpp @@ -0,0 +1,60 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2014, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "LWinInfo.h" + +#include <LuminaX11.h> + +#include "LSession.h" + +//Information Retrieval + // Don't cache these results because they can change regularly +QString LWinInfo::text(){ + qDebug() << "Window Visible Icon Name:" << window; + if(window==0){ return ""; } + QString nm = LSession::handle()->XCB->WindowVisibleIconName(window); + if(nm.isEmpty()){ qDebug() << " - Window Icon Name"; nm = LSession::handle()->XCB->WindowIconName(window); } + if(nm.isEmpty()){ qDebug() << " - Window Visible Name";nm = LSession::handle()->XCB->WindowVisibleName(window); } + if(nm.isEmpty()){ qDebug() << " - Window Name";nm = LSession::handle()->XCB->WindowName(window); } + return nm; +} + +QIcon LWinInfo::icon(bool &noicon){ + if(window==0){ noicon = true; return QIcon();} + qDebug() << "Check for Window Icon:" << window; + noicon = false; + QIcon ico = LX11::WindowIcon(window); + //Check for a null icon, and supply one if necessary + if(ico.isNull()){ qDebug() << " - Class Icon"; ico = LXDG::findIcon( this->Class().toLower(),""); } + if(ico.isNull()){qDebug() << " - Default Icon"; ico = LXDG::findIcon("preferences-system-windows",""); noicon=true;} + return ico; +} + +QString LWinInfo::Class(){ + qDebug() << "Window Class:" << window; + return LSession::handle()->XCB->WindowClass(window); +} + +Lumina::STATES LWinInfo::status(){ + if(window==0){ return Lumina::NOSHOW; } + LXCB::WINDOWSTATE ws = LSession::handle()->XCB->WindowState(window); + //LX11::WINDOWSTATE ws = LX11::GetWindowState(window); + Lumina::STATES state; + switch(ws){ + case LXCB::VISIBLE: + state = Lumina::VISIBLE; break; + case LXCB::INVISIBLE: + state = Lumina::INVISIBLE; break; + case LXCB::ACTIVE: + state = Lumina::ACTIVE; break; + case LXCB::ATTENTION: + state = Lumina::NOTIFICATION; break; + default: + state = Lumina::NOSHOW; + } + //qDebug() << "Window State:" << ws << state; + return state; +}
\ No newline at end of file diff --git a/lumina-desktop/LWinInfo.h b/lumina-desktop/LWinInfo.h index ae67499b..8fb70ee2 100644 --- a/lumina-desktop/LWinInfo.h +++ b/lumina-desktop/LWinInfo.h @@ -39,49 +39,10 @@ public: //Information Retrieval // Don't cache these results because they can change regularly - QString text(){ - if(window==0){ return ""; } - QString nm = LX11::WindowVisibleIconName(window); - if(nm.isEmpty()){ nm = LX11::WindowIconName(window); } - if(nm.isEmpty()){ nm = LX11::WindowVisibleName(window); } - if(nm.isEmpty()){ nm = LX11::WindowName(window); } - return nm; - } - - QIcon icon(bool &noicon){ - if(window==0){ noicon = true; return QIcon();} - //qDebug() << "Check for Window Icon:" << window; - noicon = false; - QIcon ico = LX11::WindowIcon(window); - //Check for a null icon, and supply one if necessary - if(ico.isNull()){ ico = LXDG::findIcon( this->Class().toLower(),""); } - if(ico.isNull()){ ico = LXDG::findIcon("preferences-system-windows",""); noicon=true;} - return ico; - } - - QString Class(){ - return LX11::WindowClass(window); - } - - Lumina::STATES status(){ - if(window==0){ return Lumina::NOSHOW; } - LX11::WINDOWSTATE ws = LX11::GetWindowState(window); - Lumina::STATES state; - switch(ws){ - case LX11::VISIBLE: - state = Lumina::VISIBLE; break; - case LX11::INVISIBLE: - state = Lumina::INVISIBLE; break; - case LX11::ACTIVE: - state = Lumina::ACTIVE; break; - case LX11::ATTENTION: - state = Lumina::NOTIFICATION; break; - default: - state = Lumina::NOSHOW; - } - //qDebug() << "Window State:" << ws << state; - return state; - } + QString text(); + QIcon icon(bool &noicon); + QString Class(); + Lumina::STATES status(); }; #endif
\ No newline at end of file diff --git a/lumina-desktop/LXcbEventFilter.h b/lumina-desktop/LXcbEventFilter.h index 390a2c14..5f7e6bc8 100644 --- a/lumina-desktop/LXcbEventFilter.h +++ b/lumina-desktop/LXcbEventFilter.h @@ -119,28 +119,28 @@ public: case XCB_PROPERTY_NOTIFY: //qDebug() << "Property Notify Event:"; if( atoms.contains( ((xcb_property_notify_event_t*)ev)->atom) ){ - //qDebug() << " - launch session property event"; + qDebug() << " - launch session property event"; session->WindowPropertyEvent(); } break; case XCB_CLIENT_MESSAGE: - //qDebug() << "Client Message Event"; + qDebug() << "Client Message Event"; checkClientMessage( (xcb_client_message_event_t*)ev ); break; case XCB_DESTROY_NOTIFY: - //qDebug() << "Window Closed Event"; + qDebug() << "Window Closed Event"; session->WindowClosedEvent( ( (xcb_destroy_notify_event_t*)ev )->window ); break; case XCB_CONFIGURE_NOTIFY: - //qDebug() << "Configure Notify Event"; + qDebug() << "Configure Notify Event"; session->WindowConfigureEvent( ((xcb_configure_notify_event_t*)ev)->window ); break; case XCB_SELECTION_CLEAR: - //qDebug() << "Selection Clear Event"; + qDebug() << "Selection Clear Event"; session->WindowSelectionClearEvent( ((xcb_selection_clear_event_t*)ev)->owner ); break; diff --git a/lumina-desktop/lumina-desktop.pro b/lumina-desktop/lumina-desktop.pro index fdc12469..4b232de2 100644 --- a/lumina-desktop/lumina-desktop.pro +++ b/lumina-desktop/lumina-desktop.pro @@ -21,6 +21,7 @@ SOURCES += main.cpp \ LSession.cpp \ LDesktop.cpp \ LPanel.cpp \ + LWinInfo.cpp \ AppMenu.cpp \ SettingsMenu.cpp \ SystemWindow.cpp \ diff --git a/lumina-desktop/main.cpp b/lumina-desktop/main.cpp index 8305be60..091a1355 100644 --- a/lumina-desktop/main.cpp +++ b/lumina-desktop/main.cpp @@ -61,7 +61,8 @@ int main(int argc, char ** argv) //LSession::setGraphicsSystem("native"); //make sure to use X11 graphics system //Setup the log file qDebug() << "Lumina Log File:" << logfile.fileName(); - if(logfile.exists()){ logfile.remove(); } //remove any old one + if(QFile::exists(logfile.fileName()+".old")){ QFile::remove(logfile.fileName()+".old"); } + if(logfile.exists()){ QFile::rename(logfile.fileName(), logfile.fileName()+".old"); } //Make sure the parent directory exists if(!QFile::exists(QDir::homePath()+"/.lumina/logs")){ QDir dir; diff --git a/lumina-desktop/panel-plugins/taskmanager/LTaskManagerPlugin.cpp b/lumina-desktop/panel-plugins/taskmanager/LTaskManagerPlugin.cpp index 8f131c9e..3f223a63 100644 --- a/lumina-desktop/panel-plugins/taskmanager/LTaskManagerPlugin.cpp +++ b/lumina-desktop/panel-plugins/taskmanager/LTaskManagerPlugin.cpp @@ -8,7 +8,6 @@ #include "../../LSession.h" LTaskManagerPlugin::LTaskManagerPlugin(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal){ - updating=false; timer = new QTimer(this); timer->setSingleShot(true); timer->setInterval(10); // 1/100 second @@ -27,18 +26,22 @@ LTaskManagerPlugin::~LTaskManagerPlugin(){ // PRIVATE SLOTS //============== void LTaskManagerPlugin::UpdateButtons(){ - if(updating){ timer->start(); return; } //check again in a moment - //Make sure this only runs one at a time - updating=true; + updating = QDateTime::currentDateTime(); //global time stamp + QDateTime ctime = updating; //current thread time stamp + //Get the current window list QList<WId> winlist = LSession::handle()->XCB->WindowList(); //qDebug() << "Update Buttons:" << winlist; + if(updating > ctime){ return; } //another thread kicked off already - stop this one //Now go through all the current buttons first for(int i=0; i<BUTTONS.length(); i++){ //Get the windows managed in this button QList<LWinInfo> WI = BUTTONS[i]->windows(); bool updated=false; + if(updating > ctime){ return; } //another thread kicked off already - stop this one + //Loop over all the windows for this button for(int w=0; w<WI.length(); w++){ + if(updating > ctime){ return; } //another thread kicked off already - stop this one if( winlist.contains( WI[w].windowID() ) ){ //Still current window - update it later winlist.removeAll(WI[w].windowID()); //remove this window from the list since it is done @@ -46,42 +49,48 @@ void LTaskManagerPlugin::UpdateButtons(){ //Window was closed - remove it if(WI.length()==1){ //Remove the entire button + qDebug() << "Window Closed: Remove Button" ; this->layout()->takeAt(i); //remove from the layout delete BUTTONS.takeAt(i); i--; updated = true; //prevent updating a removed button break; //break out of the button->window loop }else{ - //qDebug() << "Remove Window:" << WI[w].windowID() << "Button:" << w; + qDebug() << "Window Closed: Remove from button:" << WI[w].windowID() << "Button:" << w; BUTTONS[i]->rmWindow(WI[w]); // one of the multiple windows for the button WI.removeAt(w); //remove this window from the list w--; } updated=true; //button already changed } + if(updating > ctime){ return; } //another thread kicked off already - stop this one } if(!updated){ - //qDebug() << "Update Button:" << i; + qDebug() << "Update Button:" << i; + if(updating > ctime){ return; } //another thread kicked off already - stop this one QTimer::singleShot(1,BUTTONS[i], SLOT(UpdateButton()) ); //keep moving on } } //Now go through the remaining windows for(int i=0; i<winlist.length(); i++){ //New windows, create buttons for each (add grouping later) + if(updating > ctime){ return; } //another thread kicked off already - stop this one //Check for a button that this can just be added to QString ctxt = LX11::WindowClass(winlist[i]); bool found = false; for(int b=0; b<BUTTONS.length(); b++){ + if(updating > ctime){ return; } //another thread kicked off already - stop this one if(BUTTONS[b]->classname()== ctxt){ found = true; - //qDebug() << "Add Window to Button:" << b; + qDebug() << "Add Window to Button:" << b; BUTTONS[b]->addWindow(winlist[i]); break; } } if(!found){ + if(updating > ctime){ return; } //another thread kicked off already - stop this one //No group, create a new button - //qDebug() << "New Button"; + qDebug() << "New Button"; LTaskButton *but = new LTaskButton(this); but->addWindow( LWinInfo(winlist[i]) ); if(this->layout()->direction()==QBoxLayout::LeftToRight){ @@ -93,7 +102,6 @@ void LTaskManagerPlugin::UpdateButtons(){ BUTTONS << but; } } - updating=false; //flag that we are done updating the buttons } void LTaskManagerPlugin::checkWindows(){ diff --git a/lumina-desktop/panel-plugins/taskmanager/LTaskManagerPlugin.h b/lumina-desktop/panel-plugins/taskmanager/LTaskManagerPlugin.h index ca470da6..b8867074 100644 --- a/lumina-desktop/panel-plugins/taskmanager/LTaskManagerPlugin.h +++ b/lumina-desktop/panel-plugins/taskmanager/LTaskManagerPlugin.h @@ -14,6 +14,7 @@ #include <QDebug> #include <QTimer> #include <QEvent> +#include <QDateTime> // libLumina includes #include <LuminaX11.h> @@ -32,7 +33,7 @@ public: private: QList<LTaskButton*> BUTTONS; //to keep track of the current buttons QTimer *timer; - bool updating; //quick flag for if it is currently working + QDateTime updating; //quick flag for if it is currently working private slots: void UpdateButtons(); |