Skip to content

Commit

Permalink
fix: dock item empty icon caused by window icon is empty
Browse files Browse the repository at this point in the history
log: as title
  • Loading branch information
tsic404 authored and deepin-bot[bot] committed Nov 7, 2024
1 parent d7ffcba commit 3fd3c0e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion panels/dock/taskmanager/appitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ QString AppItem::type() const

QString AppItem::icon() const
{
if (m_currentActiveWindow.isNull() || (m_desktopfileParser && m_desktopfileParser->isValied().first))
if (m_currentActiveWindow.isNull() || m_currentActiveWindow->icon().isEmpty() || (m_desktopfileParser && m_desktopfileParser->isValied().first))
return m_desktopfileParser ? m_desktopfileParser->desktopIcon() : "application-default-icon";
else {
return m_currentActiveWindow->icon();
Expand Down
6 changes: 5 additions & 1 deletion panels/dock/taskmanager/taskmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,11 @@ void TaskManager::handleWindowAdded(QPointer<AbstractWindow> window)
}

if (desktopfile.isNull() || !desktopfile->isValied().first) {
desktopfile = DESKTOPFILEFACTORY::createByWindow(window);
if (res.size() > 0) {
desktopfile = DESKTOPFILEFACTORY::createById(res.first().data(m_activeAppModel->roleNames().key("desktopId")).toString(), "asbtractAPP");
} else {
desktopfile = DESKTOPFILEFACTORY::createByWindow(window);
}
}

auto appitem = desktopfile->getAppItem();
Expand Down
8 changes: 5 additions & 3 deletions panels/dock/taskmanager/x11window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ QStringList X11Window::identity()
{
if (m_identity.isEmpty()) {
m_identity = X11->getWindowWMClass(m_windowID);
m_identity.append(QString::number(pid()));
}

return m_identity;
Expand Down Expand Up @@ -167,11 +168,12 @@ void X11Window::updatePid()

void X11Window::updateIdentify()
{
auto newWmclas = X11->getWindowWMClass(m_windowID);
if (newWmclas == m_identity)
auto newWMclass = X11->getWindowWMClass(m_windowID);
newWMclass.append(QString::number(pid()));
if (newWMclass == m_identity)
return;

m_identity = newWmclas;
m_identity = newWMclass;
Q_EMIT identityChanged();
}

Expand Down
6 changes: 3 additions & 3 deletions panels/dock/taskmanager/x11windowmonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ X11WindowMonitor::X11WindowMonitor(QObject* parent)
{
monitor = this;
connect(this, &X11WindowMonitor::windowMapped, this, &X11WindowMonitor::onWindowMapped);
connect(this, &X11WindowMonitor::windowDestoried, this, &X11WindowMonitor::onWindowDestoried);
connect(this, &X11WindowMonitor::windowDestroyed, this, &X11WindowMonitor::onWindowDestroyed);
connect(this, &X11WindowMonitor::windowPropertyChanged, this, &X11WindowMonitor::onWindowPropertyChanged);
}

Expand Down Expand Up @@ -155,7 +155,7 @@ void X11WindowMonitor::onWindowMapped(xcb_window_t xcb_window)
Q_EMIT AbstractWindowMonitor::windowAdded(static_cast<QPointer<AbstractWindow>>(window.get()));
}

void X11WindowMonitor::onWindowDestoried(xcb_window_t xcb_window)
void X11WindowMonitor::onWindowDestroyed(xcb_window_t xcb_window)
{
auto window = m_windows.value(xcb_window, nullptr);
if (window) {
Expand Down Expand Up @@ -219,7 +219,7 @@ void X11WindowMonitor::handleRootWindowClientListChanged()

for (auto alreadyOpenedWindow : m_windows.keys()) {
if (!currentOpenedWindowList.contains(alreadyOpenedWindow)) {
windowDestoried(alreadyOpenedWindow);
Q_EMIT windowDestroyed(alreadyOpenedWindow);
}
}

Expand Down
4 changes: 2 additions & 2 deletions panels/dock/taskmanager/x11windowmonitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ class X11WindowMonitor : public AbstractWindowMonitor

Q_SIGNALS:
void windowMapped(xcb_window_t window);
void windowDestoried(xcb_window_t window);
void windowDestroyed(xcb_window_t window);
void windowPropertyChanged(xcb_window_t window, xcb_atom_t atom);

private Q_SLOTS:
void onWindowMapped(xcb_window_t window);
void onWindowDestoried(xcb_window_t window);
void onWindowDestroyed(xcb_window_t window);
void onWindowPropertyChanged(xcb_window_t window, xcb_atom_t atom);

private:
Expand Down

0 comments on commit 3fd3c0e

Please sign in to comment.