Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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/qgenericunixservices_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
24
25using namespace Qt::StringLiterals;
26
28 : m_fontDb(new QGenericUnixFontDatabase),
29 m_services(new QGenericUnixServices)
30{
31 QRegularExpression portRx("port=(\\d+)"_L1);
32 quint16 port = 5900;
33 for (const QString &arg : paramList) {
35 if (arg.contains(portRx, &match))
36 port = match.captured(1).toInt();
37 }
38
39 m_primaryScreen = new QVncScreen(paramList);
40 m_server = new QVncServer(m_primaryScreen, port);
41 m_primaryScreen->vncServer = m_server;
42}
43
45{
46 delete m_server;
48}
49
51{
52 if (m_primaryScreen->initialize())
54 else
55 qWarning("vnc: Failed to initialize screen");
56
57 m_inputContext = QPlatformInputContextFactory::create();
58
59 m_nativeInterface.reset(new QPlatformNativeInterface);
60
61 // we always have exactly one mouse and keyboard
66
67}
68
70{
71 switch (cap) {
72 case ThreadedPixmaps: return true;
73 case WindowManagement: return false;
74 case RhiBasedRendering: return false;
76 }
77}
78
83
88
90{
91 return createUnixEventDispatcher();
92}
93
94QList<QPlatformScreen *> QVncIntegration::screens() const
95{
96 QList<QPlatformScreen *> list;
97 list.append(m_primaryScreen);
98 return list;
99}
100
102{
103 return m_fontDb.data();
104}
105
107{
108 return m_services.data();
109}
110
112{
113 return m_nativeInterface.data();
114}
115
static QInputDeviceManager * inputDeviceManager()
static QInputDeviceManagerPrivate * get(QInputDeviceManager *mgr)
void append(parameter_type t)
Definition qlist.h:458
The QPlatformBackingStore class provides the drawing area for top-level windows.
The QPlatformFontDatabase class makes it possible to customize how fonts are discovered and how they ...
static QPlatformInputContext * create()
virtual bool hasCapability(Capability cap) const
Capability
Capabilities are used to determine specific features of a platform integration.
The QPlatformNativeInterface class provides an abstraction for retrieving native resource handles.
The QPlatformServices provides the backend for desktop-related functionality.
The QPlatformWindow class provides an abstraction for top-level windows.
\inmodule QtCore \reentrant
\inmodule QtCore \reentrant
T * data() const noexcept
Returns the value of the pointer referenced by this object.
void reset(T *other=nullptr) noexcept(noexcept(Cleanup::cleanup(std::declval< T * >())))
Deletes the existing object it is pointing to (if any), and sets its pointer to other.
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
bool hasCapability(QPlatformIntegration::Capability cap) const override
QPlatformFontDatabase * fontDatabase() const override
Accessor for the platform integration's fontdatabase.
QPlatformWindow * createPlatformWindow(QWindow *window) const override
Factory function for QPlatformWindow.
QPlatformServices * services() const override
QVncIntegration(const QStringList &paramList)
QList< QPlatformScreen * > screens() const
void initialize() override
Performs initialization steps that depend on having an event dispatcher available.
QPlatformNativeInterface * nativeInterface() const override
QPlatformBackingStore * createPlatformBackingStore(QWindow *window) const override
Factory function for QPlatformBackingStore.
QAbstractEventDispatcher * createEventDispatcher() const override
Factory function for the GUI event dispatcher.
QVncServer * vncServer
Definition qvncscreen.h:52
bool initialize() override
static void handleScreenAdded(QPlatformScreen *screen, bool isPrimary=false)
Should be called by the implementation whenever a new screen is added.
static void handleScreenRemoved(QPlatformScreen *screen)
Should be called by the implementation whenever a screen is removed.
\inmodule QtGui
Definition qwindow.h:63
Combined button and popup list for selecting options.
EGLOutputPortEXT port
#define qWarning
Definition qlogging.h:166
GLenum cap
SSL_CTX int void * arg
static bool match(const uchar *found, uint foundLen, const char *target, uint targetLen)
unsigned short quint16
Definition qtypes.h:48
QList< int > list
[14]
aWidget window() -> setWindowTitle("New Window Title")
[2]