| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/plugins/platforms/eglfs/qeglfsintegration.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||
| 2 | ** | - | ||||||
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. | - | ||||||
| 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 | #include <QtCore/qtextstream.h> | - | ||||||
| 41 | #include <QtGui/private/qguiapplication_p.h> | - | ||||||
| 42 | - | |||||||
| 43 | #include <qpa/qplatformwindow.h> | - | ||||||
| 44 | #include <QtGui/QSurfaceFormat> | - | ||||||
| 45 | #include <QtGui/QOpenGLContext> | - | ||||||
| 46 | #include <QtGui/QScreen> | - | ||||||
| 47 | #include <QtGui/QOffscreenSurface> | - | ||||||
| 48 | #include <QtGui/QWindow> | - | ||||||
| 49 | #include <QtCore/QLoggingCategory> | - | ||||||
| 50 | #include <qpa/qwindowsysteminterface.h> | - | ||||||
| 51 | #include <qpa/qplatforminputcontextfactory_p.h> | - | ||||||
| 52 | #include <private/qgenericunixthemes_p.h> | - | ||||||
| 53 | - | |||||||
| 54 | #include "qeglfsintegration.h" | - | ||||||
| 55 | #include "qeglfswindow.h" | - | ||||||
| 56 | #include "qeglfshooks.h" | - | ||||||
| 57 | #include "qeglfscontext.h" | - | ||||||
| 58 | #include "qeglfsoffscreenwindow.h" | - | ||||||
| 59 | #include "qeglfscursor.h" | - | ||||||
| 60 | - | |||||||
| 61 | #include <QtPlatformSupport/private/qeglconvenience_p.h> | - | ||||||
| 62 | #include <QtPlatformSupport/private/qeglplatformcontext_p.h> | - | ||||||
| 63 | #include <QtPlatformSupport/private/qeglpbuffer_p.h> | - | ||||||
| 64 | - | |||||||
| 65 | #include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h> | - | ||||||
| 66 | #include <QtPlatformSupport/private/qgenericunixservices_p.h> | - | ||||||
| 67 | #include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h> | - | ||||||
| 68 | #include <QtPlatformSupport/private/qfbvthandler_p.h> | - | ||||||
| 69 | #include <QtPlatformSupport/private/qopenglcompositorbackingstore_p.h> | - | ||||||
| 70 | - | |||||||
| 71 | #include <QtPlatformHeaders/QEGLNativeContext> | - | ||||||
| 72 | - | |||||||
| 73 | #ifndef QT_NO_LIBINPUT | - | ||||||
| 74 | #include <QtPlatformSupport/private/qlibinputhandler_p.h> | - | ||||||
| 75 | #endif | - | ||||||
| 76 | - | |||||||
| 77 | #if !defined(QT_NO_EVDEV) && (!!defined(Q_OS_ANDROID) | - | ||||||
| || defined(Q_OS_ANDROID_NO_SDK))#include <QtPlatformSupport/private/qevdevmousemanager_p.h> | ||||||||
| 79 | #include <QtPlatformSupport/private/qevdevkeyboardmanager_p.h> | - | ||||||
| 80 | #include <QtPlatformSupport/private/qevdevtouchmanager_p.h> | - | ||||||
| 81 | #endif | - | ||||||
| 82 | - | |||||||
| 83 | #if !defined(QT_NO_TSLIB) && (!!defined(Q_OS_ANDROID) | - | ||||||
| || defined(Q_OS_ANDROID_NO_SDK))#include <QtPlatformSupport/private/qtslib_p.h> | ||||||||
| 85 | #endif | - | ||||||
| 86 | - | |||||||
| 87 | #include <QtPlatformHeaders/qeglfsfunctions.h> | - | ||||||
| 88 | - | |||||||
| 89 | static void initResources() | - | ||||||
| 90 | { | - | ||||||
| 91 | #ifndef QT_NO_CURSOR | - | ||||||
| 92 | Q_INIT_RESOURCE(cursor); | - | ||||||
| 93 | #endif | - | ||||||
| 94 | } | - | ||||||
| 95 | - | |||||||
| 96 | QT_BEGIN_NAMESPACE | - | ||||||
| 97 | - | |||||||
| 98 | QEglFSIntegration::QEglFSIntegration() | - | ||||||
| 99 | : m_display(EGL_NO_DISPLAY), | - | ||||||
| 100 | m_inputContext(0), | - | ||||||
| 101 | m_fontDb(new QGenericUnixFontDatabase), | - | ||||||
| 102 | m_services(new QGenericUnixServices), | - | ||||||
| 103 | m_kbdMgr(0), | - | ||||||
| 104 | m_disableInputHandlers(false) | - | ||||||
| 105 | { | - | ||||||
| 106 | m_disableInputHandlers = qEnvironmentVariableIntValue("QT_QPA_EGLFS_DISABLE_INPUT"); | - | ||||||
| 107 | - | |||||||
| 108 | initResources(); | - | ||||||
| 109 | } | - | ||||||
| 110 | - | |||||||
| 111 | void QEglFSIntegration::addScreen(QPlatformScreen *screen) | - | ||||||
| 112 | { | - | ||||||
| 113 | screenAdded(screen); | - | ||||||
| 114 | } | - | ||||||
| 115 | - | |||||||
| 116 | void QEglFSIntegration::removeScreen(QPlatformScreen *screen) | - | ||||||
| 117 | { | - | ||||||
| 118 | destroyScreen(screen); | - | ||||||
| 119 | } | - | ||||||
| 120 | - | |||||||
| 121 | void QEglFSIntegration::initialize() | - | ||||||
| 122 | { | - | ||||||
| 123 | qt_egl_device_integration()->platformInit(); | - | ||||||
| 124 | - | |||||||
| 125 | m_display = qt_egl_device_integration()->createDisplay(nativeDisplay()); | - | ||||||
| 126 | if (Q_UNLIKELY(m_display == EGL_NO_DISPLAY)))
| 0 | ||||||
| 127 | qFatal("Could not open egl display"); never executed: QMessageLogger(__FILE__, 127, __PRETTY_FUNCTION__).fatal("Could not open egl display"); | 0 | ||||||
| 128 | - | |||||||
| 129 | EGLint major, minor; | - | ||||||
| 130 | if (Q_UNLIKELY(!eglInitialize(m_display, &major, &minor)))))
| 0 | ||||||
| 131 | qFatal("Could not initialize egl display"); never executed: QMessageLogger(__FILE__, 131, __PRETTY_FUNCTION__).fatal("Could not initialize egl display"); | 0 | ||||||
| 132 | - | |||||||
| 133 | m_inputContext = QPlatformInputContextFactory::create(); | - | ||||||
| 134 | - | |||||||
| 135 | m_vtHandler.reset(new QFbVtHandler); | - | ||||||
| 136 | - | |||||||
| 137 | if (qt_egl_device_integration()->usesDefaultScreen())
| 0 | ||||||
| 138 | addScreen(new QEglFSScreen(display())); never executed: addScreen(new QEglFSScreen(display())); | 0 | ||||||
| 139 | else | - | ||||||
| 140 | qt_egl_device_integration()->screenInit(); never executed: qt_egl_device_integration()->screenInit(); | 0 | ||||||
| 141 | - | |||||||
| 142 | // Input code may rely on the screens, so do it only after the screen init. | - | ||||||
| 143 | if (!m_disableInputHandlers)
| 0 | ||||||
| 144 | createInputHandlers(); never executed: createInputHandlers(); | 0 | ||||||
| 145 | } never executed: end of block | 0 | ||||||
| 146 | - | |||||||
| 147 | void QEglFSIntegration::destroy() | - | ||||||
| 148 | { | - | ||||||
| 149 | foreach (QWindow *w, qGuiApp->topLevelWindows()) | - | ||||||
| 150 | w->destroy(); | - | ||||||
| 151 | - | |||||||
| 152 | qt_egl_device_integration()->screenDestroy(); | - | ||||||
| 153 | - | |||||||
| 154 | if (m_display != EGL_NO_DISPLAY) | - | ||||||
| 155 | eglTerminate(m_display); | - | ||||||
| 156 | - | |||||||
| 157 | qt_egl_device_integration()->platformDestroy(); | - | ||||||
| 158 | } | - | ||||||
| 159 | - | |||||||
| 160 | QAbstractEventDispatcher *QEglFSIntegration::createEventDispatcher() const | - | ||||||
| 161 | { | - | ||||||
| 162 | return createUnixEventDispatcher(); | - | ||||||
| 163 | } | - | ||||||
| 164 | - | |||||||
| 165 | QPlatformServices *QEglFSIntegration::services() const | - | ||||||
| 166 | { | - | ||||||
| 167 | return m_services.data(); | - | ||||||
| 168 | } | - | ||||||
| 169 | - | |||||||
| 170 | QPlatformFontDatabase *QEglFSIntegration::fontDatabase() const | - | ||||||
| 171 | { | - | ||||||
| 172 | return m_fontDb.data(); | - | ||||||
| 173 | } | - | ||||||
| 174 | - | |||||||
| 175 | QPlatformTheme *QEglFSIntegration::createPlatformTheme(const QString &name) const | - | ||||||
| 176 | { | - | ||||||
| 177 | return QGenericUnixTheme::createUnixTheme(name); never executed: return QGenericUnixTheme::createUnixTheme(name); | 0 | ||||||
| 178 | } | - | ||||||
| 179 | - | |||||||
| 180 | QPlatformBackingStore *QEglFSIntegration::createPlatformBackingStore(QWindow *window) const | - | ||||||
| 181 | { | - | ||||||
| 182 | QOpenGLCompositorBackingStore *bs = new QOpenGLCompositorBackingStore(window); | - | ||||||
| 183 | if (!window->handle()) | - | ||||||
| 184 | window->create(); | - | ||||||
| 185 | static_cast<QEglFSWindow *>(window->handle())->setBackingStore(bs); | - | ||||||
| 186 | return bs; | - | ||||||
| 187 | } | - | ||||||
| 188 | - | |||||||
| 189 | QPlatformWindow *QEglFSIntegration::createPlatformWindow(QWindow *window) const | - | ||||||
| 190 | { | - | ||||||
| 191 | QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents); | - | ||||||
| 192 | QEglFSWindow *w = qt_egl_device_integration()->createWindow(window); | - | ||||||
| 193 | w->create(); | - | ||||||
| 194 | if (window->type() != Qt::ToolTip) | - | ||||||
| 195 | w->requestActivateWindow(); | - | ||||||
| 196 | return w; | - | ||||||
| 197 | } | - | ||||||
| 198 | - | |||||||
| 199 | QPlatformOpenGLContext *QEglFSIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const | - | ||||||
| 200 | { | - | ||||||
| 201 | EGLDisplay dpy = context->screen() ? static_cast<QEglFSScreen *>(context->screen()->handle())->display() : display(); | - | ||||||
| 202 | QPlatformOpenGLContext *share = context->shareHandle(); | - | ||||||
| 203 | QVariant nativeHandle = context->nativeHandle(); | - | ||||||
| 204 | - | |||||||
| 205 | QEglFSContext *ctx; | - | ||||||
| 206 | QSurfaceFormat adjustedFormat = qt_egl_device_integration()->surfaceFormatFor(context->format()); | - | ||||||
| 207 | if (nativeHandle.isNull()) { | - | ||||||
| 208 | EGLConfig config = QEglFSIntegration::chooseConfig(dpy, adjustedFormat); | - | ||||||
| 209 | ctx = new QEglFSContext(adjustedFormat, share, dpy, &config, QVariant()); | - | ||||||
| 210 | } else { | - | ||||||
| 211 | ctx = new QEglFSContext(adjustedFormat, share, dpy, 0, nativeHandle); | - | ||||||
| 212 | } | - | ||||||
| 213 | nativeHandle = QVariant::fromValue<QEGLNativeContext>(QEGLNativeContext(ctx->eglContext(), dpy)); | - | ||||||
| 214 | - | |||||||
| 215 | context->setNativeHandle(nativeHandle); | - | ||||||
| 216 | return ctx; | - | ||||||
| 217 | } | - | ||||||
| 218 | - | |||||||
| 219 | QPlatformOffscreenSurface *QEglFSIntegration::createPlatformOffscreenSurface(QOffscreenSurface *surface) const | - | ||||||
| 220 | { | - | ||||||
| 221 | EGLDisplay dpy = surface->screen() ? static_cast<QEglFSScreen *>(surface->screen()->handle())->display() : display(); | - | ||||||
| 222 | QSurfaceFormat fmt = qt_egl_device_integration()->surfaceFormatFor(surface->requestedFormat()); | - | ||||||
| 223 | if (qt_egl_device_integration()->supportsPBuffers()) { | - | ||||||
| 224 | QEGLPlatformContext::Flags flags = 0; | - | ||||||
| 225 | if (!qt_egl_device_integration()->supportsSurfacelessContexts()) | - | ||||||
| 226 | flags |= QEGLPlatformContext::NoSurfaceless; | - | ||||||
| 227 | return new QEGLPbuffer(dpy, fmt, surface, flags); | - | ||||||
| 228 | } else { | - | ||||||
| 229 | return new QEglFSOffscreenWindow(dpy, fmt, surface); | - | ||||||
| 230 | } | - | ||||||
| 231 | // Never return null. Multiple QWindows are not supported by this plugin. | - | ||||||
| 232 | } | - | ||||||
| 233 | - | |||||||
| 234 | bool QEglFSIntegration::hasCapability(QPlatformIntegration::Capability cap) const | - | ||||||
| 235 | { | - | ||||||
| 236 | // We assume that devices will have more and not less capabilities | - | ||||||
| 237 | if (qt_egl_device_integration()->hasCapability(cap)) | - | ||||||
| 238 | return true; | - | ||||||
| 239 | - | |||||||
| 240 | switch (cap) { | - | ||||||
| 241 | case ThreadedPixmaps: return true; | - | ||||||
| 242 | case OpenGL: return true; | - | ||||||
| 243 | case ThreadedOpenGL: return true; | - | ||||||
| 244 | case WindowManagement: return false; | - | ||||||
| 245 | case RasterGLSurface: return true; | - | ||||||
| 246 | default: return QPlatformIntegration::hasCapability(cap); | - | ||||||
| 247 | } | - | ||||||
| 248 | } | - | ||||||
| 249 | - | |||||||
| 250 | QPlatformNativeInterface *QEglFSIntegration::nativeInterface() const | - | ||||||
| 251 | { | - | ||||||
| 252 | return const_cast<QEglFSIntegration *>(this); | - | ||||||
| 253 | } | - | ||||||
| 254 | - | |||||||
| 255 | enum ResourceType { | - | ||||||
| 256 | EglDisplay, | - | ||||||
| 257 | EglWindow, | - | ||||||
| 258 | EglContext, | - | ||||||
| 259 | EglConfig, | - | ||||||
| 260 | NativeDisplay, | - | ||||||
| 261 | XlibDisplay, | - | ||||||
| 262 | WaylandDisplay | - | ||||||
| 263 | }; | - | ||||||
| 264 | - | |||||||
| 265 | static int resourceType(const QByteArray &key) | - | ||||||
| 266 | { | - | ||||||
| 267 | static const QByteArray names[] = { // match ResourceType | - | ||||||
| 268 | QByteArrayLiteral("egldisplay"), | - | ||||||
| 269 | QByteArrayLiteral("eglwindow"), | - | ||||||
| 270 | QByteArrayLiteral("eglcontext"), | - | ||||||
| 271 | QByteArrayLiteral("eglconfig"), | - | ||||||
| 272 | QByteArrayLiteral("nativedisplay"), | - | ||||||
| 273 | QByteArrayLiteral("display"), | - | ||||||
| 274 | QByteArrayLiteral("server_wl_display") | - | ||||||
| 275 | }; | - | ||||||
| 276 | const QByteArray *end = names + sizeof(names) / sizeof(names[0]); | - | ||||||
| 277 | const QByteArray *result = std::find(names, end, key); | - | ||||||
| 278 | if (result == end) | - | ||||||
| 279 | result = std::find(names, end, key.toLower()); | - | ||||||
| 280 | return int(result - names); | - | ||||||
| 281 | } | - | ||||||
| 282 | - | |||||||
| 283 | void *QEglFSIntegration::nativeResourceForIntegration(const QByteArray &resource) | - | ||||||
| 284 | { | - | ||||||
| 285 | void *result = 0; | - | ||||||
| 286 | - | |||||||
| 287 | switch (resourceType(resource)) { | - | ||||||
| 288 | case EglDisplay: | - | ||||||
| 289 | result = display(); | - | ||||||
| 290 | break; | - | ||||||
| 291 | case NativeDisplay: | - | ||||||
| 292 | result = reinterpret_cast<void*>(nativeDisplay()); | - | ||||||
| 293 | break; | - | ||||||
| 294 | case WaylandDisplay: | - | ||||||
| 295 | result = qt_egl_device_integration()->wlDisplay(); | - | ||||||
| 296 | break; | - | ||||||
| 297 | default: | - | ||||||
| 298 | break; | - | ||||||
| 299 | } | - | ||||||
| 300 | - | |||||||
| 301 | return result; | - | ||||||
| 302 | } | - | ||||||
| 303 | - | |||||||
| 304 | void *QEglFSIntegration::nativeResourceForScreen(const QByteArray &resource, QScreen *) | - | ||||||
| 305 | { | - | ||||||
| 306 | void *result = 0; | - | ||||||
| 307 | - | |||||||
| 308 | switch (resourceType(resource)) { | - | ||||||
| 309 | case XlibDisplay: | - | ||||||
| 310 | // Play nice when using the x11 hooks: Be compatible with xcb that allows querying | - | ||||||
| 311 | // the X Display pointer, which is nothing but our native display. | - | ||||||
| 312 | result = reinterpret_cast<void*>(nativeDisplay()); | - | ||||||
| 313 | break; | - | ||||||
| 314 | default: | - | ||||||
| 315 | break; | - | ||||||
| 316 | } | - | ||||||
| 317 | - | |||||||
| 318 | return result; | - | ||||||
| 319 | } | - | ||||||
| 320 | - | |||||||
| 321 | void *QEglFSIntegration::nativeResourceForWindow(const QByteArray &resource, QWindow *window) | - | ||||||
| 322 | { | - | ||||||
| 323 | void *result = 0; | - | ||||||
| 324 | - | |||||||
| 325 | switch (resourceType(resource)) { | - | ||||||
| 326 | case EglDisplay: | - | ||||||
| 327 | if (window && window->handle()) | - | ||||||
| 328 | result = static_cast<QEglFSScreen *>(window->handle()->screen())->display(); | - | ||||||
| 329 | else | - | ||||||
| 330 | result = display(); | - | ||||||
| 331 | break; | - | ||||||
| 332 | case EglWindow: | - | ||||||
| 333 | if (window && window->handle()) | - | ||||||
| 334 | result = reinterpret_cast<void*>(static_cast<QEglFSWindow *>(window->handle())->eglWindow()); | - | ||||||
| 335 | break; | - | ||||||
| 336 | default: | - | ||||||
| 337 | break; | - | ||||||
| 338 | } | - | ||||||
| 339 | - | |||||||
| 340 | return result; | - | ||||||
| 341 | } | - | ||||||
| 342 | - | |||||||
| 343 | void *QEglFSIntegration::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) | - | ||||||
| 344 | { | - | ||||||
| 345 | void *result = 0; | - | ||||||
| 346 | - | |||||||
| 347 | switch (resourceType(resource)) { | - | ||||||
| 348 | case EglContext: | - | ||||||
| 349 | if (context->handle()) | - | ||||||
| 350 | result = static_cast<QEglFSContext *>(context->handle())->eglContext(); | - | ||||||
| 351 | break; | - | ||||||
| 352 | case EglConfig: | - | ||||||
| 353 | if (context->handle()) | - | ||||||
| 354 | result = static_cast<QEglFSContext *>(context->handle())->eglConfig(); | - | ||||||
| 355 | break; | - | ||||||
| 356 | case EglDisplay: | - | ||||||
| 357 | if (context->handle()) | - | ||||||
| 358 | result = static_cast<QEglFSContext *>(context->handle())->eglDisplay(); | - | ||||||
| 359 | break; | - | ||||||
| 360 | default: | - | ||||||
| 361 | break; | - | ||||||
| 362 | } | - | ||||||
| 363 | - | |||||||
| 364 | return result; | - | ||||||
| 365 | } | - | ||||||
| 366 | - | |||||||
| 367 | static void *eglContextForContext(QOpenGLContext *context) | - | ||||||
| 368 | { | - | ||||||
| 369 | Q_ASSERT(context); | - | ||||||
| 370 | - | |||||||
| 371 | QEglFSContext *handle = static_cast<QEglFSContext *>(context->handle()); | - | ||||||
| 372 | if (!handle) | - | ||||||
| 373 | return 0; | - | ||||||
| 374 | - | |||||||
| 375 | return handle->eglContext(); | - | ||||||
| 376 | } | - | ||||||
| 377 | - | |||||||
| 378 | QPlatformNativeInterface::NativeResourceForContextFunction QEglFSIntegration::nativeResourceFunctionForContext(const QByteArray &resource) | - | ||||||
| 379 | { | - | ||||||
| 380 | QByteArray lowerCaseResource = resource.toLower(); | - | ||||||
| 381 | if (lowerCaseResource == "get_egl_context") | - | ||||||
| 382 | return NativeResourceForContextFunction(eglContextForContext); | - | ||||||
| 383 | - | |||||||
| 384 | return 0; | - | ||||||
| 385 | } | - | ||||||
| 386 | - | |||||||
| 387 | QFunctionPointer QEglFSIntegration::platformFunction(const QByteArray &function) const | - | ||||||
| 388 | { | - | ||||||
| 389 | #if !defined(QT_NO_EVDEV) && (!!defined(Q_OS_ANDROID) | - | ||||||
| 390 | || defined(Q_OS_ANDROID_NO_SDK))if (function == QEglFSFunctions::loadKeymapTypeIdentifier())
| 0 | ||||||
| 391 | return QFunctionPointer(loadKeymapStatic); never executed: return QFunctionPointer(loadKeymapStatic); | 0 | ||||||
| 392 | #else | - | ||||||
| 393 | Q_UNUSED(function) | - | ||||||
| 394 | #endif | - | ||||||
| 395 | - | |||||||
| 396 | return 0; never executed: return 0; | 0 | ||||||
| 397 | } | - | ||||||
| 398 | - | |||||||
| 399 | void QEglFSIntegration::loadKeymapStatic(const QString &filename) | - | ||||||
| 400 | { | - | ||||||
| 401 | #if !defined(QT_NO_EVDEV) && (!!defined(Q_OS_ANDROID) | - | ||||||
| 402 | || defined(Q_OS_ANDROID_NO_SDK))QEglFSIntegration *self = static_cast<QEglFSIntegration *>(QGuiApplicationPrivate::platformIntegration()); | - | ||||||
| 403 | if (self->m_kbdMgr)
| 0 | ||||||
| 404 | self->m_kbdMgr->loadKeymap(filename); never executed: self->m_kbdMgr->loadKeymap(filename); | 0 | ||||||
| 405 | else | - | ||||||
| 406 | qWarning("QEglFSIntegration: Cannot load keymap, no keyboard handler found"); never executed: QMessageLogger(__FILE__, 406, __PRETTY_FUNCTION__).warning("QEglFSIntegration: Cannot load keymap, no keyboard handler found"); | 0 | ||||||
| 407 | #else | - | ||||||
| 408 | Q_UNUSED(filename); | - | ||||||
| 409 | #endif | - | ||||||
| 410 | } | - | ||||||
| 411 | - | |||||||
| 412 | void QEglFSIntegration::createInputHandlers() | - | ||||||
| 413 | { | - | ||||||
| 414 | #ifndef QT_NO_LIBINPUT | - | ||||||
| 415 | if (!qEnvironmentVariableIntValue("QT_QPA_EGLFS_NO_LIBINPUT")) { | - | ||||||
| 416 | new QLibInputHandler(QLatin1String("libinput"), QString()); | - | ||||||
| 417 | return; | - | ||||||
| 418 | } | - | ||||||
| 419 | #endif | - | ||||||
| 420 | - | |||||||
| 421 | bool useTslib = false; | - | ||||||
| 422 | #ifndef QT_NO_TSLIB | - | ||||||
| 423 | useTslib = qEnvironmentVariableIntValue("QT_QPA_EGLFS_TSLIB"); | - | ||||||
| 424 | if (useTslib) | - | ||||||
| 425 | new QTsLibMouseHandler(QLatin1String("TsLib"), QString() /* spec */); | - | ||||||
| 426 | #endif | - | ||||||
| 427 | - | |||||||
| 428 | #if !defined(QT_NO_EVDEV) && (!!defined(Q_OS_ANDROID)|| defined(Q_OS_ANDROID_NO_SDK)) | - | ||||||
| 429 | m_kbdMgr = new QEvdevKeyboardManager(QLatin1String("EvdevKeyboard"), QString() /* spec */, this); | - | ||||||
| 430 | new QEvdevMouseManager(QLatin1String("EvdevMouse"), QString() /* spec */, this); | - | ||||||
| 431 | if (!useTslib)
| 0 | ||||||
| 432 | new QEvdevTouchManager(QLatin1String("EvdevTouch"), QString() /* spec */, this); never executed: new QEvdevTouchManager(QLatin1String("EvdevTouch"), QString() , this); | 0 | ||||||
| 433 | #endif | - | ||||||
| 434 | } never executed: end of block | 0 | ||||||
| 435 | - | |||||||
| 436 | EGLNativeDisplayType QEglFSIntegration::nativeDisplay() const | - | ||||||
| 437 | { | - | ||||||
| 438 | return qt_egl_device_integration()->platformDisplay(); | - | ||||||
| 439 | } | - | ||||||
| 440 | - | |||||||
| 441 | EGLConfig QEglFSIntegration::chooseConfig(EGLDisplay display, const QSurfaceFormat &format) | - | ||||||
| 442 | { | - | ||||||
| 443 | class Chooser : public QEglConfigChooser { | - | ||||||
| 444 | public: | - | ||||||
| 445 | Chooser(EGLDisplay display) | - | ||||||
| 446 | : QEglConfigChooser(display) { } | - | ||||||
| 447 | bool filterConfig(EGLConfig config) const Q_DECL_OVERRIDE { | - | ||||||
| 448 | return qt_egl_device_integration()->filterConfig(display(), config) | - | ||||||
| 449 | && QEglConfigChooser::filterConfig(config); | - | ||||||
| 450 | } | - | ||||||
| 451 | }; | - | ||||||
| 452 | - | |||||||
| 453 | Chooser chooser(display); | - | ||||||
| 454 | chooser.setSurfaceType(qt_egl_device_integration()->surfaceType()); | - | ||||||
| 455 | chooser.setSurfaceFormat(format); | - | ||||||
| 456 | return chooser.chooseConfig(); | - | ||||||
| 457 | } | - | ||||||
| 458 | - | |||||||
| 459 | QT_END_NAMESPACE | - | ||||||
| Source code | Switch to Preprocessed file |