diff options
Diffstat (limited to 'src/plugins/platforms/eglfs/api/qeglfsintegration.cpp')
-rw-r--r-- | src/plugins/platforms/eglfs/api/qeglfsintegration.cpp | 115 |
1 files changed, 31 insertions, 84 deletions
diff --git a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp index c94a12a198..f0b64c475c 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include <QtCore/qtextstream.h> #include <QtGui/private/qguiapplication_p.h> @@ -61,10 +25,10 @@ #endif #include "qeglfsoffscreenwindow_p.h" -#include <QtEglSupport/private/qeglconvenience_p.h> +#include <QtGui/private/qeglconvenience_p.h> #ifndef QT_NO_OPENGL -# include <QtEglSupport/private/qeglplatformcontext_p.h> -# include <QtEglSupport/private/qeglpbuffer_p.h> +# include <QtGui/private/qeglplatformcontext_p.h> +# include <QtGui/private/qeglpbuffer_p.h> #endif #include <QtGui/private/qgenericunixfontdatabase_p.h> @@ -94,8 +58,6 @@ #include <QtInputSupport/qintegrityhidmanager.h> #endif -#include <QtPlatformHeaders/qeglfsfunctions.h> - static void initResources() { #ifndef QT_NO_CURSOR @@ -105,12 +67,14 @@ static void initResources() QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + QEglFSIntegration::QEglFSIntegration() - : m_display(EGL_NO_DISPLAY), + : m_kbdMgr(nullptr), + m_display(EGL_NO_DISPLAY), m_inputContext(nullptr), m_fontDb(new QGenericUnixFontDatabase), m_services(new QGenericUnixServices), - m_kbdMgr(nullptr), m_disableInputHandlers(false) { m_disableInputHandlers = qEnvironmentVariableIntValue("QT_QPA_EGLFS_DISABLE_INPUT"); @@ -146,7 +110,8 @@ void QEglFSIntegration::initialize() void QEglFSIntegration::destroy() { - foreach (QWindow *w, qGuiApp->topLevelWindows()) + const auto toplevels = qGuiApp->topLevelWindows(); + for (QWindow *w : toplevels) w->destroy(); qt_egl_device_integration()->screenDestroy(); @@ -243,13 +208,6 @@ QPlatformOffscreenSurface *QEglFSIntegration::createPlatformOffscreenSurface(QOf } #endif // QT_NO_OPENGL -#if QT_CONFIG(vulkan) -QPlatformVulkanInstance *QEglFSIntegration::createPlatformVulkanInstance(QVulkanInstance *instance) const -{ - return qt_egl_device_integration()->createPlatformVulkanInstance(instance); -} -#endif - bool QEglFSIntegration::hasCapability(QPlatformIntegration::Capability cap) const { // We assume that devices will have more and not less capabilities @@ -369,12 +327,6 @@ void *QEglFSIntegration::nativeResourceForWindow(const QByteArray &resource, QWi if (window && window->handle()) result = reinterpret_cast<void*>(static_cast<QEglFSWindow *>(window->handle())->surface()); break; -#if QT_CONFIG(vulkan) - case VkSurface: - if (window && window->handle() && window->surfaceType() == QSurface::VulkanSurface) - result = static_cast<QEglFSWindow *>(window->handle())->vulkanSurfacePtr(); - break; -#endif default: break; } @@ -432,45 +384,40 @@ QPlatformNativeInterface::NativeResourceForContextFunction QEglFSIntegration::na QFunctionPointer QEglFSIntegration::platformFunction(const QByteArray &function) const { -#if QT_CONFIG(evdev) - if (function == QEglFSFunctions::loadKeymapTypeIdentifier()) - return QFunctionPointer(loadKeymapStatic); - else if (function == QEglFSFunctions::switchLangTypeIdentifier()) - return QFunctionPointer(switchLangStatic); -#endif - return qt_egl_device_integration()->platformFunction(function); } -void QEglFSIntegration::loadKeymapStatic(const QString &filename) +QVariant QEglFSIntegration::styleHint(QPlatformIntegration::StyleHint hint) const { + if (hint == QPlatformIntegration::ShowIsFullScreen) + return true; + + return QPlatformIntegration::styleHint(hint); +} + #if QT_CONFIG(evdev) - QEglFSIntegration *self = static_cast<QEglFSIntegration *>(QGuiApplicationPrivate::platformIntegration()); - if (self->m_kbdMgr) - self->m_kbdMgr->loadKeymap(filename); +void QEglFSIntegration::loadKeymap(const QString &filename) +{ + if (m_kbdMgr) + m_kbdMgr->loadKeymap(filename); else qWarning("QEglFSIntegration: Cannot load keymap, no keyboard handler found"); -#else - Q_UNUSED(filename); -#endif } -void QEglFSIntegration::switchLangStatic() +void QEglFSIntegration::switchLang() { -#if QT_CONFIG(evdev) - QEglFSIntegration *self = static_cast<QEglFSIntegration *>(QGuiApplicationPrivate::platformIntegration()); - if (self->m_kbdMgr) - self->m_kbdMgr->switchLang(); + if (m_kbdMgr) + m_kbdMgr->switchLang(); else qWarning("QEglFSIntegration: Cannot switch language, no keyboard handler found"); -#endif } +#endif void QEglFSIntegration::createInputHandlers() { #if QT_CONFIG(libinput) if (!qEnvironmentVariableIntValue("QT_QPA_EGLFS_NO_LIBINPUT")) { - new QLibInputHandler(QLatin1String("libinput"), QString()); + new QLibInputHandler("libinput"_L1, QString()); return; } #endif @@ -478,16 +425,16 @@ void QEglFSIntegration::createInputHandlers() #if QT_CONFIG(tslib) bool useTslib = qEnvironmentVariableIntValue("QT_QPA_EGLFS_TSLIB"); if (useTslib) - new QTsLibMouseHandler(QLatin1String("TsLib"), QString() /* spec */); + new QTsLibMouseHandler("TsLib"_L1, QString() /* spec */); #endif #if QT_CONFIG(evdev) - m_kbdMgr = new QEvdevKeyboardManager(QLatin1String("EvdevKeyboard"), QString() /* spec */, this); - new QEvdevMouseManager(QLatin1String("EvdevMouse"), QString() /* spec */, this); + m_kbdMgr = new QEvdevKeyboardManager("EvdevKeyboard"_L1, QString() /* spec */, this); + new QEvdevMouseManager("EvdevMouse"_L1, QString() /* spec */, this); #if QT_CONFIG(tslib) if (!useTslib) #endif - new QEvdevTouchManager(QLatin1String("EvdevTouch"), QString() /* spec */, this); + new QEvdevTouchManager("EvdevTouch"_L1, QString() /* spec */, this); #endif #if QT_CONFIG(integrityhid) |