diff options
author | Ken Moore <moorekou@gmail.com> | 2020-04-06 15:46:17 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2020-04-06 15:46:17 -0400 |
commit | 682e844ab0ef47a9f50bbca95c86f9e6d28a4f82 (patch) | |
tree | 9b84d44cf3a2be3b96708501a3fd2010d028ab1e /src-qt5/core | |
parent | Limit lumina-pingcursor to 60 FPS (diff) | |
download | lumina-682e844ab0ef47a9f50bbca95c86f9e6d28a4f82.tar.gz lumina-682e844ab0ef47a9f50bbca95c86f9e6d28a4f82.tar.bz2 lumina-682e844ab0ef47a9f50bbca95c86f9e6d28a4f82.zip |
Fix up the detection of icons for windows.
Add another layer of fallback icon as well
Diffstat (limited to 'src-qt5/core')
3 files changed, 16 insertions, 12 deletions
diff --git a/src-qt5/core/lumina-desktop/LWinInfo.cpp b/src-qt5/core/lumina-desktop/LWinInfo.cpp index 6a6cea0b..6adde234 100644 --- a/src-qt5/core/lumina-desktop/LWinInfo.cpp +++ b/src-qt5/core/lumina-desktop/LWinInfo.cpp @@ -30,15 +30,18 @@ QIcon LWinInfo::icon(bool &noicon){ noicon = false; QIcon ico = LSession::handle()->XCB->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;} + if(ico.isNull()){ + QString cls = this->Class(); + ico = LXDG::findIcon( cls, cls.toLower()); + } + if(ico.isNull()){ico = LXDG::findIcon("window","preferences-system-windows"); noicon=true;} return ico; } - + QString LWinInfo::Class(){ return LSession::handle()->XCB->WindowClass(window); } - + LXCB::WINDOWVISIBILITY LWinInfo::status(bool update){ if(window==0){ return LXCB::IGNORE; } if(update || cstate == LXCB::IGNORE){ diff --git a/src-qt5/core/lumina-desktop/panel-plugins/taskmanager/LTaskButton.cpp b/src-qt5/core/lumina-desktop/panel-plugins/taskmanager/LTaskButton.cpp index 8f867261..67964c3f 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/taskmanager/LTaskButton.cpp +++ b/src-qt5/core/lumina-desktop/panel-plugins/taskmanager/LTaskButton.cpp @@ -21,6 +21,7 @@ LTaskButton::LTaskButton(QWidget *parent, bool smallDisplay) : LTBWidget(parent) this->setFocusPolicy(Qt::NoFocus); this->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); winMenu->setContextMenuPolicy(Qt::CustomContextMenu); + LWINLIST = 0; connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(openActionMenu()) ); connect(this, SIGNAL(clicked()), this, SLOT(buttonClicked()) ); connect(winMenu, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(openActionMenu()) ); @@ -84,8 +85,8 @@ LWinInfo LTaskButton::currentWindow(){ void LTaskButton::UpdateButton(){ if(winMenu->isVisible()){ return; } //skip this if the window menu is currently visible for now - bool statusOnly = (WINLIST.length() == LWINLIST.length()); - LWINLIST = WINLIST; + bool statusOnly = (WINLIST.length() == LWINLIST); + LWINLIST = WINLIST.length(); winMenu->clear(); LXCB::WINDOWVISIBILITY showstate = LXCB::IGNORE; @@ -95,7 +96,7 @@ void LTaskButton::UpdateButton(){ i--; continue; } - if(i==0 && !statusOnly){ + if(i==0 && (!statusOnly || noicon) ){ //Update the button visuals from the first window this->setIcon(WINLIST[i].icon(noicon)); cname = WINLIST[i].Class(); @@ -171,7 +172,7 @@ void LTaskButton::buttonClicked(){ if(WINLIST.length() > 1){ winMenu->popup(QCursor::pos()); }else{ - triggerWindow(); + triggerWindow(); } } @@ -189,7 +190,7 @@ void LTaskButton::maximizeWindow(){ LWinInfo win = currentWindow(); LSession::handle()->XCB->MaximizeWindow(win.windowID()); //LSession::handle()->adjustWindowGeom(win.windowID(), true); //run this for now until the WM works properly - cWin = LWinInfo(); //clear the current + cWin = LWinInfo(); //clear the current } void LTaskButton::minimizeWindow(){ @@ -197,7 +198,7 @@ void LTaskButton::minimizeWindow(){ if(winMenu->isVisible()){ winMenu->hide(); } LWinInfo win = currentWindow(); LSession::handle()->XCB->MinimizeWindow(win.windowID()); - cWin = LWinInfo(); //clear the current + cWin = LWinInfo(); //clear the current QTimer::singleShot(100, this, SLOT(UpdateButton()) ); //make sure to update this button if losing active status } @@ -244,7 +245,7 @@ void LTaskButton::winClicked(QAction* act){ //Get the window from the action if(act->data().toInt() < WINLIST.length()){ cWin = WINLIST[act->data().toInt()]; - cstate = cWin.status(); + cstate = cWin.status(); }else{ cWin = LWinInfo(); } //clear it //Now trigger the window triggerWindow(); diff --git a/src-qt5/core/lumina-desktop/panel-plugins/taskmanager/LTaskButton.h b/src-qt5/core/lumina-desktop/panel-plugins/taskmanager/LTaskButton.h index ff551998..3062bb74 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/taskmanager/LTaskButton.h +++ b/src-qt5/core/lumina-desktop/panel-plugins/taskmanager/LTaskButton.h @@ -42,7 +42,7 @@ public: private: QList<LWinInfo> WINLIST; - QList<LWinInfo> LWINLIST; + int LWINLIST; QMenu *actMenu; // action menu (custom context menu) QMenu *winMenu; // window menu (if more than 1) LWinInfo cWin; |