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
qbsdfbintegration.cpp
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// Copyright (C) 2015-2016 Oleksandr Tymoshenko <gonzo@bluezbox.com>
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4// Qt-Security score:significant reason:default
5
7#include "qbsdfbscreen.h"
8
9#include <QtGui/private/qgenericunixfontdatabase_p.h>
10#include <QtGui/private/qgenericunixeventdispatcher_p.h>
11
12#include <QtFbSupport/private/qfbvthandler_p.h>
13#include <QtFbSupport/private/qfbbackingstore_p.h>
14#include <QtFbSupport/private/qfbwindow_p.h>
15#include <QtFbSupport/private/qfbcursor_p.h>
16
17#include <QtGui/private/qguiapplication_p.h>
18#include <qpa/qplatforminputcontext.h>
19#include <qpa/qplatforminputcontextfactory_p.h>
20#include <qpa/qwindowsysteminterface.h>
21#include <qpa/qplatformservices.h>
22
23#if QT_CONFIG(tslib)
24#include <QtInputSupport/private/qtslib_p.h>
25#endif
26
28
29using namespace Qt::StringLiterals;
30
31QBsdFbIntegration::QBsdFbIntegration(const QStringList &paramList)
32{
33 m_fontDb.reset(new QGenericUnixFontDatabase);
34 m_primaryScreen.reset(new QBsdFbScreen(paramList));
35}
36
38{
39 QWindowSystemInterface::handleScreenRemoved(m_primaryScreen.take());
40}
41
43{
44 if (m_primaryScreen->initialize())
45 QWindowSystemInterface::handleScreenAdded(m_primaryScreen.data());
46 else
47 qWarning("bsdfb: Failed to initialize screen");
48
49 m_inputContext.reset(QPlatformInputContextFactory::create());
50 m_nativeInterface.reset(new QPlatformNativeInterface);
51 m_vtHandler.reset(new QFbVtHandler);
52
53 if (!qEnvironmentVariableIntValue("QT_QPA_FB_DISABLE_INPUT"))
54 createInputHandlers();
55}
56
57bool QBsdFbIntegration::hasCapability(QPlatformIntegration::Capability cap) const
58{
59 switch (cap) {
60 case ThreadedPixmaps:
61 return true;
62 case WindowManagement:
63 return false;
64 case RhiBasedRendering:
65 return false;
66 default:
67 return QPlatformIntegration::hasCapability(cap);
68 }
69}
70
72{
73 return new QFbBackingStore(window);
74}
75
77{
78 return new QFbWindow(window);
79}
80
81QAbstractEventDispatcher *QBsdFbIntegration::createEventDispatcher() const
82{
83 return createUnixEventDispatcher();
84}
85
87{
88 QList<QPlatformScreen *> list;
89 list.append(m_primaryScreen.data());
90 return list;
91}
92
94{
95 return m_fontDb.data();
96}
97
99{
100 if (m_services.isNull())
101 m_services.reset(new QPlatformServices);
102
103 return m_services.data();
104}
105
106void QBsdFbIntegration::createInputHandlers()
107{
108#if QT_CONFIG(tslib)
109 const bool useTslib = qEnvironmentVariableIntValue("QT_QPA_FB_TSLIB");
110 if (useTslib)
111 new QTsLibMouseHandler("TsLib"_L1, QString());
112#endif
113}
114
116{
117 return m_nativeInterface.data();
118}
119
120QT_END_NAMESPACE
QPlatformBackingStore * createPlatformBackingStore(QWindow *window) const override
Factory function for QPlatformBackingStore.
void initialize() override
Performs initialization steps that depend on having an event dispatcher available.
QPlatformWindow * createPlatformWindow(QWindow *window) const override
Factory function for QPlatformWindow.
QPlatformServices * services() const override
QList< QPlatformScreen * > screens() const
QBsdFbIntegration(const QStringList &paramList)
QAbstractEventDispatcher * createEventDispatcher() const override
Factory function for the GUI event dispatcher.
bool hasCapability(QPlatformIntegration::Capability cap) const override
QPlatformNativeInterface * nativeInterface() const override
QPlatformFontDatabase * fontDatabase() const override
Accessor for the platform integration's fontdatabase.