Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwaylandivishellintegration.cpp
Go to the documentation of this file.
1// Copyright (C) 2017 ITAGE Corporation, author: <yusuke.binsaki@itage.co.jp>
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:critical reason:network-protocol
4
6
7#include <QtCore/qsize.h>
8#include <QtCore/qdebug.h>
9
10#include <QtWaylandClient/private/qwaylanddisplay_p.h>
11#include <QtWaylandClient/private/qwaylandwindow_p.h>
12#include <QtWaylandClient/private/qwaylandabstractdecoration_p.h>
13
15
16#include <mutex>
17
18#include <unistd.h>
19
20QT_BEGIN_NAMESPACE
21
22namespace QtWaylandClient {
23
26{
27public:
29 void initialize() { QWaylandClientExtensionTemplate::initialize(); }
30};
31
36
43
44/* get unique id
45 * pattern1:
46 * When set QT_IVI_SURFACE_ID, We use it as ID.
47 * Next ID is increment.
48 * pattern2:
49 * When not set QT_IVI_SURFACE_ID, We use process ID and unused bit.
50 * process ID maximum is 2^22. Unused bit is 23 to 32 bit.
51 * Therefor, We use 23 to 32 bit. This do not overlap with other clients.
52 * Next ID is increment of 23 to 32 bit.
53 * +------------+---------------------------+
54 * |31 23|22 0|
55 * +------------+---------------------------+
56 * |0000 0000 00|00 0000 0000 0000 0000 0000|
57 * |<- ID ->|<- process ID ->|
58 * +------------+---------------------------+
59 */
61{
62 const uint32_t PID_MAX_EXPONENTIATION = 22; // 22 bit shift operation
63 const uint32_t ID_LIMIT = 1 << (32 - PID_MAX_EXPONENTIATION); // 10 bit is unique id
65
66 if (m_lastSurfaceId == 0) {
67 QByteArray env = qgetenv("QT_IVI_SURFACE_ID");
68 bool ok;
70 if (ok)
71 m_useEnvSurfaceId = true;
72 else
74
75 return m_lastSurfaceId;
76 }
77
80 } else {
83 qWarning("IVI surface id counter overflow\n");
84 return 0;
85 }
87 }
88
89 return m_lastSurfaceId;
90}
91
125
126}
127
128QT_END_NAMESPACE