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
4#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
5
6#include "qqnxglobal.h"
7
12#include "qqnxscreen.h"
14#include "qqnxwindow.h"
18#include "qqnxservices.h"
19
22#if !defined(QT_NO_OPENGL)
23#include "qqnxeglwindow.h"
24#endif
25
26#if QT_CONFIG(vulkan)
27#include "qqnxvulkanwindow.h"
28#include "qqnxvulkaninstance.h"
29#endif
30
31#if QT_CONFIG(qqnx_pps)
32#include "qqnxnavigatorpps.h"
33#include "qqnxnavigatoreventnotifier.h"
34#include "qqnxvirtualkeyboardpps.h"
35#endif
36
37#if QT_CONFIG(qqnx_pps)
38# include "qqnxbuttoneventnotifier.h"
39# include "qqnxclipboard.h"
40#endif
41
42#if QT_CONFIG(qqnx_imf)
43# include "qqnxinputcontext_imf.h"
44#else
46#endif
47
48#include <qpa/qplatforminputcontextfactory_p.h>
49#include <qpa/qplatforminputcontext.h>
50
51#include "private/qgenericunixfontdatabase_p.h"
52#include "private/qgenericunixeventdispatcher_p.h"
53
54#include <qpa/qplatformwindow.h>
55#include <qpa/qwindowsysteminterface.h>
56
57#include <QtGui/private/qguiapplication_p.h>
58#include <QtGui/private/qrhibackingstore_p.h>
59
60#if !defined(QT_NO_OPENGL)
61#include "qqnxglcontext.h"
62#include <QtGui/QOpenGLContext>
63#endif
64
65#include <private/qsimpledrag_p.h>
66
67#include <QtCore/QDebug>
68#include <QtCore/QJsonDocument>
69#include <QtCore/QJsonObject>
70#include <QtCore/QJsonArray>
71#include <QtCore/QFile>
72#include <errno.h>
73
74QT_BEGIN_NAMESPACE
75
76// Q_LOGGING_CATEGORY(lcQpaQnx, "qt.qpa.qnx");
77
78using namespace Qt::StringLiterals;
79
81
82static inline QQnxIntegration::Options parseOptions(const QStringList &paramList)
83{
84 QQnxIntegration::Options options = QQnxIntegration::NoOptions;
85 if (!paramList.contains("no-fullscreen"_L1)) {
87 }
88
89 if (paramList.contains("flush-screen-context"_L1)) {
91 }
92
93 if (paramList.contains("rootwindow"_L1)) {
95 }
96
97 if (!paramList.contains("disable-EGL_KHR_surfaceless_context"_L1)) {
99 }
100
101 if (paramList.contains("desktop"_L1)) {
102 options |= QQnxIntegration::Desktop;
103 }
104
105 return options;
106}
107
108static inline int getContextCapabilities(const QStringList &paramList)
109{
110 constexpr auto contextCapabilitiesPrefix = "screen-context-capabilities="_L1;
111 int contextCapabilities = SCREEN_APPLICATION_CONTEXT;
112 for (const QString &param : paramList) {
113 if (param.startsWith(contextCapabilitiesPrefix)) {
114 auto value = QStringView{param}.mid(contextCapabilitiesPrefix.length());
115 bool ok = false;
116 contextCapabilities = value.toInt(&ok, 0);
117 if (!ok)
118 contextCapabilities = SCREEN_APPLICATION_CONTEXT;
119 }
120 }
121 return contextCapabilities;
122}
123
124QQnxIntegration::QQnxIntegration(const QStringList &paramList)
125 : QPlatformIntegration()
126 , m_screenContextId(256, 0)
127 , m_screenEventThread(0)
128 , m_navigatorEventHandler(new QQnxNavigatorEventHandler())
129 , m_virtualKeyboard(0)
130 , m_inputContext(0)
131#if QT_CONFIG(qqnx_pps)
132 , m_navigatorEventNotifier(0)
133 , m_buttonsNotifier(new QQnxButtonEventNotifier())
134#endif
135 , m_qpaInputContext(0)
136 , m_fontDatabase(new QGenericUnixFontDatabase())
137 , m_eventDispatcher(createUnixEventDispatcher())
138 , m_nativeInterface(new QQnxNativeInterface(this))
139 , m_screenEventHandler(new QQnxScreenEventHandler(this))
140#if !defined(QT_NO_CLIPBOARD)
141 , m_clipboard(0)
142#endif
143 , m_navigator(0)
144#if QT_CONFIG(draganddrop)
145 , m_drag(new QSimpleDrag())
146#endif
147#if QT_CONFIG(opengl)
148 , m_eglDisplay(EGL_NO_DISPLAY)
149#endif
150{
151 ms_instance = this;
152 m_options = parseOptions(paramList);
153 qCDebug(lcQpaQnx) << Q_FUNC_INFO;
154
155 // Open connection to QNX composition manager
156 if (screen_create_context(&m_screenContext, getContextCapabilities(paramList))) {
157 qFatal("%s - Screen: Failed to create screen context - Error: %s (%i)",
158 Q_FUNC_INFO, strerror(errno), errno);
159 }
160 screen_get_context_property_cv(m_screenContext,
161 SCREEN_PROPERTY_ID,
162 m_screenContextId.size(),
163 m_screenContextId.data());
164 m_screenContextId.resize(strlen(m_screenContextId.constData()));
165
166#if QT_CONFIG(qqnx_pps)
167 // Create/start navigator event notifier
168 m_navigatorEventNotifier = new QQnxNavigatorEventNotifier(m_navigatorEventHandler);
169
170 // delay invocation of start() to the time the event loop is up and running
171 // needed to have the QThread internals of the main thread properly initialized
172 QMetaObject::invokeMethod(m_navigatorEventNotifier, "start", Qt::QueuedConnection);
173#endif
174
175#if QT_CONFIG(opengl)
176 createEglDisplay();
177#endif
178
179 // Create/start event thread
180 m_screenEventThread = new QQnxScreenEventThread(m_screenContext);
181 m_screenEventHandler->setScreenEventThread(m_screenEventThread);
182 m_screenEventThread->start();
183
184 m_qpaInputContext = QPlatformInputContextFactory::create();
185
186#if QT_CONFIG(qqnx_pps)
187 if (!m_qpaInputContext) {
188 // Create/start the keyboard class.
189 m_virtualKeyboard = new QQnxVirtualKeyboardPps();
190
191 // delay invocation of start() to the time the event loop is up and running
192 // needed to have the QThread internals of the main thread properly initialized
193 QMetaObject::invokeMethod(m_virtualKeyboard, "start", Qt::QueuedConnection);
194 }
195#endif
196
197#if QT_CONFIG(qqnx_pps)
198 m_navigator = new QQnxNavigatorPps();
199#endif
200
201 createDisplays();
202
203 if (m_virtualKeyboard) {
204 // TODO check if we need to do this for all screens or only the primary one
205 QObject::connect(m_virtualKeyboard, SIGNAL(heightChanged(int)),
206 primaryDisplay(), SLOT(keyboardHeightChanged(int)));
207
208#if QT_CONFIG(qqnx_pps)
209 // Set up the input context
210 m_inputContext = new QQnxInputContext(this, *m_virtualKeyboard);
211#if QT_CONFIG(qqnx_imf)
212 m_screenEventHandler->addScreenEventFilter(m_inputContext);
213#endif
214#endif
215 }
216
217#if QT_CONFIG(qqnx_pps)
218 // delay invocation of start() to the time the event loop is up and running
219 // needed to have the QThread internals of the main thread properly initialized
220 QMetaObject::invokeMethod(m_buttonsNotifier, "start", Qt::QueuedConnection);
221#endif
222}
223
225{
226 qCDebug(lcQpaQnx) << "Platform plugin shutdown begin";
227 delete m_nativeInterface;
228
229#if QT_CONFIG(draganddrop)
230 // Destroy the drag object
231 delete m_drag;
232#endif
233
234#if !defined(QT_NO_CLIPBOARD)
235 // Delete the clipboard
236 delete m_clipboard;
237#endif
238
239 // Stop/destroy navigator event notifier
240#if QT_CONFIG(qqnx_pps)
241 delete m_navigatorEventNotifier;
242#endif
243 delete m_navigatorEventHandler;
244
245 // Stop/destroy screen event thread
246 delete m_screenEventThread;
247
248 // In case the event-dispatcher was never transferred to QCoreApplication
249 delete m_eventDispatcher;
250
251 delete m_screenEventHandler;
252
253 // Destroy all displays
254 destroyDisplays();
255
256 // Close connection to QNX composition manager
257 screen_destroy_context(m_screenContext);
258
259#if QT_CONFIG(opengl)
260 destroyEglDisplay();
261#endif
262
263#if QT_CONFIG(qqnx_pps)
264 // Destroy the hardware button notifier
265 delete m_buttonsNotifier;
266
267 // Destroy input context
268 delete m_inputContext;
269#endif
270 delete m_qpaInputContext;
271
272 // Destroy the keyboard class.
273 delete m_virtualKeyboard;
274
275 // Destroy services class
276 delete m_services;
277
278 // Destroy navigator interface
279 delete m_navigator;
280
281 ms_instance = nullptr;
282
283 qCDebug(lcQpaQnx) << "Platform plugin shutdown end";
284}
285
286bool QQnxIntegration::hasCapability(QPlatformIntegration::Capability cap) const
287{
288 qCDebug(lcQpaQnx) << Q_FUNC_INFO;
289 switch (cap) {
290 case MultipleWindows:
291 case ForeignWindows:
292 case ThreadedPixmaps:
293 return true;
294#if !defined(QT_NO_OPENGL)
295 case OpenGL:
296 case ThreadedOpenGL:
297 case BufferQueueingOpenGL:
298 return true;
299#endif
300 default:
301 return QPlatformIntegration::hasCapability(cap);
302 }
303}
304
305QPlatformWindow *QQnxIntegration::createForeignWindow(QWindow *window, WId nativeHandle) const
306{
307 screen_window_t screenWindow = reinterpret_cast<screen_window_t>(nativeHandle);
308 if (this->window(screenWindow)) {
309 qWarning() << "QWindow already created for foreign window"
310 << screenWindow;
311 return nullptr;
312 }
313
314 return new QQnxForeignWindow(window, m_screenContext, screenWindow);
315}
316
318{
319 qCDebug(lcQpaQnx) << Q_FUNC_INFO;
320 QSurface::SurfaceType surfaceType = window->surfaceType();
321 const bool needRootWindow = options() & RootWindow;
322 switch (surfaceType) {
323 case QSurface::RasterSurface:
324 return new QQnxRasterWindow(window, m_screenContext, needRootWindow);
325#if !defined(QT_NO_OPENGL)
326 case QSurface::OpenGLSurface:
327 return new QQnxEglWindow(window, m_screenContext, needRootWindow);
328#endif
329#if QT_CONFIG(vulkan)
330 case QSurface::VulkanSurface:
331 return new QQnxVulkanWindow(window, m_screenContext, needRootWindow);
332#endif
333 default:
334 qFatal("QQnxWindow: unsupported window API");
335 }
336 return 0;
337}
338
339#if QT_CONFIG(vulkan)
340QPlatformVulkanInstance *QQnxIntegration::createPlatformVulkanInstance(QVulkanInstance *instance) const
341{
342 return new QQnxVulkanInstance(instance);
343}
344#endif
345
347{
348 QSurface::SurfaceType surfaceType = window->surfaceType();
349 qCDebug(lcQpaQnx) << Q_FUNC_INFO << surfaceType;
350 switch (surfaceType) {
351 case QSurface::RasterSurface:
352 return new QQnxRasterBackingStore(window);
353#if !defined(QT_NO_OPENGL)
354 // Return a QRhiBackingStore for non-raster surface windows
355 case QSurface::OpenGLSurface:
356 return new QRhiBackingStore(window);
357#endif
358#if QT_CONFIG(vulkan)
359 case QSurface::VulkanSurface:
360 return new QRhiBackingStore(window);
361#endif
362 default:
363 return nullptr;
364 }
365}
366
367#if !defined(QT_NO_OPENGL)
368QPlatformOpenGLContext *QQnxIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
369{
370 qCDebug(lcQpaQnx) << Q_FUNC_INFO;
371
372 // Get color channel sizes from window format
373 QSurfaceFormat format = context->format();
374 int alphaSize = format.alphaBufferSize();
375 int redSize = format.redBufferSize();
376 int greenSize = format.greenBufferSize();
377 int blueSize = format.blueBufferSize();
378
379 // Check if all channels are don't care
380 if (alphaSize == -1 && redSize == -1 && greenSize == -1 && blueSize == -1) {
381 // Set color channels based on depth of window's screen
382 QQnxScreen *screen = static_cast<QQnxScreen*>(context->screen()->handle());
383 int depth = screen->depth();
384 if (depth == 32) {
385 // SCREEN_FORMAT_RGBA8888
386 alphaSize = 8;
387 redSize = 8;
388 greenSize = 8;
389 blueSize = 8;
390 } else {
391 // SCREEN_FORMAT_RGB565
392 alphaSize = 0;
393 redSize = 5;
394 greenSize = 6;
395 blueSize = 5;
396 }
397 } else {
398 // Choose best match based on supported pixel formats
399 if (alphaSize <= 0 && redSize <= 5 && greenSize <= 6 && blueSize <= 5) {
400 // SCREEN_FORMAT_RGB565
401 alphaSize = 0;
402 redSize = 5;
403 greenSize = 6;
404 blueSize = 5;
405 } else {
406 // SCREEN_FORMAT_RGBA8888
407 alphaSize = 8;
408 redSize = 8;
409 greenSize = 8;
410 blueSize = 8;
411 }
412 }
413
414 // Update color channel sizes in window format
415 format.setAlphaBufferSize(alphaSize);
416 format.setRedBufferSize(redSize);
417 format.setGreenBufferSize(greenSize);
418 format.setBlueBufferSize(blueSize);
419 context->setFormat(format);
420
421 QQnxGLContext *ctx = new QQnxGLContext(context->format(), context->shareHandle());
422 return ctx;
423}
424#endif
425
427{
428 qCDebug(lcQpaQnx) << Q_FUNC_INFO;
429 if (m_qpaInputContext)
430 return m_qpaInputContext;
431 return m_inputContext;
432}
433
434void QQnxIntegration::moveToScreen(QWindow *window, int screen)
435{
436 qCDebug(lcQpaQnx) << Q_FUNC_INFO << "w =" << window << ", s =" << screen;
437
438 // get platform window used by widget
439 QQnxWindow *platformWindow = static_cast<QQnxWindow *>(window->handle());
440
441 // lookup platform screen by index
442 QQnxScreen *platformScreen = m_screens.at(screen);
443
444 // move the platform window to the platform screen
445 platformWindow->setScreen(platformScreen);
446}
447
449{
450 qCDebug(lcQpaQnx) << Q_FUNC_INFO;
451
452 // We transfer ownersip of the event-dispatcher to QtCoreApplication
453 QAbstractEventDispatcher *eventDispatcher = m_eventDispatcher;
454 m_eventDispatcher = 0;
455
456 return eventDispatcher;
457}
458
460{
461 return m_nativeInterface;
462}
463
464#if !defined(QT_NO_CLIPBOARD)
466{
467 qCDebug(lcQpaQnx) << Q_FUNC_INFO;
468
469#if QT_CONFIG(qqnx_pps)
470 if (!m_clipboard)
471 m_clipboard = new QQnxClipboard;
472#endif
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:31
void setScreen(QQnxScreen *platformScreen)
#define Q_SCREEN_CRITICALERROR(x, message)
Definition qqnxglobal.h:16
#define Q_SCREEN_CHECKERROR(x, message)
Definition qqnxglobal.h:13
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)