22#if !defined(QT_NO_OPENGL)
26#if QT_CONFIG(qqnx_pps)
32#if QT_CONFIG(qqnx_pps)
35# if QT_CONFIG(qqnx_imf)
42#include <qpa/qplatforminputcontextfactory_p.h>
43#include <qpa/qplatforminputcontext.h>
45#include "private/qgenericunixfontdatabase_p.h"
46#include "private/qgenericunixeventdispatcher_p.h"
48#include <qpa/qplatformwindow.h>
49#include <qpa/qwindowsysteminterface.h>
51#include <QtGui/private/qguiapplication_p.h>
52#include <QtGui/private/qrhibackingstore_p.h>
54#if !defined(QT_NO_OPENGL)
56#include <QtGui/QOpenGLContext>
59#include <private/qsimpledrag_p.h>
61#include <QtCore/QDebug>
62#include <QtCore/QJsonDocument>
63#include <QtCore/QJsonObject>
64#include <QtCore/QJsonArray>
65#include <QtCore/QFile>
79 if (!paramList.contains(
"no-fullscreen"_L1)) {
83 if (paramList.contains(
"flush-screen-context"_L1)) {
87 if (paramList.contains(
"rootwindow"_L1)) {
91 if (!paramList.contains(
"disable-EGL_KHR_surfaceless_context"_L1)) {
100 constexpr auto contextCapabilitiesPrefix =
"screen-context-capabilities="_L1;
101 int contextCapabilities = SCREEN_APPLICATION_CONTEXT;
103 if (
param.startsWith(contextCapabilitiesPrefix)) {
106 contextCapabilities =
value.toInt(&
ok, 0);
108 contextCapabilities = SCREEN_APPLICATION_CONTEXT;
111 return contextCapabilities;
116 , m_screenContextId(256, 0)
117 , m_screenEventThread(0)
119 , m_virtualKeyboard(0)
121 , m_navigatorEventNotifier(0)
125 , m_qpaInputContext(0)
128 , m_eventDispatcher(createUnixEventDispatcher())
131#
if !defined(QT_NO_CLIPBOARD)
139 , m_eglDisplay(EGL_NO_DISPLAY)
148 qFatal(
"%s - Screen: Failed to create screen context - Error: %s (%i)",
151 screen_get_context_property_cv(m_screenContext,
153 m_screenContextId.
size(),
154 m_screenContextId.
data());
157#if QT_CONFIG(qqnx_pps)
173 m_screenEventThread->
start();
177#if QT_CONFIG(qqnx_pps)
178 if (!m_qpaInputContext) {
188#if QT_CONFIG(qqnx_pps)
198 if (m_virtualKeyboard) {
203#if QT_CONFIG(qqnx_pps)
206#if QT_CONFIG(qqnx_imf)
212#if QT_CONFIG(qqnx_pps)
221 qCDebug(lcQpaQnx) <<
"Platform plugin shutdown begin";
222 delete m_nativeInterface;
224#if QT_CONFIG(draganddrop)
229#if !defined(QT_NO_CLIPBOARD)
235#if QT_CONFIG(qqnx_pps)
236 delete m_navigatorEventNotifier;
238 delete m_navigatorEventHandler;
241 delete m_screenEventThread;
244 delete m_eventDispatcher;
246 delete m_screenEventHandler;
252 screen_destroy_context(m_screenContext);
258#if QT_CONFIG(qqnx_pps)
260 delete m_buttonsNotifier;
263 delete m_inputContext;
265 delete m_qpaInputContext;
268 delete m_virtualKeyboard;
276 ms_instance =
nullptr;
278 qCDebug(lcQpaQnx) <<
"Platform plugin shutdown end";
289#if !defined(QT_NO_OPENGL)
302 screen_window_t screenWindow =
reinterpret_cast<screen_window_t
>(nativeHandle);
303 if (this->
window(screenWindow)) {
304 qWarning() <<
"QWindow already created for foreign window"
317 switch (surfaceType) {
320#if !defined(QT_NO_OPENGL)
325 qFatal(
"QQnxWindow: unsupported window API");
334 switch (surfaceType) {
337#if !defined(QT_NO_OPENGL)
347#if !defined(QT_NO_OPENGL)
354 int alphaSize =
format.alphaBufferSize();
355 int redSize =
format.redBufferSize();
356 int greenSize =
format.greenBufferSize();
357 int blueSize =
format.blueBufferSize();
360 if (alphaSize == -1 && redSize == -1 && greenSize == -1 && blueSize == -1) {
379 if (alphaSize <= 0 && redSize <= 5 && greenSize <= 6 && blueSize <= 5) {
395 format.setAlphaBufferSize(alphaSize);
396 format.setRedBufferSize(redSize);
397 format.setGreenBufferSize(greenSize);
398 format.setBlueBufferSize(blueSize);
406#if QT_CONFIG(qqnx_pps)
410 if (m_qpaInputContext)
411 return m_qpaInputContext;
412 return m_inputContext;
427 platformWindow->
setScreen(platformScreen);
436 m_eventDispatcher = 0;
438 return eventDispatcher;
443 return m_nativeInterface;
446#if !defined(QT_NO_CLIPBOARD)
451#if QT_CONFIG(qqnx_pps)
459#if QT_CONFIG(draganddrop)
485 return m_windowMapper.
value(qnxWindow, 0);
488void QQnxIntegration::addWindow(screen_window_t qnxWindow,
QWindow *
window)
496void QQnxIntegration::removeWindow(screen_window_t qnxWindow)
501 m_windowMapper.
remove(qnxWindow);
512 if (screen_get_display_property_iv(
display,
535 qWarning() <<
"Could not open config file" << json <<
"for reading";
542 qWarning() <<
"Invalid config file" << json
543 <<
"- no top-level JSON object";
549 requestedDisplays =
object.
value(
"displayOrder"_L1).
toArray();
570QList<screen_display_t *> QQnxIntegration::sortDisplays(screen_display_t *availableDisplays,
int displayCount)
573 QList<screen_display_t *> allDisplays;
574 for (
int i = 0;
i < displayCount;
i++)
575 allDisplays.append(&availableDisplays[
i]);
583 QList<screen_display_t *> orderedDisplays;
585 int requestedValue =
value.toInt();
592 orderedDisplays.append(
display);
600 orderedDisplays.append(allDisplays);
602 return orderedDisplays;
605void QQnxIntegration::createDisplays()
609 int displayCount = 0;
610 int result = screen_get_context_property_iv(m_screenContext, SCREEN_PROPERTY_DISPLAY_COUNT,
616 qFatal(
"QQnxIntegration: displayCount=%d", displayCount);
620 screen_display_t *displays = (screen_display_t *)alloca(
sizeof(screen_display_t) * displayCount);
621 result = screen_get_context_property_pv(m_screenContext, SCREEN_PROPERTY_DISPLAYS,
623 QList<screen_display_t *> orderedDisplays = sortDisplays(displays, displayCount);
630 for (
int i=1;
i<displayCount;
i++) {
632 result = screen_get_display_property_iv(*orderedDisplays[
i], SCREEN_PROPERTY_ATTACHED,
637 qCDebug(lcQpaQnx) <<
"Skipping non-attached display " <<
i;
641 qCDebug(lcQpaQnx) <<
"Creating screen for display " <<
i;
652 screen->adjustOrientation();
674void QQnxIntegration::destroyDisplays()
687 if (
screen->nativeDisplay() == qnxScreen)
696 return m_screens.
first();
706 return m_screenContext;
711 return m_screenContextId;
716 return m_navigatorEventHandler;
722 return m_navigator != 0;
726void QQnxIntegration::createEglDisplay()
731 m_eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
732 if (
Q_UNLIKELY(m_eglDisplay == EGL_NO_DISPLAY))
733 qFatal(
"QQnxiIntegration: failed to obtain EGL display: %x", eglGetError());
735 EGLBoolean eglResult = eglInitialize(m_eglDisplay, 0, 0);
737 qFatal(
"QQnxIntegration: failed to initialize EGL display, err=%d", eglGetError());
740void QQnxIntegration::destroyEglDisplay()
745 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.
QFILE_MAYBE_NODISCARD 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
QJsonValue value(const QString &key) const
Returns a QJsonValue representing the value for the key key.
\inmodule QtCore\reentrant
QJsonArray toArray() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
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
iterator erase(const_iterator i)
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...
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)
#define qCDebug(category,...)
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.
static int getContextCapabilities(const QStringList ¶mList)
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