1 /*************************************************************************** 2 ** 3 ** Copyright (C) 2011 - 2013 BlackBerry Limited. All rights reserved. 4 ** Contact: https://www.qt.io/licensing/ 5 ** 6 ** This file is part of the plugins of the Qt Toolkit. 7 ** 8 ** $QT_BEGIN_LICENSE:LGPL$ 9 ** Commercial License Usage 10 ** Licensees holding valid commercial Qt licenses may use this file in 11 ** accordance with the commercial license agreement provided with the 12 ** Software or, alternatively, in accordance with the terms contained in 13 ** a written agreement between you and The Qt Company. For licensing terms 14 ** and conditions see https://www.qt.io/terms-conditions. For further 15 ** information use the contact form at https://www.qt.io/contact-us. 16 ** 17 ** GNU Lesser General Public License Usage 18 ** Alternatively, this file may be used under the terms of the GNU Lesser 19 ** General Public License version 3 as published by the Free Software 20 ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 ** packaging of this file. Please review the following information to 22 ** ensure the GNU Lesser General Public License version 3 requirements 23 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 ** 25 ** GNU General Public License Usage 26 ** Alternatively, this file may be used under the terms of the GNU 27 ** General Public License version 2.0 or (at your option) the GNU General 28 ** Public license version 3 or any later version approved by the KDE Free 29 ** Qt Foundation. The licenses are as published by the Free Software 30 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 ** included in the packaging of this file. Please review the following 32 ** information to ensure the GNU General Public License requirements will 33 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 ** https://www.gnu.org/licenses/gpl-3.0.html. 35 ** 36 ** $QT_END_LICENSE$ 37 ** 38 ****************************************************************************/ 39 40 #ifndef QQNXINTEGRATION_H 41 #define QQNXINTEGRATION_H 42 43 #include <qpa/qplatformintegration.h> 44 #include <private/qtguiglobal_p.h> 45 #include <QtCore/qmutex.h> 46 47 #include <screen/screen.h> 48 49 #if QT_CONFIG(opengl) 50 #include <EGL/egl.h> 51 #endif 52 53 QT_BEGIN_NAMESPACE 54 55 class QQnxScreenEventThread; 56 class QQnxFileDialogHelper; 57 class QQnxNativeInterface; 58 class QQnxWindow; 59 class QQnxScreen; 60 class QQnxScreenEventHandler; 61 class QQnxNavigatorEventHandler; 62 class QQnxAbstractNavigator; 63 class QQnxAbstractVirtualKeyboard; 64 class QQnxServices; 65 66 class QSimpleDrag; 67 68 #if QT_CONFIG(qqnx_pps) 69 class QQnxInputContext; 70 class QQnxNavigatorEventNotifier; 71 class QQnxButtonEventNotifier; 72 #endif 73 74 #if !defined(QT_NO_CLIPBOARD) 75 class QQnxClipboard; 76 #endif 77 78 template<class K, class V> class QHash; 79 typedef QHash<screen_window_t, QWindow *> QQnxWindowMapper; 80 81 class QQnxIntegration : public QPlatformIntegration 82 { 83 public: 84 enum Option { // Options to be passed on command line. 85 NoOptions = 0x0, 86 FullScreenApplication = 0x1, 87 RootWindow = 0x2, 88 AlwaysFlushScreenContext = 0x4, 89 SurfacelessEGLContext = 0x8 90 }; 91 Q_DECLARE_FLAGS(Options, Option) 92 explicit QQnxIntegration(const QStringList ¶mList); 93 ~QQnxIntegration(); 94 instance()95 static QQnxIntegration *instance() { return ms_instance; } 96 97 bool hasCapability(QPlatformIntegration::Capability cap) const override; 98 99 QPlatformWindow *createForeignWindow(QWindow *window, WId nativeHandle) const override; 100 QPlatformWindow *createPlatformWindow(QWindow *window) const override; 101 QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override; 102 103 #if QT_CONFIG(opengl) eglDisplay()104 EGLDisplay eglDisplay() const { return m_eglDisplay; } 105 QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override; 106 #endif 107 108 #if QT_CONFIG(qqnx_pps) 109 QPlatformInputContext *inputContext() const override; 110 #endif 111 112 void moveToScreen(QWindow *window, int screen); 113 114 bool supportsNavigatorEvents() const; 115 116 QAbstractEventDispatcher *createEventDispatcher() const override; 117 fontDatabase()118 QPlatformFontDatabase *fontDatabase() const override { return m_fontDatabase; } 119 120 QPlatformNativeInterface *nativeInterface() const override; 121 122 #if !defined(QT_NO_CLIPBOARD) 123 QPlatformClipboard *clipboard() const override; 124 #endif 125 #if QT_CONFIG(draganddrop) 126 QPlatformDrag *drag() const override; 127 #endif 128 QVariant styleHint(StyleHint hint) const override; 129 130 QPlatformServices *services() const override; 131 132 QWindow *window(screen_window_t qnxWindow) const; 133 134 QQnxScreen *screenForNative(screen_display_t qnxScreen) const; 135 136 void createDisplay(screen_display_t display, bool isPrimary); 137 void removeDisplay(QQnxScreen *screen); 138 QQnxScreen *primaryDisplay() const; 139 Options options() const; 140 screen_context_t screenContext(); 141 QByteArray screenContextId(); 142 143 QQnxNavigatorEventHandler *navigatorEventHandler(); 144 145 private: 146 void createDisplays(); 147 void destroyDisplays(); 148 149 void addWindow(screen_window_t qnxWindow, QWindow *window); 150 void removeWindow(screen_window_t qnxWindow); 151 QList<screen_display_t *> sortDisplays(screen_display_t *displays, 152 int displayCount); 153 154 screen_context_t m_screenContext; 155 QByteArray m_screenContextId; 156 QQnxScreenEventThread *m_screenEventThread; 157 QQnxNavigatorEventHandler *m_navigatorEventHandler; 158 QQnxAbstractVirtualKeyboard *m_virtualKeyboard; 159 #if QT_CONFIG(qqnx_pps) 160 QQnxNavigatorEventNotifier *m_navigatorEventNotifier; 161 QQnxInputContext *m_inputContext; 162 QQnxButtonEventNotifier *m_buttonsNotifier; 163 #endif 164 QPlatformInputContext *m_qpaInputContext; 165 QQnxServices *m_services; 166 QPlatformFontDatabase *m_fontDatabase; 167 mutable QAbstractEventDispatcher *m_eventDispatcher; 168 QQnxNativeInterface *m_nativeInterface; 169 QList<QQnxScreen*> m_screens; 170 QQnxScreenEventHandler *m_screenEventHandler; 171 #if !defined(QT_NO_CLIPBOARD) 172 mutable QQnxClipboard* m_clipboard; 173 #endif 174 QQnxAbstractNavigator *m_navigator; 175 #if QT_CONFIG(draganddrop) 176 QSimpleDrag *m_drag; 177 #endif 178 QQnxWindowMapper m_windowMapper; 179 mutable QMutex m_windowMapperMutex; 180 181 Options m_options; 182 183 #if QT_CONFIG(opengl) 184 EGLDisplay m_eglDisplay; 185 void createEglDisplay(); 186 void destroyEglDisplay(); 187 #endif 188 189 static QQnxIntegration *ms_instance; 190 191 friend class QQnxWindow; 192 }; 193 194 QT_END_NAMESPACE 195 196 #endif // QQNXINTEGRATION_H 197