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
qdirectfbintegration.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// Qt-Security score:significant reason:default
4
11
12#include <QtGui/private/qgenericunixfontdatabase_p.h>
13#include <QtGui/private/qgenericunixeventdispatcher_p.h>
14
15#include <QtGui/private/qpixmap_blitter_p.h>
16#include <QtGui/private/qpixmap_raster_p.h>
17#include <QtGui/private/qguiapplication_p.h>
18#include <qpa/qplatformpixmap.h>
19#include <QtCore/QCoreApplication>
20#include <QtCore/QThread>
21#include <QtCore/QAbstractEventDispatcher>
22#include <qpa/qplatforminputcontextfactory_p.h>
23#include <qpa/qwindowsysteminterface.h>
24#include <qpa/qplatformservices.h>
25
27
28QDirectFbIntegration::QDirectFbIntegration()
29 : m_fontDb(new QGenericUnixFontDatabase())
30{
31}
32
34{
38
39 m_inputContext = QPlatformInputContextFactory::create();
40}
41
42bool QDirectFbIntegration::hasCapability(Capability cap) const
43{
44 switch (cap) {
45 case ThreadedPixmaps: return true;
46 case MultipleWindows: return true;
47#ifdef DIRECTFB_GL_EGL
48 case OpenGL: return true;
49 case ThreadedOpenGL: return true;
50#endif
51 default: return QPlatformIntegration::hasCapability(cap);
52 }
53}
54
56{
57 const QStringList args = QCoreApplication::arguments();
58 int argc = args.size();
59 char **argv = new char*[argc];
60
61 for (int i = 0; i < argc; ++i)
62 argv[i] = qstrdup(args.at(i).toLocal8Bit().constData());
63
64 DFBResult result = DirectFBInit(&argc, &argv);
65 if (result != DFB_OK) {
66 DirectFBError("QDirectFBScreen: error initializing DirectFB",
67 result);
68 }
69
70 for (int i = 0; i < argc; ++i)
71 delete[] argv[i];
72 delete[] argv;
73
74 // This must happen after DirectFBInit.
75 m_dfb.reset(QDirectFbConvenience::dfbInterface());
76}
77
79{
80 m_primaryScreen.reset(new QDirectFbScreen(0));
81 QWindowSystemInterface::handleScreenAdded(m_primaryScreen.data());
82}
83
85{
86 m_input.reset(new QDirectFbInput(m_dfb.data(), m_primaryScreen->dfbLayer()));
87 m_input->start();
88}
89
91{
92 m_input->stopInputEventLoop();
93 m_input->wait();
94}
95
96QPlatformPixmap *QDirectFbIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const
97{
98 if (type == QPlatformPixmap::BitmapType)
99 return new QRasterPlatformPixmap(type);
100 else
102}
103
105{
106 QDirectFbWindow *dfbWindow = new QDirectFbWindow(window, m_input.data());
108 return dfbWindow;
109}
110
111QAbstractEventDispatcher *QDirectFbIntegration::createEventDispatcher() const
112{
113 return createUnixEventDispatcher();
114}
115
117{
118 return new QDirectFbBackingStore(window);
119}
120
122{
123 return m_fontDb.data();
124}
125
127{
128 if (m_services.isNull())
129 m_services.reset(new QPlatformServices);
130
131 return m_services.data();
132}
133
135{
136 return const_cast<QDirectFbIntegration *>(this);
137}
138
139QT_END_NAMESPACE
bool hasCapability(Capability cap) const override
QAbstractEventDispatcher * createEventDispatcher() const override
Factory function for the GUI event dispatcher.
QPlatformServices * services() const override
QPlatformPixmap * createPlatformPixmap(QPlatformPixmap::PixelType type) const override
Factory function for QPlatformPixmap.
QPlatformFontDatabase * fontDatabase() const override
Accessor for the platform integration's fontdatabase.
QPlatformWindow * createPlatformWindow(QWindow *window) const override
Factory function for QPlatformWindow.
QPlatformBackingStore * createPlatformBackingStore(QWindow *window) const override
Factory function for QPlatformBackingStore.
QPlatformNativeInterface * nativeInterface() const override
virtual void createDirectFBWindow()