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