Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ find_package(ICU 74.2 REQUIRED COMPONENTS uc i18n io)
find_package(WaylandProtocols REQUIRED)
find_package(PkgConfig REQUIRED)

# Check if dde-api provides EventLogger (header-only)
find_package(DDEAPI QUIET)
if(DDEAPI_FOUND)
set(HAVE_DDE_API_EVENTLOGGER ON)
message(STATUS "Found DDEAPI: EventLogger available")
else()
message(STATUS "DDEAPI not found, event logging will be disabled")
endif()

qt_policy(SET QTP0001 NEW)

try_compile(COMPILE_RESULT
Expand Down
1 change: 1 addition & 0 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Build-Depends:
debhelper-compat (= 13),
cmake,
dde-application-manager-api (>= 1.2.48),
dde-api-dev (>> 6.0.39),
dde-tray-loader-dev (> 2.0.24),
extra-cmake-modules,
libdtk6core-bin,
Expand Down
5 changes: 5 additions & 0 deletions panels/dock/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ target_link_libraries(dockpanel PRIVATE
dde-shell-dock
)

if (HAVE_DDE_API_EVENTLOGGER)
target_compile_definitions(dockpanel PRIVATE HAVE_DDE_API_EVENTLOGGER)
target_link_libraries(dockpanel PRIVATE DDEAPI::EventLogger)
endif()

if (BUILD_WITH_X11)
target_compile_definitions(dockpanel PRIVATE BUILD_WITH_X11=)
pkg_check_modules(XCB REQUIRED IMPORTED_TARGET xcb xcb-aux xcb-res xcb-ewmh)
Expand Down
49 changes: 48 additions & 1 deletion panels/dock/dockdbusproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,21 @@
#include "dockpanel.h"
#include "dockdbusproxy.h"

#include <QObject>

Check warning on line 11 in panels/dock/dockdbusproxy.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QObject> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QJsonObject>

Check warning on line 12 in panels/dock/dockdbusproxy.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QJsonObject> not found. Please note: Cppcheck does not need standard library headers to get proper results.

#ifdef HAVE_DDE_API_EVENTLOGGER
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
#include <dde-api/eventlogger.hpp>

Check warning on line 15 in panels/dock/dockdbusproxy.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <dde-api/eventlogger.hpp> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#endif

#include <DWindowManagerHelper>

Check warning on line 18 in panels/dock/dockdbusproxy.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <DWindowManagerHelper> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <appletbridge.h>

Check warning on line 19 in panels/dock/dockdbusproxy.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <appletbridge.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.

DGUI_USE_NAMESPACE
DS_USE_NAMESPACE
namespace {
constexpr auto DockVersionV1 = "1.0";
constexpr qint64 EVENT_LOGGER_TRAY_PLUGIN_LIST = 1000610007;

QList<DS_NAMESPACE::DAppletDock *> dockApplets(dock::DockPanel *panel)
{
Expand Down Expand Up @@ -75,6 +81,9 @@
timer->stop();
timer->deleteLater();
connect(m_trayApplet, SIGNAL(pluginsChanged()), this, SIGNAL(pluginsChanged()));
QTimer::singleShot(3000, this, [this]() {
logInitialPluginState();
});
}
});
timer->start();
Expand Down Expand Up @@ -255,6 +264,43 @@
return iteminfos;
}

void DockDBusProxy::logInitialPluginState()
{
QStringList visibleItemKeys;
for (const auto &info : plugins()) {
if (info.visible) {
visibleItemKeys.append(info.itemKey);
}
}

#ifdef HAVE_DDE_API_EVENTLOGGER
DDE_EventLogger::EventLogger::instance().writeEventLog(
DDE_EventLogger::EventLoggerData(EVENT_LOGGER_TRAY_PLUGIN_LIST, QStringLiteral("dock_init"), {
{QStringLiteral("tray_plugin_list"), visibleItemKeys.join(QStringLiteral(","))}
}));
#endif
}

void DockDBusProxy::logCurrentVisiblePluginList(const QString &changedItemKey, bool changedVisible)
Comment thread
Ivy233 marked this conversation as resolved.
{
QStringList visibleItemKeys;
for (const auto &info : plugins()) {
if (info.itemKey == changedItemKey) {
if (changedVisible)
visibleItemKeys.append(info.itemKey);
} else if (info.visible) {
visibleItemKeys.append(info.itemKey);
}
}

#ifdef HAVE_DDE_API_EVENTLOGGER
DDE_EventLogger::EventLogger::instance().writeEventLog(
DDE_EventLogger::EventLoggerData(EVENT_LOGGER_TRAY_PLUGIN_LIST, QStringLiteral("dock_plugins_changed"), {
{QStringLiteral("tray_plugin_list"), visibleItemKeys.join(QStringLiteral(","))}
}));
#endif
}

void DockDBusProxy::ReloadPlugins()
{
parent()->ReloadPlugins();
Expand All @@ -274,13 +320,15 @@
pluginsVisible[itemKey] = visible;
DockSettings::instance()->setPluginsVisible(pluginsVisible);
Q_EMIT pluginVisibleChanged(itemKey, visible);
logCurrentVisiblePluginList(itemKey, visible);
return;
}
}

if (m_trayApplet) {
Q_EMIT pluginVisibleChanged(itemKey, visible);
QMetaObject::invokeMethod(m_trayApplet, "setItemOnDock", Qt::QueuedConnection, settingKey, itemKey, visible);
logCurrentVisiblePluginList(itemKey, visible);
}
}

Expand Down Expand Up @@ -340,4 +388,3 @@
}

}

4 changes: 3 additions & 1 deletion panels/dock/dockdbusproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@

#include <appletproxy.h>

#include <QObject>

Check warning on line 15 in panels/dock/dockdbusproxy.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QObject> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QDBusContext>

Check warning on line 16 in panels/dock/dockdbusproxy.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QDBusContext> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QDBusArgument>

Check warning on line 17 in panels/dock/dockdbusproxy.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QDBusArgument> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QTimer>

Check warning on line 18 in panels/dock/dockdbusproxy.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QTimer> not found. Please note: Cppcheck does not need standard library headers to get proper results.

/** this class used for old dock api compatible
* it will forward old dbus call to new implementation
Expand Down Expand Up @@ -88,9 +89,10 @@
DockPanel* parent() const;
QString getAppID(const QString &desktopfile);
void updateDockPluginsVisible(const QVariantMap &pluginsVisible);
void logInitialPluginState();
void logCurrentVisiblePluginList(const QString &changedItemKey = QString(), bool changedVisible = true);

DS_NAMESPACE::DAppletProxy *m_oldDockApplet;
DS_NAMESPACE::DAppletProxy *m_trayApplet;
};
}

6 changes: 5 additions & 1 deletion panels/dock/dockpanel.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand All @@ -21,9 +21,13 @@
#include <QQuickWindow>
#include <QLoggingCategory>
#include <QGuiApplication>
#include <QQuickItem>

Check warning on line 24 in panels/dock/dockpanel.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QQuickItem> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <DGuiApplicationHelper>

#ifdef HAVE_DDE_API_EVENTLOGGER
#include <dde-api/eventlogger.hpp>
#endif

#define SETTINGS DockSettings::instance()

Q_LOGGING_CATEGORY(dockLog, "org.deepin.dde.shell.dock")
Expand Down
31 changes: 30 additions & 1 deletion panels/dock/docksettings.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand All @@ -9,6 +9,14 @@
#include <QTimer>
#include <QLoggingCategory>

#include <QJsonObject>
#ifdef HAVE_DDE_API_EVENTLOGGER
#include <dde-api/eventlogger.hpp>
#endif

// Event IDs for dock settings (10-digit numbers)
constexpr qint64 EVENT_LOGGER_DOCK_CONFIG = 1000610006;

Q_LOGGING_CATEGORY(dockSettingsLog, "org.deepin.dde.shell.dock.docksettings")

const static QString keyPosition = "Position";
Expand Down Expand Up @@ -82,6 +90,21 @@ static QString itemAlignment2String(const ItemAlignment& alignment)
return "center";
}

void DockSettings::logDockConfig(std::optional<Position> pos, std::optional<ItemAlignment> align, const QString &reason) const
{
QJsonObject payload;
if (pos)
payload.insert(QStringLiteral("shell_pos"), position2String(*pos));
if (align)
payload.insert(QStringLiteral("shell_dock_mode"), itemAlignment2String(*align));

#ifdef HAVE_DDE_API_EVENTLOGGER
DDE_EventLogger::EventLogger::instance().writeEventLog(
DDE_EventLogger::EventLoggerData(EVENT_LOGGER_DOCK_CONFIG, QStringLiteral("dock_config"), payload));
#endif
qCInfo(dockSettingsLog) << "EventLogger: dock config" << reason << payload;
}

static ItemAlignment string2ItenAlignment(const QString& alignmentStr)
{
if (alignmentStr == "left")
Expand Down Expand Up @@ -136,6 +159,7 @@ DockSettings::DockSettings(QObject* parent)
{
m_writeTimer->setSingleShot(true);
m_writeTimer->setInterval(1000);
qCInfo(dockSettingsLog) << "EventLogger initialized";
init();
}

Expand All @@ -151,6 +175,9 @@ void DockSettings::init()
m_showInPrimary = m_dockConfig->value(keyShowInPrimary).toBool();
m_locked = m_dockConfig->value(keyLocked).toBool();

// Log dock config on startup - merge shell_pos and shell_dock_mode into one log entry
logDockConfig(m_dockPosition, m_alignment, QStringLiteral("on startup"));

connect(m_dockConfig.data(), &DConfig::valueChanged, this, [this](const QString& key){
if (keyDockSize == key) {
auto size = m_dockConfig->value(keyDockSize).toUInt();
Expand Down Expand Up @@ -237,6 +264,7 @@ void DockSettings::setPosition(const Position& position)
m_dockPosition = position;
Q_EMIT positionChanged(m_dockPosition);
addWriteJob(positionJob);
logDockConfig(position, std::nullopt, QStringLiteral("position changed"));
}

ItemAlignment DockSettings::itemAlignment()
Expand All @@ -251,6 +279,7 @@ void DockSettings::setItemAlignment(const ItemAlignment& alignment)
m_alignment = alignment;
Q_EMIT itemAlignmentChanged(m_alignment);
addWriteJob(itemAlignmentJob);
logDockConfig(std::nullopt, alignment, QStringLiteral("itemAlignment changed"));
}

IndicatorStyle DockSettings::indicatorStyle()
Expand Down
4 changes: 3 additions & 1 deletion panels/dock/docksettings.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand All @@ -10,6 +10,7 @@
#include <QObject>
#include <DConfig>
#include <QScopedPointer>
#include <optional>

DCORE_USE_NAMESPACE

Expand Down Expand Up @@ -62,6 +63,7 @@ class DockSettings : public QObject
void init();

void addWriteJob(WriteJob job);
void logDockConfig(std::optional<Position> pos, std::optional<ItemAlignment> align, const QString &reason) const;
inline void checkWriteJob();

Q_SIGNALS:
Expand Down
5 changes: 5 additions & 0 deletions panels/dock/multitaskview/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ target_link_libraries(dock-multitaskview PRIVATE
dde-shell-dock
)

if (HAVE_DDE_API_EVENTLOGGER)
target_compile_definitions(dock-multitaskview PRIVATE HAVE_DDE_API_EVENTLOGGER)
target_link_libraries(dock-multitaskview PRIVATE DDEAPI::EventLogger)
endif()

ds_install_package(PACKAGE org.deepin.ds.dock.multitaskview TARGET dock-multitaskview)
ds_handle_package_translation(PACKAGE org.deepin.ds.dock.multitaskview)

Expand Down
31 changes: 31 additions & 0 deletions panels/dock/multitaskview/multitaskview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,26 @@
#include "../constants.h"

#include <QBuffer>
#include <QProcess>

#include <DDciIcon>
#include <DDBusSender>
#include <DWindowManagerHelper>
#include <DGuiApplicationHelper>

#ifdef HAVE_DDE_API_EVENTLOGGER
#include <dde-api/eventlogger.hpp>
#endif

DGUI_USE_NAMESPACE
DCORE_USE_NAMESPACE

namespace {
constexpr qint64 EVENT_LOGGER_KWIN_MULTITASK_VIEW = 1000300000;
constexpr int EventLaunchTypeDockIcon = 2;

}

namespace dock {

constexpr int KWinOptimalPerformance = 4;
Expand Down Expand Up @@ -50,12 +61,32 @@ MultiTaskView::MultiTaskView(QObject *parent)
bool MultiTaskView::init()
{
setSupported(m_kWinEffect && DWindowManagerHelper::instance()->hasComposite());
queryKwinVersion();
DAppletDock::init();
return true;
}

void MultiTaskView::queryKwinVersion()
{
auto *process = new QProcess(this);
process->start(QStringLiteral("dpkg-query"), { QStringLiteral("-W"), QStringLiteral("-f=${Version}"), QStringLiteral("kwin-x11") });
connect(process, &QProcess::finished, this, [this, process](int exitCode, QProcess::ExitStatus status) {
if (status == QProcess::NormalExit && exitCode == 0) {
m_kwinVersion = QString::fromLocal8Bit(process->readAllStandardOutput()).trimmed();
}
process->deleteLater();
});
}

void MultiTaskView::openWorkspace()
{
#ifdef HAVE_DDE_API_EVENTLOGGER
DDE_EventLogger::EventLogger::instance().writeEventLog(
DDE_EventLogger::EventLoggerData(EVENT_LOGGER_KWIN_MULTITASK_VIEW, QStringLiteral("kwin_multitask_view"), {
{QStringLiteral("launch_type"), EventLaunchTypeDockIcon},
{QStringLiteral("kwin_version"), m_kwinVersion}
}));
#endif
if (m_multitaskview) {
m_multitaskview->toggle();
return;
Expand Down
2 changes: 2 additions & 0 deletions panels/dock/multitaskview/multitaskview.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ class MultiTaskView : public DS_NAMESPACE::DAppletDock
void iconNameChanged();

private:
void queryKwinVersion();
bool m_kWinEffect = true;
QString m_kwinVersion;
QString m_iconName;
QScopedPointer<TreeLandMultitaskview> m_multitaskview;
Dtk::Core::DConfig *m_kWinCompositingConfig = nullptr;
Expand Down
7 changes: 6 additions & 1 deletion panels/dock/taskmanager/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
# SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd.
#
# SPDX-License-Identifier: GPL-3.0-or-later

Expand Down Expand Up @@ -102,6 +102,11 @@ target_link_libraries(dock-taskmanager PRIVATE
PkgConfig::WaylandClient
)

if (HAVE_DDE_API_EVENTLOGGER)
target_compile_definitions(dock-taskmanager PRIVATE HAVE_DDE_API_EVENTLOGGER)
target_link_libraries(dock-taskmanager PRIVATE DDEAPI::EventLogger)
endif()

if (BUILD_WITH_X11)
target_compile_definitions(dock-taskmanager PRIVATE BUILD_WITH_X11=)
pkg_check_modules(TaskmanagerXcb REQUIRED IMPORTED_TARGET xcb xcb-res xcb-ewmh xcb-icccm)
Expand Down
6 changes: 6 additions & 0 deletions panels/dock/taskmanager/taskmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
#include "textcalculator.h"
#include "treelandwindowmonitor.h"

#ifdef HAVE_DDE_API_EVENTLOGGER
#include <dde-api/eventlogger.hpp>
#endif

#include <QGuiApplication>
#include <QProcess>
#include <QStandardPaths>
Expand Down Expand Up @@ -170,6 +174,8 @@ bool TaskManager::load()

bool TaskManager::init()
{
Settings->logMergeAppModel(!Settings->isWindowSplit());

auto adaptor = new TaskManagerAdaptor(this);
Q_UNUSED(adaptor)
QDBusConnection::sessionBus().registerService("org.deepin.ds.Dock.TaskManager");
Expand Down
Loading
Loading