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
qqnxintegration.cpp
Go to the documentation of this file.
1// Copyright (C) 2013 BlackBerry Limited. All rights reserved.
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
5#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
6
7#include "qqnxglobal.h"
8
13#include "qqnxscreen.h"
15#include "qqnxwindow.h"
19#include "qqnxservices.h"
20
23#if !defined(QT_NO_OPENGL)
24#include "qqnxeglwindow.h"
25#endif
26
27#if QT_CONFIG(vulkan)
28#include "qqnxvulkanwindow.h"
29#include "qqnxvulkaninstance.h"
30#endif
31
32#if QT_CONFIG(qqnx_pps)
33#include "qqnxnavigatorpps.h"
34#include "qqnxnavigatoreventnotifier.h"
35#include "qqnxvirtualkeyboardpps.h"
36#endif
37
38#if QT_CONFIG(qqnx_pps)
39# include "qqnxbuttoneventnotifier.h"
40#endif
41
42#if QT_CONFIG(qqnx_imf)
43# include "qqnxinputcontext_imf.h"
44#else
46#endif
47
48#if !defined(QT_NO_CLIPBOARD)
49# include "qqnxclipboard.h"
50#endif
51
52#include <qpa/qplatforminputcontextfactory_p.h>
53#include <qpa/qplatforminputcontext.h>
54
55#include "private/qgenericunixfontdatabase_p.h"
56#include "private/qgenericunixeventdispatcher_p.h"
57
58#include <qpa/qplatformwindow.h>
59#include <qpa/qwindowsysteminterface.h>
60
61#include <QtGui/private/qguiapplication_p.h>
62#include <QtGui/private/qrhibackingstore_p.h>
63
64#if !defined(QT_NO_OPENGL)
65#include "qqnxglcontext.h"
66#include <QtGui/QOpenGLContext>
67#endif
68
69#include <private/qsimpledrag_p.h>
70
71#include <QtCore/QDebug>
72#include <QtCore/QJsonDocument>
73#include <QtCore/QJsonObject>
74#include <QtCore/QJsonArray>
75#include <QtCore/QFile>
76#include <errno.h>
77
78QT_BEGIN_NAMESPACE
79
80using namespace Qt::StringLiterals;
81
83
84static inline QQnxIntegration::Options parseOptions(const QStringList &paramList)
85{
86 QQnxIntegration::Options options = QQnxIntegration::NoOptions;
87 if (!paramList.contains("no-fullscreen"_L1)) {
89 }
90
91 if (paramList.contains("flush-screen-context"_L1)) {
93 }
94
95 if (paramList.contains("rootwindow"_L1)) {
97 }
98
99 if (!paramList.contains("disable-EGL_KHR_surfaceless_context"_L1)) {
101 }
102
103 if (paramList.contains("desktop"_L1)) {
104 options |= QQnxIntegration::Desktop;
105 }
106
107 return options;
108}
109
110static inline int getContextCapabilities(const QStringList &paramList)
111{
112 constexpr auto contextCapabilitiesPrefix = "screen-context-capabilities="_L1;
113 int contextCapabilities = SCREEN_APPLICATION_CONTEXT;
114 for (const QString &param : paramList) {
115 if (param.startsWith(contextCapabilitiesPrefix)) {
116 auto value = QStringView{param}.mid(contextCapabilitiesPrefix.length());
117 bool ok = false;
118 contextCapabilities = value.toInt(&ok, 0);
119 if (!ok)
120 contextCapabilities = SCREEN_APPLICATION_CONTEXT;
121 }
122 }
123 return contextCapabilities;
124}
125
126QQnxIntegration::QQnxIntegration(const QStringList &paramList)
127 : QPlatformIntegration()
128 , m_screenContextId(256, 0)
129 , m_screenEventThread(0)
130 , m_navigatorEventHandler(new QQnxNavigatorEventHandler())
131 , m_virtualKeyboard(0)
132 , m_inputContext(0)
133#if QT_CONFIG(qqnx_pps)
134 , m_navigatorEventNotifier(0)
135 , m_buttonsNotifier(new QQnxButtonEventNotifier())
136#endif
137 , m_qpaInputContext(0)
138 , m_fontDatabase(new QGenericUnixFontDatabase())
139 , m_eventDispatcher(createUnixEventDispatcher())
140 , m_nativeInterface(new QQnxNativeInterface(this))
141 , m_screenEventHandler(new QQnxScreenEventHandler(this))
142#if !defined(QT_NO_CLIPBOARD)
143 , m_clipboard(0)
144#endif
145 , m_navigator(0)
146#if QT_CONFIG(draganddrop)
147 , m_drag(new QSimpleDrag())
148#endif
149#if QT_CONFIG(opengl)
150 , m_eglDisplay(EGL_NO_DISPLAY)
151#endif
152{
153 ms_instance = this;
154 m_options = parseOptions(paramList);
155 qCDebug(lcQpaQnx) << Q_FUNC_INFO;
156
157 // Open connection to QNX composition manager
158 if (screen_create_context(&m_screenContext, getContextCapabilities(paramList))) {
159 qFatal("%s - Screen: Failed to create screen context - Error: %s (%i)",
160 Q_FUNC_INFO, strerror(errno), errno);
161 }
162 screen_get_context_property_cv(m_screenContext,
163 SCREEN_PROPERTY_ID,
164 m_screenContextId.size(),
165 m_screenContextId.data());
166 m_screenContextId.resize(strlen(m_screenContextId.constData()));
167
168#if QT_CONFIG(qqnx_pps)
169 // Create/start navigator event notifier
170 m_navigatorEventNotifier = new QQnxNavigatorEventNotifier(m_navigatorEventHandler);
171
172 // delay invocation of start() to the time the event loop is up and running
173 // needed to have the QThread internals of the main thread properly initialized
174 QMetaObject::invokeMethod(m_navigatorEventNotifier, "start", Qt::QueuedConnection);
175#endif
176
177#if QT_CONFIG(opengl)
178 createEglDisplay();
179#endif
180
181 // Create/start event thread
182 m_screenEventThread = new QQnxScreenEventThread(m_screenContext);
183 m_screenEventHandler->setScreenEventThread(m_screenEventThread);
184 m_screenEventThread->start();
185
186 m_qpaInputContext = QPlatformInputContextFactory::create();
187
188#if QT_CONFIG(qqnx_pps)
189 if (!m_qpaInputContext) {
190 // Create/start the keyboard class.
191 m_virtualKeyboard = new QQnxVirtualKeyboardPps();
192
193 // delay invocation of start() to the time the event loop is up and running
194 // needed to have the QThread internals of the main thread properly initialized
195 QMetaObject::invokeMethod(m_virtualKeyboard, "start", Qt::QueuedConnection);
196 }
197#endif
198
199#if QT_CONFIG(qqnx_pps)
200 m_navigator = new QQnxNavigatorPps();
201#endif
202
203 createDisplays();
204
205 if (m_virtualKeyboard) {
206 // TODO check if we need to do this for all screens or only the primary one
207 QObject::connect(m_virtualKeyboard, SIGNAL(heightChanged(int)),
208 primaryDisplay(), SLOT(keyboardHeightChanged(int)));
209
210#if QT_CONFIG(qqnx_pps)
211 // Set up the input context
212 m_inputContext = new QQnxInputContext(this, *m_virtualKeyboard);
213#if QT_CONFIG(qqnx_imf)
214 m_screenEventHandler->addScreenEventFilter(m_inputContext);
215#endif
216#endif
217 }
218
219#if QT_CONFIG(qqnx_pps)
220 // delay invocation of start() to the time the event loop is up and running
221 // needed to have the QThread internals of the main thread properly initialized
222 QMetaObject::invokeMethod(m_buttonsNotifier, "start", Qt::QueuedConnection);
223#endif
224}
225
227{
228 qCDebug(lcQpaQnx) << "Platform plugin shutdown begin";
229 delete m_nativeInterface;
230
231#if QT_CONFIG(draganddrop)
232 // Destroy the drag object
233 delete m_drag;
234#endif
235
236#if !defined(QT_NO_CLIPBOARD)
237 // Delete the clipboard
238 delete m_clipboard;
239#endif
240
241 // Stop/destroy navigator event notifier
242#if QT_CONFIG(qqnx_pps)
243 delete m_navigatorEventNotifier;
244#endif
245 delete m_navigatorEventHandler;
246
247 // Stop/destroy screen event thread
248 delete m_screenEventThread;
249
250 // In case the event-dispatcher was never transferred to QCoreApplication
251 delete m_eventDispatcher;
252
253 delete m_screenEventHandler;
254
255 // Destroy all displays
256 destroyDisplays();
257
258 // Close connection to QNX composition manager
259 screen_destroy_context(m_screenContext);
260
261#if QT_CONFIG(opengl)
262 destroyEglDisplay();
263#endif
264
265#if QT_CONFIG(qqnx_pps)
266 // Destroy the hardware button notifier
267 delete m_buttonsNotifier;
268
269 // Destroy input context
270 delete m_inputContext;
271#endif
272 delete m_qpaInputContext;
273
274 // Destroy the keyboard class.
275 delete m_virtualKeyboard;
276
277 // Destroy services class
278 delete m_services;
279
280 // Destroy navigator interface
281 delete m_navigator;
282
283 ms_instance = nullptr;
284
285 qCDebug(lcQpaQnx) << "Platform plugin shutdown end";
286}
287
288bool QQnxIntegration::hasCapability(QPlatformIntegration::Capability cap) const
289{
290 qCDebug(lcQpaQnx) << Q_FUNC_INFO;
291 switch (cap) {
292 case MultipleWindows:
293 case ForeignWindows:
294 case ThreadedPixmaps:
295 return true;
296#if !defined(QT_NO_OPENGL)
297 case OpenGL:
298 case ThreadedOpenGL:
299 case BufferQueueingOpenGL:
300 return true;
301#endif
302 default:
303 return QPlatformIntegration::hasCapability(cap);
304 }
305}
306
307QPlatformWindow *QQnxIntegration::createForeignWindow(QWindow *window, WId nativeHandle) const
308{
309 screen_window_t screenWindow = reinterpret_cast<screen_window_t>(nativeHandle);
310 if (this->window(screenWindow)) {
311 qWarning() << "QWindow already created for foreign window"
312 << screenWindow;
313 return nullptr;
314 }
315
316 return new QQnxForeignWindow(window, m_screenContext, screenWindow);
317}
318
320{
321 qCDebug(lcQpaQnx) << Q_FUNC_INFO;
322 QSurface::SurfaceType surfaceType = window->surfaceType();
323 const bool needRootWindow = options() & RootWindow;
324 switch (surfaceType) {
325 case QSurface::RasterSurface:
326 return new QQnxRasterWindow(window, m_screenContext, needRootWindow);
327#if !defined(QT_NO_OPENGL)
328 case QSurface::OpenGLSurface:
329 return new QQnxEglWindow(window, m_screenContext, needRootWindow);
330#endif
331#if QT_CONFIG(vulkan)
332 case QSurface::VulkanSurface:
333 return new QQnxVulkanWindow(window, m_screenContext, needRootWindow);
334#endif
335 default:
336 qFatal("QQnxWindow: unsupported window API");
337 }
338 return 0;
339}
340
341#if QT_CONFIG(vulkan)
342QPlatformVulkanInstance *QQnxIntegration::createPlatformVulkanInstance(QVulkanInstance *instance) const
343{
344 return new QQnxVulkanInstance(instance);
345}
346#endif
347
349{
350 QSurface::SurfaceType surfaceType = window->surfaceType();
351 qCDebug(lcQpaQnx) << Q_FUNC_INFO << surfaceType;
352 switch (surfaceType) {
353 case QSurface::RasterSurface:
354 return new QQnxRasterBackingStore(window);
355#if !defined(QT_NO_OPENGL)
356 // Return a QRhiBackingStore for non-raster surface windows
357 case QSurface::OpenGLSurface:
358 return new QRhiBackingStore(window);
359#endif
360#if QT_CONFIG(vulkan)
361 case QSurface::VulkanSurface:
362 return new QRhiBackingStore(window);
363#endif
364 default:
365 return nullptr;
366 }
367}
368
369#if !defined(QT_NO_OPENGL)
370QPlatformOpenGLContext *QQnxIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
371{
372 qCDebug(lcQpaQnx) << Q_FUNC_INFO;
373
374 // Get color channel sizes from window format
375 QSurfaceFormat format = context->format();
376 int alphaSize = format.alphaBufferSize();
377 int redSize = format.redBufferSize();
378 int greenSize = format.greenBufferSize();
379 int blueSize = format.blueBufferSize();
380
381 // Check if all channels are don't care
382 if (alphaSize == -1 && redSize == -1 && greenSize == -1 && blueSize == -1) {
383 // Set color channels based on depth of window's screen
384 QQnxScreen *screen = static_cast<QQnxScreen*>(context->screen()->handle());
385 int depth = screen->depth();
386 if (depth == 32) {
387 // SCREEN_FORMAT_RGBA8888
388 alphaSize = 8;
389 redSize = 8;
390 greenSize = 8;
391 blueSize = 8;
392 } else {
393 // SCREEN_FORMAT_RGB565
394 alphaSize = 0;
395 redSize = 5;
396 greenSize = 6;
397 blueSize = 5;
398 }
399 } else {
400 // Choose best match based on supported pixel formats
401 if (alphaSize <= 0 && redSize <= 5 && greenSize <= 6 && blueSize <= 5) {
402 // SCREEN_FORMAT_RGB565
403 alphaSize = 0;
404 redSize = 5;
405 greenSize = 6;
406 blueSize = 5;
407 } else {
408 // SCREEN_FORMAT_RGBA8888
409 alphaSize = 8;
410 redSize = 8;
411 greenSize = 8;
412 blueSize = 8;
413 }
414 }
415
416 // Update color channel sizes in window format
417 format.setAlphaBufferSize(alphaSize);
418 format.setRedBufferSize(redSize);
419 format.setGreenBufferSize(greenSize);
420 format.setBlueBufferSize(blueSize);
421 context->setFormat(format);
422
423 QQnxGLContext *ctx = new QQnxGLContext(context->format(), context->shareHandle());
424 return ctx;
425}
426#endif
427
429{
430 qCDebug(lcQpaQnx) << Q_FUNC_INFO;
431 if (m_qpaInputContext)
432 return m_qpaInputContext;
433 return m_inputContext;
434}
435
436void QQnxIntegration::moveToScreen(QWindow *window, int screen)
437{
438 qCDebug(lcQpaQnx) << Q_FUNC_INFO << "w =" << window << ", s =" << screen;
439
440 // get platform window used by widget
441 QQnxWindow *platformWindow = static_cast<QQnxWindow *>(window->handle());
442
443 // lookup platform screen by index
444 QQnxScreen *platformScreen = m_screens.at(screen);
445
446 // move the platform window to the platform screen
447 platformWindow->setScreen(platformScreen);
448}
449
451{
452 qCDebug(lcQpaQnx) << Q_FUNC_INFO;
453
454 // We transfer ownersip of the event-dispatcher to QtCoreApplication
455 QAbstractEventDispatcher *eventDispatcher = m_eventDispatcher;
456 m_eventDispatcher = 0;
457
458 return eventDispatcher;
459}
460
462{
463 return m_nativeInterface;
464}
465
466#if !defined(QT_NO_CLIPBOARD)
468{
469 qCDebug(lcQpaQnx) << Q_FUNC_INFO;
470 if (!m_clipboard)
471 m_clipboard = new QQnxClipboard;
472
473 return m_clipboard;
474}
475#endif
476
477#if QT_CONFIG(draganddrop)
478QPlatformDrag *QQnxIntegration::drag() const
479{
480 return m_drag;
481}
482#endif
483
484QVariant QQnxIntegration::styleHint(QPlatformIntegration::StyleHint hint) const
485{
486 qCDebug(lcQpaQnx) << Q_FUNC_INFO;
487 if ((hint == ShowIsFullScreen) && (m_options & FullScreenApplication))
488 return true;
489
490 return QPlatformIntegration::styleHint(hint);
491}
492
494{
495 // Create services handling class
496 if (m_navigator && !m_services)
497 m_services = new QQnxServices(m_navigator);
498
499 return m_services;
500}
501
502QWindow *QQnxIntegration::window(screen_window_t qnxWindow) const
503{
504 qCDebug(lcQpaQnx) << Q_FUNC_INFO;
505 QMutexLocker locker(&m_windowMapperMutex);
506 Q_UNUSED(locker);
507 return m_windowMapper.value(qnxWindow, 0);
508}
509
510void QQnxIntegration::addWindow(screen_window_t qnxWindow, QWindow *window)
511{
512 qCDebug(lcQpaQnx) << Q_FUNC_INFO;
513 QMutexLocker locker(&m_windowMapperMutex);
514 Q_UNUSED(locker);
515 m_windowMapper.insert(qnxWindow, window);
516}
517
518void QQnxIntegration::removeWindow(screen_window_t qnxWindow)
519{
520 qCDebug(lcQpaQnx) << Q_FUNC_INFO;
521 QMutexLocker locker(&m_windowMapperMutex);
522 Q_UNUSED(locker);
523 m_windowMapper.remove(qnxWindow);
524}
525
526/*!
527 Get display ID for given \a display
528
529 Returns -1 for failure, otherwise returns display ID
530 */
531static int getIdOfDisplay(screen_display_t display)
532{
533 int displayId;
534 if (screen_get_display_property_iv(display,
535 SCREEN_PROPERTY_ID,
536 &displayId) == 0) {
537 return displayId;
538 }
539 return -1;
540}
541
542/*!
543 Read JSON configuration file for the QNX display order
544
545 Returns true if file was read successfully and fills \a requestedDisplays
546 */
547static bool getRequestedDisplays(QJsonArray &requestedDisplays)
548{
549 // Check if display configuration file is provided
550 QByteArray json = qgetenv("QT_QPA_QNX_DISPLAY_CONFIG");
551 if (json.isEmpty())
552 return false;
553
554 // Check if configuration file exists
555 QFile file(QString::fromUtf8(json));
556 if (!file.open(QFile::ReadOnly)) {
557 qWarning() << "Could not open config file" << json << "for reading";
558 return false;
559 }
560
561 // Read config file and check it's json
562 const QJsonDocument doc = QJsonDocument::fromJson(file.readAll());
563 if (!doc.isObject()) {
564 qWarning() << "Invalid config file" << json
565 << "- no top-level JSON object";
566 return false;
567 }
568
569 // Read the requested display order
570 const QJsonObject object = doc.object();
571 requestedDisplays = object.value("displayOrder"_L1).toArray();
572
573 return true;
574}
575
576/*!
577 Match \a availableDisplays with display order defined in a json file
578 pointed to by QT_QPA_QNX_DISPLAY_CONFIG. Display order must use same
579 identifiers as defined for displays in graphics.conf. Number of
580 available displays must be specified in \a displayCount
581
582 An example configuration is below:
583 \badcode
584 {
585 "displayOrder": [ 3, 1 ]
586 }
587 \endcode
588
589 Returns ordered list of displays. If no order was specified, returns
590 displays in the same order as in the original list.
591*/
592QList<screen_display_t *> QQnxIntegration::sortDisplays(screen_display_t *availableDisplays, int displayCount)
593{
594 // Intermediate list for sorting
595 QList<screen_display_t *> allDisplays;
596 for (int i = 0; i < displayCount; i++)
597 allDisplays.append(&availableDisplays[i]);
598
599 // Read requested display order if available
600 QJsonArray requestedDisplays;
601 if (!getRequestedDisplays(requestedDisplays))
602 return allDisplays;
603
604 // Go through all the requested displays IDs
605 QList<screen_display_t *> orderedDisplays;
606 for (const QJsonValue &value : std::as_const(requestedDisplays)) {
607 int requestedValue = value.toInt();
608
609 // Move all displays with matching ID from the intermediate list
610 // to the beginning of the ordered list
611 for (auto it = allDisplays.begin(), end = allDisplays.end(); it != end; ++it) {
612 screen_display_t *display = *it;
613 if (getIdOfDisplay(*display) == requestedValue) {
614 orderedDisplays.append(display);
615 allDisplays.erase(it);
616 break;
617 }
618 }
619 }
620
621 // Place all unordered displays to the end of list
622 orderedDisplays.append(allDisplays);
623
624 return orderedDisplays;
625}
626
627void QQnxIntegration::createDisplays()
628{
629 qCDebug(lcQpaQnx) << Q_FUNC_INFO;
630 // Query number of displays
631 int displayCount = 0;
632 int result = screen_get_context_property_iv(m_screenContext, SCREEN_PROPERTY_DISPLAY_COUNT,
633 &displayCount);
634 Q_SCREEN_CRITICALERROR(result, "Failed to query display count");
635
636 if (Q_UNLIKELY(displayCount < 1)) {
637 // Never happens, even if there's no display, libscreen returns 1
638 qFatal("QQnxIntegration: displayCount=%d", displayCount);
639 }
640
641 // Get all displays
642 screen_display_t *displays = (screen_display_t *)alloca(sizeof(screen_display_t) * displayCount);
643 result = screen_get_context_property_pv(m_screenContext, SCREEN_PROPERTY_DISPLAYS,
644 (void **)displays);
645 QList<screen_display_t *> orderedDisplays = sortDisplays(displays, displayCount);
646 Q_SCREEN_CRITICALERROR(result, "Failed to query displays");
647
648 // If it's primary, we create a QScreen for it even if it's not attached
649 // since Qt will dereference QGuiApplication::primaryScreen()
650 createDisplay(*orderedDisplays[0], /*isPrimary=*/true);
651
652 for (int i=1; i<displayCount; i++) {
653 int isAttached = 1;
654 result = screen_get_display_property_iv(*orderedDisplays[i], SCREEN_PROPERTY_ATTACHED,
655 &isAttached);
656 Q_SCREEN_CHECKERROR(result, "Failed to query display attachment");
657
658 if (!isAttached) {
659 qCDebug(lcQpaQnx) << "Skipping non-attached display " << i;
660 continue;
661 }
662
663 qCDebug(lcQpaQnx) << "Creating screen for display " << i;
664
665 createDisplay(*orderedDisplays[i], /*isPrimary=*/false);
666 } // of displays iteration
667}
668
669void QQnxIntegration::createDisplay(screen_display_t display, bool isPrimary)
670{
671 QQnxScreen *screen = new QQnxScreen(m_screenContext, display, isPrimary);
672 m_screens.append(screen);
673 QWindowSystemInterface::handleScreenAdded(screen);
675
676 QObject::connect(m_screenEventHandler, SIGNAL(newWindowCreated(void*)),
677 screen, SLOT(newWindowCreated(void*)));
678 QObject::connect(m_screenEventHandler, SIGNAL(windowClosed(void*)),
679 screen, SLOT(windowClosed(void*)));
680
681 QObject::connect(m_navigatorEventHandler, SIGNAL(rotationChanged(int)), screen, SLOT(setRotation(int)));
682 QObject::connect(m_navigatorEventHandler, SIGNAL(windowGroupActivated(QByteArray)), screen, SLOT(activateWindowGroup(QByteArray)));
683 QObject::connect(m_navigatorEventHandler, SIGNAL(windowGroupDeactivated(QByteArray)), screen, SLOT(deactivateWindowGroup(QByteArray)));
684 QObject::connect(m_navigatorEventHandler, SIGNAL(windowGroupStateChanged(QByteArray,Qt::WindowState)),
685 screen, SLOT(windowGroupStateChanged(QByteArray,Qt::WindowState)));
686}
687
689{
690 Q_CHECK_PTR(screen);
691 Q_ASSERT(m_screens.contains(screen));
692 m_screens.removeAll(screen);
693 QWindowSystemInterface::handleScreenRemoved(screen);
694}
695
696void QQnxIntegration::destroyDisplays()
697{
698 qCDebug(lcQpaQnx) << Q_FUNC_INFO;
699
700 Q_FOREACH (QQnxScreen *screen, m_screens) {
701 QWindowSystemInterface::handleScreenRemoved(screen);
702 }
703 m_screens.clear();
704}
705
706QQnxScreen *QQnxIntegration::screenForNative(screen_display_t qnxScreen) const
707{
708 Q_FOREACH (QQnxScreen *screen, m_screens) {
709 if (screen->nativeDisplay() == qnxScreen)
710 return screen;
711 }
712
713 return 0;
714}
715
717{
718 return m_screens.first();
719}
720
722{
723 return m_options;
724}
725
727{
728 return m_screenContext;
729}
730
732{
733 return m_screenContextId;
734}
735
737{
738 return m_navigatorEventHandler;
739}
740
742{
743 // If QQNX_PPS is defined then we have navigator
744 return m_navigator != 0;
745}
746
747#if QT_CONFIG(opengl)
748void QQnxIntegration::createEglDisplay()
749{
750 qCDebug(lcQpaQnx) << Q_FUNC_INFO;
751
752 // Initialize connection to EGL
753 m_eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
754 if (Q_UNLIKELY(m_eglDisplay == EGL_NO_DISPLAY))
755 qFatal("QQnxiIntegration: failed to obtain EGL display: %x", eglGetError());
756
757 EGLBoolean eglResult = eglInitialize(m_eglDisplay, 0, 0);
758 if (Q_UNLIKELY(eglResult != EGL_TRUE))
759 qFatal("QQnxIntegration: failed to initialize EGL display, err=%d", eglGetError());
760}
761
762void QQnxIntegration::destroyEglDisplay()
763{
764 qCDebug(lcQpaQnx) << Q_FUNC_INFO;
765
766 // Close connection to EGL
767 eglTerminate(m_eglDisplay);
768}
769#endif
770
771QT_END_NAMESPACE
QAbstractEventDispatcher * createEventDispatcher() const override
Factory function for the GUI event dispatcher.
bool hasCapability(QPlatformIntegration::Capability cap) const override
QPlatformNativeInterface * nativeInterface() const override
QQnxNavigatorEventHandler * navigatorEventHandler()
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
Options options() const
QQnxScreen * primaryDisplay() const
void removeDisplay(QQnxScreen *screen)
QVariant styleHint(StyleHint hint) const override
QPlatformServices * services() const override
void moveToScreen(QWindow *window, int screen)
QPlatformInputContext * inputContext() const override
Returns the platforms input context.
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
QQnxNativeInterface(QQnxIntegration *integration)
void setScreenEventThread(QQnxScreenEventThread *eventThread)
int depth() const override
Reimplement in subclass to return current depth of the screen.
void adjustOrientation()
QQnxServices(QQnxAbstractNavigator *navigator)
The QQnxWindow is the base class of the various classes used as instances of QPlatformWindow in the Q...
Definition qqnxwindow.h:32
void setScreen(QQnxScreen *platformScreen)
#define Q_SCREEN_CRITICALERROR(x, message)
Definition qqnxglobal.h:20
#define Q_SCREEN_CHECKERROR(x, message)
Definition qqnxglobal.h:17
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 &paramList)
static QQnxIntegration::Options parseOptions(const QStringList &paramList)