20#if !defined(QT_NO_OPENGL)
24#if QT_CONFIG(qqnx_pps)
30#if QT_CONFIG(qqnx_pps)
33# if QT_CONFIG(qqnx_imf)
40#include <qpa/qplatforminputcontextfactory_p.h>
41#include <qpa/qplatforminputcontext.h>
43#include "private/qgenericunixfontdatabase_p.h"
44#include "private/qgenericunixeventdispatcher_p.h"
46#include <qpa/qplatformwindow.h>
47#include <qpa/qwindowsysteminterface.h>
49#include <QtGui/private/qguiapplication_p.h>
51#if !defined(QT_NO_OPENGL)
53#include <QtGui/QOpenGLContext>
56#include <private/qsimpledrag_p.h>
58#include <QtCore/QDebug>
59#include <QtCore/QJsonDocument>
60#include <QtCore/QJsonObject>
61#include <QtCore/QJsonArray>
62#include <QtCore/QFile>
65#if defined(QQNXINTEGRATION_DEBUG)
66#define qIntegrationDebug qDebug
68#define qIntegrationDebug QT_NO_QDEBUG_MACRO
80 if (!paramList.contains(
"no-fullscreen"_L1)) {
84 if (paramList.contains(
"flush-screen-context"_L1)) {
88 if (paramList.contains(
"rootwindow"_L1)) {
92 if (!paramList.contains(
"disable-EGL_KHR_surfaceless_context"_L1)) {
102 int contextCapabilities = SCREEN_APPLICATION_CONTEXT;
104 if (
param.startsWith(contextCapabilitiesPrefix)) {
107 contextCapabilities =
value.toInt(&
ok, 0);
109 contextCapabilities = SCREEN_APPLICATION_CONTEXT;
112 return contextCapabilities;
117 , m_screenContextId(256, 0)
118 , m_screenEventThread(0)
120 , m_virtualKeyboard(0)
122 , m_navigatorEventNotifier(0)
126 , m_qpaInputContext(0)
129 , m_eventDispatcher(createUnixEventDispatcher())
132#
if !defined(QT_NO_CLIPBOARD)
140 , m_eglDisplay(EGL_NO_DISPLAY)
149 qFatal(
"%s - Screen: Failed to create screen context - Error: %s (%i)",
152 screen_get_context_property_cv(m_screenContext,
154 m_screenContextId.
size(),
155 m_screenContextId.
data());
158#if QT_CONFIG(qqnx_pps)
174 m_screenEventThread->
start();
178#if QT_CONFIG(qqnx_pps)
179 if (!m_qpaInputContext) {
189#if QT_CONFIG(qqnx_pps)
199 if (m_virtualKeyboard) {
204#if QT_CONFIG(qqnx_pps)
207#if QT_CONFIG(qqnx_imf)
213#if QT_CONFIG(qqnx_pps)
223 delete m_nativeInterface;
225#if QT_CONFIG(draganddrop)
230#if !defined(QT_NO_CLIPBOARD)
236#if QT_CONFIG(qqnx_pps)
237 delete m_navigatorEventNotifier;
239 delete m_navigatorEventHandler;
242 delete m_screenEventThread;
245 delete m_eventDispatcher;
247 delete m_screenEventHandler;
253 screen_destroy_context(m_screenContext);
259#if QT_CONFIG(qqnx_pps)
261 delete m_buttonsNotifier;
264 delete m_inputContext;
266 delete m_qpaInputContext;
269 delete m_virtualKeyboard;
277 ms_instance =
nullptr;
290#if !defined(QT_NO_OPENGL)
303 screen_window_t screenWindow =
reinterpret_cast<screen_window_t
>(nativeHandle);
304 if (this->
window(screenWindow)) {
305 qWarning() <<
"QWindow already created for foreign window"
318 switch (surfaceType) {
321#if !defined(QT_NO_OPENGL)
326 qFatal(
"QQnxWindow: unsupported window API");
337#if !defined(QT_NO_OPENGL)
344 int alphaSize =
format.alphaBufferSize();
345 int redSize =
format.redBufferSize();
346 int greenSize =
format.greenBufferSize();
347 int blueSize =
format.blueBufferSize();
350 if (alphaSize == -1 && redSize == -1 && greenSize == -1 && blueSize == -1) {
369 if (alphaSize <= 0 && redSize <= 5 && greenSize <= 6 && blueSize <= 5) {
385 format.setAlphaBufferSize(alphaSize);
386 format.setRedBufferSize(redSize);
387 format.setGreenBufferSize(greenSize);
388 format.setBlueBufferSize(blueSize);
396#if QT_CONFIG(qqnx_pps)
400 if (m_qpaInputContext)
401 return m_qpaInputContext;
402 return m_inputContext;
417 platformWindow->
setScreen(platformScreen);
426 m_eventDispatcher = 0;
428 return eventDispatcher;
433 return m_nativeInterface;
436#if !defined(QT_NO_CLIPBOARD)
441#if QT_CONFIG(qqnx_pps)
449#if QT_CONFIG(draganddrop)
475 return m_windowMapper.
value(qnxWindow, 0);
478void QQnxIntegration::addWindow(screen_window_t qnxWindow,
QWindow *
window)
486void QQnxIntegration::removeWindow(screen_window_t qnxWindow)
491 m_windowMapper.
remove(qnxWindow);
502 if (screen_get_display_property_iv(
display,
525 qWarning() <<
"Could not open config file" << json <<
"for reading";
532 qWarning() <<
"Invalid config file" << json
533 <<
"- no top-level JSON object";
539 requestedDisplays =
object.value(
"displayOrder"_L1).toArray();
564 for (
int i = 0;
i < displayCount;
i++)
565 allDisplays.
append(&availableDisplays[
i]);
575 int requestedValue =
value.toInt();
590 orderedDisplays.
append(allDisplays);
592 return orderedDisplays;
595void QQnxIntegration::createDisplays()
599 int displayCount = 0;
600 int result = screen_get_context_property_iv(m_screenContext, SCREEN_PROPERTY_DISPLAY_COUNT,
606 qFatal(
"QQnxIntegration: displayCount=%d", displayCount);
610 screen_display_t *displays = (screen_display_t *)alloca(
sizeof(screen_display_t) * displayCount);
611 result = screen_get_context_property_pv(m_screenContext, SCREEN_PROPERTY_DISPLAYS,
620 for (
int i=1;
i<displayCount;
i++) {
622 result = screen_get_display_property_iv(*orderedDisplays[
i], SCREEN_PROPERTY_ATTACHED,
641 screen->adjustOrientation();
663void QQnxIntegration::destroyDisplays()
675 if (
screen->nativeDisplay() == qnxScreen)
684 return m_screens.
first();
694 return m_screenContext;
699 return m_screenContextId;
704 return m_navigatorEventHandler;
710 return m_navigator != 0;
714void QQnxIntegration::createEglDisplay()
719 m_eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
720 if (
Q_UNLIKELY(m_eglDisplay == EGL_NO_DISPLAY))
721 qFatal(
"QQnxiIntegration: failed to obtain EGL display: %x", eglGetError());
723 EGLBoolean eglResult = eglInitialize(m_eglDisplay, 0, 0);
725 qFatal(
"QQnxIntegration: failed to initialize EGL display, err=%d", eglGetError());
728void QQnxIntegration::destroyEglDisplay()
733 eglTerminate(m_eglDisplay);
char * data()
\macro QT_NO_CAST_FROM_BYTEARRAY
qsizetype size() const noexcept
Returns the number of bytes in this byte array.
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
bool isEmpty() const noexcept
Returns true if the byte array has size 0; otherwise returns false.
void resize(qsizetype size)
Sets the size of the byte array to size bytes.
bool open(OpenMode flags) override
Opens the file using OpenMode mode, returning true if successful; otherwise false.
bool remove(const Key &key)
Removes the item that has the key from the hash.
T value(const Key &key) const noexcept
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
QByteArray readAll()
Reads all remaining data from the device, and returns it as a byte array.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
QJsonObject object() const
Returns the QJsonObject contained in the document.
bool isObject() const
Returns true if the document contains an object.
static QJsonDocument fromJson(const QByteArray &json, QJsonParseError *error=nullptr)
Parses json as a UTF-8 encoded JSON document, and creates a QJsonDocument from it.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
iterator erase(const_iterator begin, const_iterator end)
const_reference at(qsizetype i) const noexcept
qsizetype removeAll(const AT &t)
void append(parameter_type t)
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
static QPlatformInputContext * create()
The QPlatformInputContext class abstracts the input method dependent data and composing state.
The QPlatformOpenGLContext class provides an abstraction for native GL contexts.
QAbstractEventDispatcher * createEventDispatcher() const override
Factory function for the GUI event dispatcher.
bool hasCapability(QPlatformIntegration::Capability cap) const override
QQnxIntegration(const QStringList ¶mList)
QPlatformNativeInterface * nativeInterface() const override
QQnxNavigatorEventHandler * navigatorEventHandler()
@ AlwaysFlushScreenContext
QPlatformBackingStore * createPlatformBackingStore(QWindow *window) const override
Factory function for QPlatformBackingStore.
QPlatformWindow * createPlatformWindow(QWindow *window) const override
Factory function for QPlatformWindow.
QPlatformWindow * createForeignWindow(QWindow *window, WId nativeHandle) const override
QQnxScreen * primaryDisplay() const
void removeDisplay(QQnxScreen *screen)
QVariant styleHint(StyleHint hint) const override
QPlatformServices * services() const override
void moveToScreen(QWindow *window, int screen)
QByteArray screenContextId()
QQnxScreen * screenForNative(screen_display_t qnxScreen) const
void createDisplay(screen_display_t display, bool isPrimary)
screen_context_t screenContext()
QWindow * window(screen_window_t qnxWindow) const
QPlatformClipboard * clipboard() const override
Accessor for the platform integration's clipboard.
bool supportsNavigatorEvents() const
void setScreenEventThread(QQnxScreenEventThread *eventThread)
void addScreenEventFilter(QQnxScreenEventFilter *filter)
The QQnxWindow is the base class of the various classes used as instances of QPlatformWindow in the Q...
void setScreen(QQnxScreen *platformScreen)
int depth
the color depth of the screen
QSimpleDrag implements QBasicDrag for Drag and Drop operations within the Qt Application itself.
constexpr QStringView mid(qsizetype pos, qsizetype n=-1) const noexcept
Returns the substring of length length starting at position start in this object.
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
qsizetype length() const
Returns the number of characters in this string.
SurfaceType
The SurfaceType enum describes what type of surface this is.
void start(Priority=InheritPriority)
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.
QSet< QString >::iterator it
struct wl_display * display
Combined button and popup list for selecting options.
typedef EGLBoolean(EGLAPIENTRYP PFNEGLQUERYDEVICESEXTPROC)(EGLint max_devices
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define Q_FOREACH(variable, container)
GLint GLenum GLsizei GLsizei GLsizei depth
GLenum const GLint * param
GLint GLsizei GLsizei GLenum format
#define Q_SCREEN_CRITICALERROR(x, message)
#define Q_SCREEN_CHECKERROR(x, message)
static bool getRequestedDisplays(QJsonArray &requestedDisplays)
Read JSON configuration file for the QNX display order.
static int getIdOfDisplay(screen_display_t display)
Get display ID for given display.
#define qIntegrationDebug
static int getContextCapabilities(const QStringList ¶mList)
#define QStringLiteral(str)
static QT_BEGIN_NAMESPACE QVariant hint(QPlatformIntegration::StyleHint h)
#define QT_CONFIG(feature)
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
Q_CHECK_PTR(a=new int[80])
if(qFloatDistance(a, b)<(1<< 7))
[0]
bool contains(const AT &t) const noexcept