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
qlinuxfbintegration.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 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
5#include "qlinuxfbscreen.h"
6#if QT_CONFIG(kms)
7#include "qlinuxfbdrmscreen.h"
8#endif
9
10#include <QtGui/private/qgenericunixfontdatabase_p.h>
11#include <QtGui/private/qgenericunixservices_p.h>
12#include <QtGui/private/qgenericunixeventdispatcher_p.h>
13
14#include <QtFbSupport/private/qfbvthandler_p.h>
15#include <QtFbSupport/private/qfbbackingstore_p.h>
16#include <QtFbSupport/private/qfbwindow_p.h>
17#include <QtFbSupport/private/qfbcursor_p.h>
18
19#include <QtGui/private/qguiapplication_p.h>
20#include <qpa/qplatforminputcontextfactory_p.h>
21#include <qpa/qwindowsysteminterface.h>
22
23#if QT_CONFIG(libinput)
24#include <QtInputSupport/private/qlibinputhandler_p.h>
25#endif
26
27#if QT_CONFIG(evdev)
28#include <QtInputSupport/private/qevdevmousemanager_p.h>
29#include <QtInputSupport/private/qevdevkeyboardmanager_p.h>
30#include <QtInputSupport/private/qevdevtouchmanager_p.h>
31#endif
32
33#if QT_CONFIG(tslib)
34#include <QtInputSupport/private/qtslib_p.h>
35#endif
36
38
39using namespace Qt::StringLiterals;
40
42 : m_primaryScreen(nullptr),
43 m_fontDb(new QGenericUnixFontDatabase),
44 m_services(new QGenericUnixServices),
45 m_kbdMgr(nullptr)
46{
47#if QT_CONFIG(kms)
48 if (qEnvironmentVariableIntValue("QT_QPA_FB_DRM") != 0)
49 m_primaryScreen = new QLinuxFbDrmScreen(paramList);
50#endif
51 if (!m_primaryScreen)
52 m_primaryScreen = new QLinuxFbScreen(paramList);
53}
54
59
61{
62 if (m_primaryScreen->initialize())
64 else
65 qWarning("linuxfb: Failed to initialize screen");
66
67 m_inputContext = QPlatformInputContextFactory::create();
68
69 m_vtHandler.reset(new QFbVtHandler);
70
71 if (!qEnvironmentVariableIntValue("QT_QPA_FB_DISABLE_INPUT"))
72 createInputHandlers();
73}
74
76{
77 switch (cap) {
78 case ThreadedPixmaps: return true;
79 case WindowManagement: return false;
80 case RhiBasedRendering: return false;
82 }
83}
84
89
94
96{
97 return createUnixEventDispatcher();
98}
99
100QList<QPlatformScreen *> QLinuxFbIntegration::screens() const
101{
102 QList<QPlatformScreen *> list;
103 list.append(m_primaryScreen);
104 return list;
105}
106
108{
109 return m_fontDb.data();
110}
111
113{
114 return m_services.data();
115}
116
117void QLinuxFbIntegration::createInputHandlers()
118{
119#if QT_CONFIG(libinput)
120 if (!qEnvironmentVariableIntValue("QT_QPA_FB_NO_LIBINPUT")) {
121 new QLibInputHandler("libinput"_L1, QString());
122 return;
123 }
124#endif
125
126#if QT_CONFIG(tslib)
127 bool useTslib = qEnvironmentVariableIntValue("QT_QPA_FB_TSLIB");
128 if (useTslib)
129 new QTsLibMouseHandler("TsLib"_L1, QString());
130#endif
131
132#if QT_CONFIG(evdev)
133 m_kbdMgr = new QEvdevKeyboardManager("EvdevKeyboard"_L1, QString(), this);
134 new QEvdevMouseManager("EvdevMouse"_L1, QString(), this);
135#if QT_CONFIG(tslib)
136 if (!useTslib)
137#endif
138 new QEvdevTouchManager("EvdevTouch"_L1, QString() /* spec */, this);
139#endif
140}
141
146
147QFunctionPointer QLinuxFbIntegration::platformFunction(const QByteArray &function) const
148{
149 Q_UNUSED(function);
150 return nullptr;
151}
152
153#if QT_CONFIG(evdev)
154void QLinuxFbIntegration::loadKeymap(const QString &filename)
155{
156 if (m_kbdMgr)
157 m_kbdMgr->loadKeymap(filename);
158 else
159 qWarning("QLinuxFbIntegration: Cannot load keymap, no keyboard handler found");
160}
161
162void QLinuxFbIntegration::switchLang()
163{
164 if (m_kbdMgr)
165 m_kbdMgr->switchLang();
166 else
167 qWarning("QLinuxFbIntegration: Cannot switch language, no keyboard handler found");
168}
169#endif
170
\inmodule QtCore
Definition qbytearray.h:57
void loadKeymap(const QString &file)
virtual bool initialize()
QList< QPlatformScreen * > screens() const
void initialize() override
Performs initialization steps that depend on having an event dispatcher available.
QPlatformWindow * createPlatformWindow(QWindow *window) const override
Factory function for QPlatformWindow.
bool hasCapability(QPlatformIntegration::Capability cap) const override
QFunctionPointer platformFunction(const QByteArray &function) const override
QLinuxFbIntegration(const QStringList &paramList)
QPlatformBackingStore * createPlatformBackingStore(QWindow *window) const override
Factory function for QPlatformBackingStore.
QAbstractEventDispatcher * createEventDispatcher() const override
Factory function for the GUI event dispatcher.
QPlatformFontDatabase * fontDatabase() const override
Accessor for the platform integration's fontdatabase.
QPlatformNativeInterface * nativeInterface() const override
QPlatformServices * services() const override
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.
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
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.
#define qWarning
Definition qlogging.h:166
GLenum cap
Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=nullptr) noexcept
#define Q_UNUSED(x)
QList< int > list
[14]
QObject::connect nullptr
aWidget window() -> setWindowTitle("New Window Title")
[2]