diff options
Diffstat (limited to 'src/plugins/platforms/linuxfb')
-rw-r--r-- | src/plugins/platforms/linuxfb/.prev_CMakeLists.txt | 46 | ||||
-rw-r--r-- | src/plugins/platforms/linuxfb/CMakeLists.txt | 28 | ||||
-rw-r--r-- | src/plugins/platforms/linuxfb/linuxfb.pro | 31 | ||||
-rw-r--r-- | src/plugins/platforms/linuxfb/main.cpp | 46 | ||||
-rw-r--r-- | src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp | 54 | ||||
-rw-r--r-- | src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.h | 40 | ||||
-rw-r--r-- | src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp | 97 | ||||
-rw-r--r-- | src/plugins/platforms/linuxfb/qlinuxfbintegration.h | 51 | ||||
-rw-r--r-- | src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp | 70 | ||||
-rw-r--r-- | src/plugins/platforms/linuxfb/qlinuxfbscreen.h | 40 |
10 files changed, 84 insertions, 419 deletions
diff --git a/src/plugins/platforms/linuxfb/.prev_CMakeLists.txt b/src/plugins/platforms/linuxfb/.prev_CMakeLists.txt deleted file mode 100644 index bcec98e1de..0000000000 --- a/src/plugins/platforms/linuxfb/.prev_CMakeLists.txt +++ /dev/null @@ -1,46 +0,0 @@ -# Generated from linuxfb.pro. - -##################################################################### -## QLinuxFbIntegrationPlugin Plugin: -##################################################################### - -qt_add_plugin(QLinuxFbIntegrationPlugin - OUTPUT_NAME qlinuxfb - TYPE platforms - SOURCES - main.cpp - qlinuxfbintegration.cpp qlinuxfbintegration.h - qlinuxfbscreen.cpp qlinuxfbscreen.h - DEFINES - QT_NO_FOREACH - PUBLIC_LIBRARIES - Qt::Core - Qt::CorePrivate - Qt::EventDispatcherSupportPrivate - Qt::FbSupportPrivate - Qt::FontDatabaseSupportPrivate - Qt::Gui - Qt::GuiPrivate - Qt::ServiceSupportPrivate -) - -#### Keys ignored in scope 1:.:.:linuxfb.pro:<TRUE>: -# OTHER_FILES = "linuxfb.json" - -## Scopes: -##################################################################### - -qt_extend_target(QLinuxFbIntegrationPlugin CONDITION TARGET Qt::InputSupportPrivate - PUBLIC_LIBRARIES - Qt::InputSupportPrivate -) - -qt_extend_target(QLinuxFbIntegrationPlugin CONDITION TARGET Qt::KmsSupportPrivate - SOURCES - qlinuxfbdrmscreen.cpp qlinuxfbdrmscreen.h - PUBLIC_LIBRARIES - Qt::KmsSupportPrivate -) - -#### Keys ignored in scope 4:.:.:linuxfb.pro:NOT TARGET___equals____ss_QT_DEFAULT_QPA_PLUGIN: -# PLUGIN_EXTENDS = "-" diff --git a/src/plugins/platforms/linuxfb/CMakeLists.txt b/src/plugins/platforms/linuxfb/CMakeLists.txt index 8747894100..ba18cea50c 100644 --- a/src/plugins/platforms/linuxfb/CMakeLists.txt +++ b/src/plugins/platforms/linuxfb/CMakeLists.txt @@ -1,47 +1,39 @@ -# Generated from linuxfb.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## QLinuxFbIntegrationPlugin Plugin: ##################################################################### -qt_add_plugin(QLinuxFbIntegrationPlugin +qt_internal_add_plugin(QLinuxFbIntegrationPlugin OUTPUT_NAME qlinuxfb - TYPE platforms - DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES linuxfb # special case + PLUGIN_TYPE platforms + DEFAULT_IF "linuxfb" IN_LIST QT_QPA_PLATFORMS SOURCES main.cpp qlinuxfbintegration.cpp qlinuxfbintegration.h qlinuxfbscreen.cpp qlinuxfbscreen.h DEFINES QT_NO_FOREACH - PUBLIC_LIBRARIES + LIBRARIES Qt::Core Qt::CorePrivate - Qt::EventDispatcherSupportPrivate Qt::FbSupportPrivate - Qt::FontDatabaseSupportPrivate Qt::Gui Qt::GuiPrivate - Qt::ServiceSupportPrivate ) -#### Keys ignored in scope 1:.:.:linuxfb.pro:<TRUE>: -# OTHER_FILES = "linuxfb.json" - ## Scopes: ##################################################################### -qt_extend_target(QLinuxFbIntegrationPlugin CONDITION TARGET Qt::InputSupportPrivate - PUBLIC_LIBRARIES +qt_internal_extend_target(QLinuxFbIntegrationPlugin CONDITION TARGET Qt::InputSupportPrivate + LIBRARIES Qt::InputSupportPrivate ) -qt_extend_target(QLinuxFbIntegrationPlugin CONDITION TARGET Qt::KmsSupportPrivate +qt_internal_extend_target(QLinuxFbIntegrationPlugin CONDITION TARGET Qt::KmsSupportPrivate SOURCES qlinuxfbdrmscreen.cpp qlinuxfbdrmscreen.h - PUBLIC_LIBRARIES + LIBRARIES Qt::KmsSupportPrivate ) - -#### Keys ignored in scope 4:.:.:linuxfb.pro:NOT TARGET___equals____ss_QT_DEFAULT_QPA_PLUGIN: -# PLUGIN_EXTENDS = "-" diff --git a/src/plugins/platforms/linuxfb/linuxfb.pro b/src/plugins/platforms/linuxfb/linuxfb.pro deleted file mode 100644 index d3a4476f80..0000000000 --- a/src/plugins/platforms/linuxfb/linuxfb.pro +++ /dev/null @@ -1,31 +0,0 @@ -TARGET = qlinuxfb - -DEFINES += QT_NO_FOREACH - -QT += \ - core-private gui-private \ - service_support-private eventdispatcher_support-private \ - fontdatabase_support-private fb_support-private - -qtHaveModule(input_support-private): \ - QT += input_support-private - -SOURCES = main.cpp \ - qlinuxfbintegration.cpp \ - qlinuxfbscreen.cpp - -HEADERS = qlinuxfbintegration.h \ - qlinuxfbscreen.h - -qtHaveModule(kms_support-private) { - QT += kms_support-private - SOURCES += qlinuxfbdrmscreen.cpp - HEADERS += qlinuxfbdrmscreen.h -} - -OTHER_FILES += linuxfb.json - -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QLinuxFbIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) diff --git a/src/plugins/platforms/linuxfb/main.cpp b/src/plugins/platforms/linuxfb/main.cpp index 24156b68e8..12aaafc21a 100644 --- a/src/plugins/platforms/linuxfb/main.cpp +++ b/src/plugins/platforms/linuxfb/main.cpp @@ -1,47 +1,13 @@ -/**************************************************************************** -** -** 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 <qpa/qplatformintegrationplugin.h> #include "qlinuxfbintegration.h" QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + class QLinuxFbIntegrationPlugin : public QPlatformIntegrationPlugin { Q_OBJECT @@ -53,10 +19,10 @@ public: QPlatformIntegration* QLinuxFbIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (!system.compare(QLatin1String("linuxfb"), Qt::CaseInsensitive)) + if (!system.compare("linuxfb"_L1, Qt::CaseInsensitive)) return new QLinuxFbIntegration(paramList); - return 0; + return nullptr; } QT_END_NAMESPACE diff --git a/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp b/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp index dcc1ef2790..56b28ba48c 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp +++ b/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.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 // Experimental DRM dumb buffer backend. // @@ -98,7 +62,7 @@ public: void swapBuffers(Output *output); - int outputCount() const { return m_outputs.count(); } + int outputCount() const { return m_outputs.size(); } Output *output(int idx) { return &m_outputs[idx]; } private: @@ -115,7 +79,7 @@ private: static void pageFlipHandler(int fd, unsigned int sequence, unsigned int tv_sec, unsigned int tv_usec, void *user_data); - QVector<Output> m_outputs; + QList<Output> m_outputs; }; QLinuxFbDevice::QLinuxFbDevice(QKmsScreenConfig *screenConfig) @@ -161,8 +125,7 @@ void QLinuxFbDevice::close() void *QLinuxFbDevice::nativeDisplay() const { - Q_UNREACHABLE(); - return nullptr; + Q_UNREACHABLE_RETURN(nullptr); } QPlatformScreen *QLinuxFbDevice::createScreen(const QKmsOutput &output) @@ -279,7 +242,7 @@ bool QLinuxFbDevice::createFramebuffer(QLinuxFbDevice::Output *output, int buffe qErrnoWarning(errno, "Failed to map dumb buffer"); return false; } - fb.p = mmap(0, fb.size, PROT_READ | PROT_WRITE, MAP_SHARED, fd(), mreq.offset); + fb.p = mmap(nullptr, fb.size, PROT_READ | PROT_WRITE, MAP_SHARED, fd(), mreq.offset); if (fb.p == MAP_FAILED) { qErrnoWarning(errno, "Failed to mmap dumb buffer"); return false; @@ -399,6 +362,7 @@ QLinuxFbDrmScreen::~QLinuxFbDrmScreen() bool QLinuxFbDrmScreen::initialize() { m_screenConfig = new QKmsScreenConfig; + m_screenConfig->loadConfig(); m_device = new QLinuxFbDevice(m_screenConfig); if (!m_device->open()) return false; @@ -443,7 +407,7 @@ QRegion QLinuxFbDrmScreen::doRedraw() // Image has alpha but no need for blending at this stage. // Do not waste time with the default SourceOver. pntr.setCompositionMode(QPainter::CompositionMode_Source); - for (const QRect &rect : qAsConst(output->dirty[output->backFb])) + for (const QRect &rect : std::as_const(output->dirty[output->backFb])) pntr.drawImage(rect, mScreenImage, rect); pntr.end(); @@ -466,3 +430,5 @@ QPixmap QLinuxFbDrmScreen::grabWindow(WId wid, int x, int y, int width, int heig } QT_END_NAMESPACE + +#include "moc_qlinuxfbdrmscreen.cpp" diff --git a/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.h b/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.h index 50a9576798..25e3aa9248 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.h +++ b/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.h @@ -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 #ifndef QLINUXFBDRMSCREEN_H #define QLINUXFBDRMSCREEN_H diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp index 68843aa4c5..f87766cf1b 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp +++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.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 "qlinuxfbintegration.h" #include "qlinuxfbscreen.h" @@ -43,9 +7,9 @@ #include "qlinuxfbdrmscreen.h" #endif -#include <QtFontDatabaseSupport/private/qgenericunixfontdatabase_p.h> -#include <QtServiceSupport/private/qgenericunixservices_p.h> -#include <QtEventDispatcherSupport/private/qgenericunixeventdispatcher_p.h> +#include <QtGui/private/qgenericunixfontdatabase_p.h> +#include <QtGui/private/qgenericunixservices_p.h> +#include <QtGui/private/qgenericunixeventdispatcher_p.h> #include <QtFbSupport/private/qfbvthandler_p.h> #include <QtFbSupport/private/qfbbackingstore_p.h> @@ -70,15 +34,15 @@ #include <QtInputSupport/private/qtslib_p.h> #endif -#include <QtPlatformHeaders/qlinuxfbfunctions.h> - QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + QLinuxFbIntegration::QLinuxFbIntegration(const QStringList ¶mList) : m_primaryScreen(nullptr), m_fontDb(new QGenericUnixFontDatabase), m_services(new QGenericUnixServices), - m_kbdMgr(0) + m_kbdMgr(nullptr) { #if QT_CONFIG(kms) if (qEnvironmentVariableIntValue("QT_QPA_FB_DRM") != 0) @@ -113,6 +77,7 @@ bool QLinuxFbIntegration::hasCapability(QPlatformIntegration::Capability cap) co switch (cap) { case ThreadedPixmaps: return true; case WindowManagement: return false; + case RhiBasedRendering: return false; default: return QPlatformIntegration::hasCapability(cap); } } @@ -153,7 +118,7 @@ void QLinuxFbIntegration::createInputHandlers() { #if QT_CONFIG(libinput) if (!qEnvironmentVariableIntValue("QT_QPA_FB_NO_LIBINPUT")) { - new QLibInputHandler(QLatin1String("libinput"), QString()); + new QLibInputHandler("libinput"_L1, QString()); return; } #endif @@ -161,16 +126,16 @@ void QLinuxFbIntegration::createInputHandlers() #if QT_CONFIG(tslib) bool useTslib = qEnvironmentVariableIntValue("QT_QPA_FB_TSLIB"); if (useTslib) - new QTsLibMouseHandler(QLatin1String("TsLib"), QString()); + new QTsLibMouseHandler("TsLib"_L1, QString()); #endif #if QT_CONFIG(evdev) - m_kbdMgr = new QEvdevKeyboardManager(QLatin1String("EvdevKeyboard"), QString(), this); - new QEvdevMouseManager(QLatin1String("EvdevMouse"), QString(), this); + m_kbdMgr = new QEvdevKeyboardManager("EvdevKeyboard"_L1, QString(), this); + new QEvdevMouseManager("EvdevMouse"_L1, QString(), this); #if QT_CONFIG(tslib) if (!useTslib) #endif - new QEvdevTouchManager(QLatin1String("EvdevTouch"), QString() /* spec */, this); + new QEvdevTouchManager("EvdevTouch"_L1, QString() /* spec */, this); #endif } @@ -181,40 +146,26 @@ QPlatformNativeInterface *QLinuxFbIntegration::nativeInterface() const QFunctionPointer QLinuxFbIntegration::platformFunction(const QByteArray &function) const { -#if QT_CONFIG(evdev) - if (function == QLinuxFbFunctions::loadKeymapTypeIdentifier()) - return QFunctionPointer(loadKeymapStatic); - else if (function == QLinuxFbFunctions::switchLangTypeIdentifier()) - return QFunctionPointer(switchLangStatic); -#else - Q_UNUSED(function) -#endif - - return 0; + Q_UNUSED(function); + return nullptr; } -void QLinuxFbIntegration::loadKeymapStatic(const QString &filename) -{ #if QT_CONFIG(evdev) - QLinuxFbIntegration *self = static_cast<QLinuxFbIntegration *>(QGuiApplicationPrivate::platformIntegration()); - if (self->m_kbdMgr) - self->m_kbdMgr->loadKeymap(filename); +void QLinuxFbIntegration::loadKeymap(const QString &filename) +{ + if (m_kbdMgr) + m_kbdMgr->loadKeymap(filename); else qWarning("QLinuxFbIntegration: Cannot load keymap, no keyboard handler found"); -#else - Q_UNUSED(filename); -#endif } -void QLinuxFbIntegration::switchLangStatic() +void QLinuxFbIntegration::switchLang() { -#if QT_CONFIG(evdev) - QLinuxFbIntegration *self = static_cast<QLinuxFbIntegration *>(QGuiApplicationPrivate::platformIntegration()); - if (self->m_kbdMgr) - self->m_kbdMgr->switchLang(); + if (m_kbdMgr) + m_kbdMgr->switchLang(); else qWarning("QLinuxFbIntegration: Cannot switch language, no keyboard handler found"); -#endif } +#endif QT_END_NAMESPACE diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h index af6bd1d630..352bddd907 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h +++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h @@ -1,47 +1,12 @@ -/**************************************************************************** -** -** 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 #ifndef QLINUXFBINTEGRATION_H #define QLINUXFBINTEGRATION_H #include <qpa/qplatformintegration.h> #include <qpa/qplatformnativeinterface.h> +#include <QtGui/private/qkeymapper_p.h> QT_BEGIN_NAMESPACE @@ -51,6 +16,9 @@ class QFbVtHandler; class QEvdevKeyboardManager; class QLinuxFbIntegration : public QPlatformIntegration, public QPlatformNativeInterface +#if QT_CONFIG(evdev) + , public QNativeInterface::Private::QEvdevKeyMapper +#endif { public: QLinuxFbIntegration(const QStringList ¶mList); @@ -74,10 +42,13 @@ public: QFunctionPointer platformFunction(const QByteArray &function) const override; +#if QT_CONFIG(evdev) + void loadKeymap(const QString &filename) override; + void switchLang() override; +#endif + private: void createInputHandlers(); - static void loadKeymapStatic(const QString &filename); - static void switchLangStatic(); QFbScreen *m_primaryScreen; QPlatformInputContext *m_inputContext; diff --git a/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp b/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp index cb8962d4b8..e2826f3946 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp +++ b/src/plugins/platforms/linuxfb/qlinuxfbscreen.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 "qlinuxfbscreen.h" #include <QtFbSupport/private/qfbcursor_p.h> @@ -65,6 +29,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + static int openFramebufferDevice(const QString &dev) { int fd = -1; @@ -247,7 +213,7 @@ static QImage::Format determineFormat(const fb_var_screeninfo &info, int depth) static int openTtyDevice(const QString &device) { - const char *const devs[] = { "/dev/tty0", "/dev/tty", "/dev/console", 0 }; + const char *const devs[] = { "/dev/tty0", "/dev/tty", "/dev/console", nullptr }; int fd = -1; if (device.isEmpty()) { @@ -287,9 +253,9 @@ static void blankScreen(int fd, bool on) } QLinuxFbScreen::QLinuxFbScreen(const QStringList &args) - : mArgs(args), mFbFd(-1), mTtyFd(-1), mBlitter(0) + : mArgs(args), mFbFd(-1), mTtyFd(-1), mBlitter(nullptr) { - mMmap.data = 0; + mMmap.data = nullptr; } QLinuxFbScreen::~QLinuxFbScreen() @@ -308,11 +274,11 @@ QLinuxFbScreen::~QLinuxFbScreen() bool QLinuxFbScreen::initialize() { - QRegularExpression ttyRx(QLatin1String("tty=(.*)")); - QRegularExpression fbRx(QLatin1String("fb=(.*)")); - QRegularExpression mmSizeRx(QLatin1String("mmsize=(\\d+)x(\\d+)")); - QRegularExpression sizeRx(QLatin1String("size=(\\d+)x(\\d+)")); - QRegularExpression offsetRx(QLatin1String("offset=(\\d+)x(\\d+)")); + QRegularExpression ttyRx("tty=(.*)"_L1); + QRegularExpression fbRx("fb=(.*)"_L1); + QRegularExpression mmSizeRx("mmsize=(\\d+)x(\\d+)"_L1); + QRegularExpression sizeRx("size=(\\d+)x(\\d+)"_L1); + QRegularExpression offsetRx("offset=(\\d+)x(\\d+)"_L1); QString fbDevice, ttyDevice; QSize userMmSize; @@ -320,9 +286,9 @@ bool QLinuxFbScreen::initialize() bool doSwitchToGraphicsMode = true; // Parse arguments - for (const QString &arg : qAsConst(mArgs)) { + for (const QString &arg : std::as_const(mArgs)) { QRegularExpressionMatch match; - if (arg == QLatin1String("nographicsmodeswitch")) + if (arg == "nographicsmodeswitch"_L1) doSwitchToGraphicsMode = false; else if (arg.contains(mmSizeRx, &match)) userMmSize = QSize(match.captured(1).toInt(), match.captured(2).toInt()); @@ -337,9 +303,9 @@ bool QLinuxFbScreen::initialize() } if (fbDevice.isEmpty()) { - fbDevice = QLatin1String("/dev/fb0"); + fbDevice = "/dev/fb0"_L1; if (!QFile::exists(fbDevice)) - fbDevice = QLatin1String("/dev/graphics/fb0"); + fbDevice = "/dev/graphics/fb0"_L1; if (!QFile::exists(fbDevice)) { qWarning("Unable to figure out framebuffer device. Specify it manually."); return false; @@ -378,7 +344,7 @@ bool QLinuxFbScreen::initialize() // mmap the framebuffer mMmap.size = finfo.smem_len; - uchar *data = (unsigned char *)mmap(0, mMmap.size, PROT_READ | PROT_WRITE, MAP_SHARED, mFbFd, 0); + uchar *data = (unsigned char *)mmap(nullptr, mMmap.size, PROT_READ | PROT_WRITE, MAP_SHARED, mFbFd, 0); if ((long)data == -1) { qErrnoWarning(errno, "Failed to mmap framebuffer"); return false; @@ -448,3 +414,5 @@ QPixmap QLinuxFbScreen::grabWindow(WId wid, int x, int y, int width, int height) QT_END_NAMESPACE +#include "moc_qlinuxfbscreen.cpp" + diff --git a/src/plugins/platforms/linuxfb/qlinuxfbscreen.h b/src/plugins/platforms/linuxfb/qlinuxfbscreen.h index c7ce455e6a..55d6d8ff5f 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbscreen.h +++ b/src/plugins/platforms/linuxfb/qlinuxfbscreen.h @@ -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 #ifndef QLINUXFBSCREEN_H #define QLINUXFBSCREEN_H |