blob: 67f82bb67360d15364878e80774ea3779e5d8543 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef WAYLANDXDGWATCHDOG_H
#define WAYLANDXDGWATCHDOG_H
#include <chrono>
#include <QtCore/QElapsedTimer>
#include <QtCore/QHash>
#include <QtCore/QObject>
#include <QtCore/QPointer>
#include <QtCore/QSet>
#include <QtCore/QTimer>
#include <QtAppManCommon/global.h>
QT_FORWARD_DECLARE_CLASS(QWaylandClient)
QT_FORWARD_DECLARE_CLASS(QWaylandCompositor)
QT_FORWARD_DECLARE_CLASS(QWaylandXdgShell)
QT_BEGIN_NAMESPACE_AM
class Application;
class WaylandXdgWatchdog : public QObject
{
Q_OBJECT
public:
explicit WaylandXdgWatchdog(QWaylandXdgShell *xdgShell);
void setTimeouts(std::chrono::milliseconds checkInterval, std::chrono::milliseconds warnTimeout,
std::chrono::milliseconds killTimeout);
private:
bool isClientWatchingEnabled() const;
void watchClient(QWaylandClient *client);
void pingClients();
void onPongWarnTimeout();
void onPongKillTimeout();
void onPongReceived(uint serial);
QPointer<QWaylandXdgShell> m_xdgShell;
std::chrono::milliseconds m_checkInterval { };
std::chrono::milliseconds m_warnTimeout { };
std::chrono::milliseconds m_killTimeout { };
QTimer m_pingTimer;
QTimer m_pongWarnTimer;
QTimer m_pongKillTimer;
QElapsedTimer m_lastPing;
struct ClientData {
QWaylandClient *m_client = nullptr;
uint m_pingSerial = 0;
QString m_description;
QList<Application *> m_apps;
bool m_hasDebugWrapper = false;
};
QList<ClientData *> m_clients;
};
QT_END_NAMESPACE_AM
#endif // WAYLANDXDGWATCHDOG_H
|