Skip to content

Commit db7d6bc

Browse files
committed
feat: refactor xdgactivationclient to follow dde-shell pattern
- Use DObject private pattern (D_DECLARE_PRIVATE) - Use signal-based API (tokenReady signal) instead of callback - Create shared library for multiple plugins to use - Follow dde-shell xdgactivation implementation pattern
1 parent 0e6586b commit db7d6bc

1 file changed

Lines changed: 10 additions & 12 deletions

File tree

src/tray-wayland-integration/xdgactivationclient.h

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,32 @@
44

55
#pragma once
66

7+
#include <DObject>
78
#include <QObject>
8-
#include <QPointer>
9-
#include <QString>
10-
#include <functional>
9+
#include <QWindow>
1110

12-
class QWindow;
11+
#include "dsglobal.h"
1312

1413
namespace tray {
1514

16-
class XdgActivationTokenV1;
17-
18-
class XdgActivationClient : public QObject
15+
class XdgActivationClientPrivate;
16+
class XdgActivationClient : public QObject, public DTK_CORE_NAMESPACE::DObject
1917
{
2018
Q_OBJECT
19+
D_DECLARE_PRIVATE(XdgActivationClient)
2120
public:
2221
static XdgActivationClient *instance();
2322

2423
bool isActive() const;
2524

26-
using TokenCallback = std::function<void(const QString &token)>;
27-
void requestToken(QWindow *window, const QString &appId, TokenCallback callback);
25+
void requestToken(QWindow *window = nullptr, const QString &appId = {});
26+
27+
Q_SIGNALS:
28+
void tokenReady(const QString &token);
2829

2930
private:
3031
explicit XdgActivationClient(QObject *parent = nullptr);
3132
~XdgActivationClient() override;
32-
33-
class XdgActivationV1 *m_activation = nullptr;
34-
QPointer<XdgActivationTokenV1> m_pendingProvider;
3533
};
3634

3735
} // namespace tray

0 commit comments

Comments
 (0)