1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QTX11EXTRAS_P_H
5#define QTX11EXTRAS_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtGui/qtguiglobal.h>
19#include <QtCore/private/qglobal_p.h>
20
21#include <xcb/xcb.h>
22
23typedef struct _XDisplay Display;
24
25QT_BEGIN_NAMESPACE
26
27class Q_GUI_EXPORT QX11Info
28{
29public:
30 enum PeekOption {
31 PeekDefault = 0,
32 PeekFromCachedIndex = 1
33 };
34 Q_DECLARE_FLAGS(PeekOptions, PeekOption)
35
36 static bool isPlatformX11();
37
38 static int appDpiX(int screen=-1);
39 static int appDpiY(int screen=-1);
40
41 static quint32 appRootWindow(int screen=-1);
42 static int appScreen();
43
44 static quint32 appTime();
45 static quint32 appUserTime();
46
47 static void setAppTime(quint32 time);
48 static void setAppUserTime(quint32 time);
49
50 static quint32 getTimestamp();
51
52 static QByteArray nextStartupId();
53 static void setNextStartupId(const QByteArray &id);
54
55 static Display *display();
56 static xcb_connection_t *connection();
57
58 static bool isCompositingManagerRunning(int screen = -1);
59
60 static qint32 generatePeekerId();
61 static bool removePeekerId(qint32 peekerId);
62 typedef bool (*PeekerCallback)(xcb_generic_event_t *event, void *peekerData);
63 static bool peekEventQueue(PeekerCallback peeker, void *peekerData = nullptr,
64 PeekOptions option = PeekDefault, qint32 peekerId = -1);
65
66private:
67 QX11Info();
68};
69
70Q_DECLARE_OPERATORS_FOR_FLAGS(QX11Info::PeekOptions)
71
72QT_END_NAMESPACE
73
74#endif // QTX11EXTRAS_P_H
75
76

source code of qtbase/src/gui/platform/unix/qtx11extras_p.h