Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qvncintegration.cpp
Go to the documentation of this file.
1
// Copyright (C) 2017 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
#
include
"qvncintegration.h"
5
#
include
"qvncscreen.h"
6
#
include
"qvnc_p.h"
7
8
#
include
<
QtGui
/
private
/
qgenericunixfontdatabase_p
.
h
>
9
#
include
<
QtGui
/
private
/
qdesktopunixservices_p
.
h
>
10
#
include
<
QtGui
/
private
/
qgenericunixeventdispatcher_p
.
h
>
11
12
#
include
<
QtFbSupport
/
private
/
qfbbackingstore_p
.
h
>
13
#
include
<
QtFbSupport
/
private
/
qfbwindow_p
.
h
>
14
#
include
<
QtFbSupport
/
private
/
qfbcursor_p
.
h
>
15
16
#
include
<
QtGui
/
private
/
qguiapplication_p
.
h
>
17
#
include
<
qpa
/
qplatforminputcontextfactory_p
.
h
>
18
#
include
<
private
/
qinputdevicemanager_p_p
.
h
>
19
#
include
<
qpa
/
qwindowsysteminterface
.
h
>
20
21
#
include
<
QtCore
/
QRegularExpression
>
22
23
QT_BEGIN_NAMESPACE
24
25
using
namespace
Qt::StringLiterals;
26
27
QVncIntegration
::
QVncIntegration
(
const
QStringList ¶mList)
28
: m_fontDb(
new
QGenericUnixFontDatabase)
29
{
30
QRegularExpression portRx(
"port=(\\d+)"_L1
);
31
quint16 port = 5900;
32
for
(
const
QString &arg : paramList) {
33
QRegularExpressionMatch match;
34
if
(arg.contains(portRx, &match))
35
port = match.captured(1).toInt();
36
}
37
38
m_primaryScreen =
new
QVncScreen(paramList);
39
m_server =
new
QVncServer(m_primaryScreen, port);
40
m_primaryScreen->vncServer = m_server;
41
}
42
43
QVncIntegration::~QVncIntegration()
44
{
45
delete
m_server;
46
QWindowSystemInterface::handleScreenRemoved(m_primaryScreen);
47
}
48
49
void
QVncIntegration::initialize()
50
{
51
if
(m_primaryScreen->initialize())
52
QWindowSystemInterface::handleScreenAdded(m_primaryScreen);
53
else
54
qWarning(
"vnc: Failed to initialize screen"
);
55
56
m_inputContext = QPlatformInputContextFactory::create();
57
58
m_nativeInterface.reset(
new
QPlatformNativeInterface);
59
60
// we always have exactly one mouse and keyboard
61
QInputDeviceManagerPrivate::get(QGuiApplicationPrivate::inputDeviceManager())->setDeviceCount(
62
QInputDeviceManager::DeviceTypePointer, 1);
63
QInputDeviceManagerPrivate::get(QGuiApplicationPrivate::inputDeviceManager())->setDeviceCount(
64
QInputDeviceManager::DeviceTypeKeyboard, 1);
65
66
}
67
68
bool
QVncIntegration::hasCapability(QPlatformIntegration::Capability cap)
const
69
{
70
switch
(cap) {
71
case
ThreadedPixmaps:
return
true
;
72
case
WindowManagement:
return
false
;
73
case
RhiBasedRendering:
return
false
;
74
default
:
return
QPlatformIntegration::hasCapability(cap);
75
}
76
}
77
78
QPlatformBackingStore *QVncIntegration::createPlatformBackingStore(QWindow *window)
const
79
{
80
return
new
QFbBackingStore(window);
81
}
82
83
QPlatformWindow *QVncIntegration::createPlatformWindow(QWindow *window)
const
84
{
85
return
new
QFbWindow(window);
86
}
87
88
QAbstractEventDispatcher *QVncIntegration::createEventDispatcher()
const
89
{
90
return
createUnixEventDispatcher();
91
}
92
93
QList<QPlatformScreen *> QVncIntegration::screens()
const
94
{
95
QList<QPlatformScreen *> list;
96
list.append(m_primaryScreen);
97
return
list;
98
}
99
100
QPlatformFontDatabase *QVncIntegration::fontDatabase()
const
101
{
102
return
m_fontDb.data();
103
}
104
105
QPlatformServices *QVncIntegration::services()
const
106
{
107
if
(m_services.isNull())
108
m_services.reset(
new
QDesktopUnixServices);
109
110
return
m_services.data();
111
}
112
113
QPlatformNativeInterface *QVncIntegration::nativeInterface()
const
114
{
115
return
m_nativeInterface.data();
116
}
117
118
QT_END_NAMESPACE
QVncIntegration
Definition
qvncintegration.h:17
QVncIntegration::QVncIntegration
QVncIntegration(const QStringList ¶mList)
Definition
qvncintegration.cpp:27
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtbase
src
plugins
platforms
vnc
qvncintegration.cpp
Generated on
for Qt by
1.18.0