diff options
Diffstat (limited to 'src/platformsupport')
25 files changed, 80 insertions, 296 deletions
diff --git a/src/platformsupport/cglconvenience/cglconvenience.mm b/src/platformsupport/cglconvenience/cglconvenience.mm deleted file mode 100644 index 44238f2273..0000000000 --- a/src/platformsupport/cglconvenience/cglconvenience.mm +++ /dev/null @@ -1,135 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -#include "cglconvenience_p.h" -#include <QtCore/qglobal.h> -#include <QtCore/private/qcore_mac_p.h> -#include <AppKit/AppKit.h> -#include <QVector> -#include <qdebug.h> - -// Match up with createNSOpenGLPixelFormat below! -QSurfaceFormat qcgl_surfaceFormat() -{ - QSurfaceFormat format; - format.setRenderableType(QSurfaceFormat::OpenGL); - format.setRedBufferSize(8); - format.setGreenBufferSize(8); - format.setBlueBufferSize(8); - format.setAlphaBufferSize(8); -/* - format.setDepthBufferSize(24); - format.setAccumBufferSize(0); - format.setStencilBufferSize(8); - format.setSampleBuffers(false); - format.setSamples(1); - format.setDepth(true); - format.setRgba(true); - format.setAlpha(true); - format.setAccum(false); - format.setStencil(true); - format.setStereo(false); - format.setDirectRendering(false); -*/ - return format; -} - -void *qcgl_createNSOpenGLPixelFormat(const QSurfaceFormat &format) -{ - - QVector<NSOpenGLPixelFormatAttribute> attrs; - - if (format.swapBehavior() == QSurfaceFormat::DoubleBuffer - || format.swapBehavior() == QSurfaceFormat::DefaultSwapBehavior) - attrs.append(NSOpenGLPFADoubleBuffer); - else if (format.swapBehavior() == QSurfaceFormat::TripleBuffer) - attrs.append(NSOpenGLPFATripleBuffer); - - - // Select OpenGL profile - attrs << NSOpenGLPFAOpenGLProfile; - if (format.profile() == QSurfaceFormat::CoreProfile) { - if (format.version() >= qMakePair(4, 1)) - attrs << NSOpenGLProfileVersion4_1Core; - else if (format.version() >= qMakePair(3, 2)) - attrs << NSOpenGLProfileVersion3_2Core; - else - attrs << NSOpenGLProfileVersionLegacy; - } else { - attrs << NSOpenGLProfileVersionLegacy; - } - - if (format.depthBufferSize() > 0) - attrs << NSOpenGLPFADepthSize << format.depthBufferSize(); - if (format.stencilBufferSize() > 0) - attrs << NSOpenGLPFAStencilSize << format.stencilBufferSize(); - if (format.alphaBufferSize() > 0) - attrs << NSOpenGLPFAAlphaSize << format.alphaBufferSize(); - if ((format.redBufferSize() > 0) && - (format.greenBufferSize() > 0) && - (format.blueBufferSize() > 0)) { - const int colorSize = format.redBufferSize() + - format.greenBufferSize() + - format.blueBufferSize(); - attrs << NSOpenGLPFAColorSize << colorSize << NSOpenGLPFAMinimumPolicy; - } - - if (format.samples() > 0) { - attrs << NSOpenGLPFAMultisample - << NSOpenGLPFASampleBuffers << (NSOpenGLPixelFormatAttribute) 1 - << NSOpenGLPFASamples << (NSOpenGLPixelFormatAttribute) format.samples(); - } - - if (format.stereo()) - attrs << NSOpenGLPFAStereo; - - attrs << NSOpenGLPFAAllowOfflineRenderers; - - QByteArray useLayer = qgetenv("QT_MAC_WANTS_LAYER"); - if (!useLayer.isEmpty() && useLayer.toInt() > 0) { - // Disable the software rendering fallback. This makes compositing - // OpenGL and raster NSViews using Core Animation layers possible. - attrs << NSOpenGLPFANoRecovery; - } - - attrs << 0; - - NSOpenGLPixelFormat* pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs.constData()]; - return pixelFormat; -} diff --git a/src/platformsupport/cglconvenience/cglconvenience.pro b/src/platformsupport/cglconvenience/cglconvenience.pro deleted file mode 100644 index 89d1fc4643..0000000000 --- a/src/platformsupport/cglconvenience/cglconvenience.pro +++ /dev/null @@ -1,17 +0,0 @@ -TARGET = QtCglSupport -MODULE = cgl_support - -QT = core-private gui -CONFIG += static internal_module - -DEFINES += QT_NO_CAST_FROM_ASCII - -HEADERS += \ - cglconvenience_p.h - -OBJECTIVE_SOURCES += \ - cglconvenience.mm - -LIBS_PRIVATE += -framework AppKit -framework OpenGL - -load(qt_module) diff --git a/src/platformsupport/cglconvenience/cglconvenience_p.h b/src/platformsupport/cglconvenience/cglconvenience_p.h deleted file mode 100644 index e531e73549..0000000000 --- a/src/platformsupport/cglconvenience/cglconvenience_p.h +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -#ifndef QMACGLCONVENIENCE_H -#define QMACGLCONVENIENCE_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QSurfaceFormat> -#include <QString> -#include <OpenGL/OpenGL.h> - -QSurfaceFormat qcgl_surfaceFormat(); -void *qcgl_createNSOpenGLPixelFormat(const QSurfaceFormat &format); - -#endif // QMACGLCONVENIENCE_H diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp index 1f976be066..5198ffb9f8 100644 --- a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp +++ b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp @@ -1621,6 +1621,7 @@ void QWindowsFontDatabase::refUniqueFont(const QString &uniqueFont) m_uniqueFontData[uniqueFont].refCount.ref(); } +// ### fixme Qt 6 (QTBUG-58610): See comment at QWindowsFontDatabase::systemDefaultFont() HFONT QWindowsFontDatabase::systemFont() { static const HFONT stock_sysfont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); @@ -1961,12 +1962,31 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, const Q QFont QWindowsFontDatabase::systemDefaultFont() { +#if QT_VERSION >= 0x060000 + // Qt 6: Obtain default GUI font (typically "Segoe UI, 9pt", see QTBUG-58610) + NONCLIENTMETRICS ncm; + ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICS, lfMessageFont) + sizeof(LOGFONT); + SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize , &ncm, 0); + const QFont systemFont = QWindowsFontDatabase::LOGFONT_to_QFont(ncm.lfMessageFont); +#else LOGFONT lf; GetObject(QWindowsFontDatabase::systemFont(), sizeof(lf), &lf); QFont systemFont = QWindowsFontDatabase::LOGFONT_to_QFont(lf); // "MS Shell Dlg 2" is the correct system font >= Win2k if (systemFont.family() == QLatin1String("MS Shell Dlg")) systemFont.setFamily(QStringLiteral("MS Shell Dlg 2")); + // Qt 5 by (Qt 4) legacy uses GetStockObject(DEFAULT_GUI_FONT) to + // obtain the default GUI font (typically "MS Shell Dlg 2, 8pt"). This has been + // long deprecated; the message font of the NONCLIENTMETRICS structure obtained by + // SystemParametersInfo(SPI_GETNONCLIENTMETRICS) should be used instead (see + // QWindowsTheme::refreshFonts(), typically "Segoe UI, 9pt"), which is larger. + // In single monitor setups, the point sizes revolve around 8 (depending on UI + // scale factor, but not proportional to it). However, in multi monitor setups, + // where the DPI of the primary monitor are smaller than those of the secondary, + // large bogus values are returned. Limit to 8.25 in that case. + if (GetSystemMetrics(SM_CMONITORS) > 1 && systemFont.pointSizeF() > 8.25) + systemFont.setPointSizeF(8.25); +#endif // Qt 5 qCDebug(lcQpaFonts) << __FUNCTION__ << systemFont; return systemFont; } diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp index d6c7173d3c..2d6426db7f 100644 --- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp +++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp @@ -87,7 +87,7 @@ QEvdevKeyboardHandler::QEvdevKeyboardHandler(const QString &device, QFdContainer // socket notifier for events on the keyboard device m_notify = new QSocketNotifier(m_fd.get(), QSocketNotifier::Read, this); - connect(m_notify, SIGNAL(activated(int)), this, SLOT(readKeycode())); + connect(m_notify, &QSocketNotifier::activated, this, &QEvdevKeyboardHandler::readKeycode); } QEvdevKeyboardHandler::~QEvdevKeyboardHandler() diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h index 1ec4915855..7c64c4febb 100644 --- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h +++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h @@ -145,7 +145,6 @@ public: class QEvdevKeyboardHandler : public QObject { - Q_OBJECT public: QEvdevKeyboardHandler(const QString &device, QFdContainer &fd, bool disableZap, bool enableCompose, const QString &keymapFile); ~QEvdevKeyboardHandler(); @@ -190,7 +189,6 @@ public: bool loadKeymap(const QString &file); void unloadKeymap(); -private slots: void readKeycode(); KeycodeAction processKeycode(quint16 keycode, bool pressed, bool autorepeat); diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp index 94ebae8f42..85e6a80879 100644 --- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp +++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp @@ -88,8 +88,10 @@ QEvdevKeyboardManager::QEvdevKeyboardManager(const QString &key, const QString & for (const QString &device : devices) addKeyboard(device); - connect(m_deviceDiscovery, SIGNAL(deviceDetected(QString)), this, SLOT(addKeyboard(QString))); - connect(m_deviceDiscovery, SIGNAL(deviceRemoved(QString)), this, SLOT(removeKeyboard(QString))); + connect(m_deviceDiscovery, &QDeviceDiscovery::deviceDetected, + this, &QEvdevKeyboardManager::addKeyboard); + connect(m_deviceDiscovery, &QDeviceDiscovery::deviceRemoved, + this, &QEvdevKeyboardManager::removeKeyboard); } } } diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager_p.h b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager_p.h index d2e34fead3..27ea7e468e 100644 --- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager_p.h +++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager_p.h @@ -63,14 +63,12 @@ QT_BEGIN_NAMESPACE class QEvdevKeyboardManager : public QObject { - Q_OBJECT public: QEvdevKeyboardManager(const QString &key, const QString &specification, QObject *parent = 0); ~QEvdevKeyboardManager(); void loadKeymap(const QString &file); -private slots: void addKeyboard(const QString &deviceNode = QString()); void removeKeyboard(const QString &deviceNode); diff --git a/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp b/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp index bcc5a21669..cd7eec3861 100644 --- a/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp +++ b/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp @@ -116,7 +116,8 @@ QEvdevMouseHandler::QEvdevMouseHandler(const QString &device, int fd, bool abs, // socket notifier for events on the mouse device m_notify = new QSocketNotifier(m_fd, QSocketNotifier::Read, this); - connect(m_notify, SIGNAL(activated(int)), this, SLOT(readMouseData())); + connect(m_notify, &QSocketNotifier::activated, + this, &QEvdevMouseHandler::readMouseData); } QEvdevMouseHandler::~QEvdevMouseHandler() diff --git a/src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h b/src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h index 79156645da..6cad4b9173 100644 --- a/src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h +++ b/src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h @@ -66,13 +66,12 @@ public: static QEvdevMouseHandler *create(const QString &device, const QString &specification); ~QEvdevMouseHandler(); + void readMouseData(); + signals: void handleMouseEvent(int x, int y, bool abs, Qt::MouseButtons buttons); void handleWheelEvent(QPoint delta); -private slots: - void readMouseData(); - private: QEvdevMouseHandler(const QString &device, int fd, bool abs, bool compression, int jitterLimit); diff --git a/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp b/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp index 6264e4ada2..ba94bcd460 100644 --- a/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp +++ b/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp @@ -94,13 +94,19 @@ QEvdevMouseManager::QEvdevMouseManager(const QString &key, const QString &specif for (const QString &device : devices) addMouse(device); - connect(m_deviceDiscovery, SIGNAL(deviceDetected(QString)), this, SLOT(addMouse(QString))); - connect(m_deviceDiscovery, SIGNAL(deviceRemoved(QString)), this, SLOT(removeMouse(QString))); + connect(m_deviceDiscovery, &QDeviceDiscovery::deviceDetected, + this, &QEvdevMouseManager::addMouse); + connect(m_deviceDiscovery, &QDeviceDiscovery::deviceRemoved, + this, &QEvdevMouseManager::removeMouse); } } - connect(QGuiApplicationPrivate::inputDeviceManager(), SIGNAL(cursorPositionChangeRequested(QPoint)), - this, SLOT(handleCursorPositionChange(QPoint))); + QInputDeviceManager *manager = QGuiApplicationPrivate::inputDeviceManager(); + connect(manager, &QInputDeviceManager::cursorPositionChangeRequested, [=](const QPoint &pos) { + m_x = pos.x(); + m_y = pos.y(); + clampPosition(); + }); } QEvdevMouseManager::~QEvdevMouseManager() @@ -153,11 +159,12 @@ void QEvdevMouseManager::handleWheelEvent(QPoint delta) void QEvdevMouseManager::addMouse(const QString &deviceNode) { qCDebug(qLcEvdevMouse) << "Adding mouse at" << deviceNode; - QEvdevMouseHandler *handler; - handler = QEvdevMouseHandler::create(deviceNode, m_spec); + QEvdevMouseHandler *handler = QEvdevMouseHandler::create(deviceNode, m_spec); if (handler) { - connect(handler, SIGNAL(handleMouseEvent(int,int,bool,Qt::MouseButtons)), this, SLOT(handleMouseEvent(int,int,bool,Qt::MouseButtons))); - connect(handler, SIGNAL(handleWheelEvent(QPoint)), this, SLOT(handleWheelEvent(QPoint))); + connect(handler, &QEvdevMouseHandler::handleMouseEvent, + this, &QEvdevMouseManager::handleMouseEvent); + connect(handler, &QEvdevMouseHandler::handleWheelEvent, + this, &QEvdevMouseManager::handleWheelEvent); m_mice.insert(deviceNode, handler); QInputDeviceManagerPrivate::get(QGuiApplicationPrivate::inputDeviceManager())->setDeviceCount( QInputDeviceManager::DeviceTypePointer, m_mice.count()); @@ -178,11 +185,4 @@ void QEvdevMouseManager::removeMouse(const QString &deviceNode) } } -void QEvdevMouseManager::handleCursorPositionChange(const QPoint &pos) -{ - m_x = pos.x(); - m_y = pos.y(); - clampPosition(); -} - QT_END_NAMESPACE diff --git a/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h b/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h index 7cabfac0d8..10703655b3 100644 --- a/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h +++ b/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h @@ -64,19 +64,15 @@ class QDeviceDiscovery; class QEvdevMouseManager : public QObject { - Q_OBJECT public: QEvdevMouseManager(const QString &key, const QString &specification, QObject *parent = 0); ~QEvdevMouseManager(); -public slots: void handleMouseEvent(int x, int y, bool abs, Qt::MouseButtons buttons); void handleWheelEvent(QPoint delta); -private slots: void addMouse(const QString &deviceNode = QString()); void removeMouse(const QString &deviceNode); - void handleCursorPositionChange(const QPoint &pos); private: void clampPosition(); diff --git a/src/platformsupport/input/evdevtablet/qevdevtablethandler.cpp b/src/platformsupport/input/evdevtablet/qevdevtablethandler.cpp index cfc17a79c3..dbab2f6a24 100644 --- a/src/platformsupport/input/evdevtablet/qevdevtablethandler.cpp +++ b/src/platformsupport/input/evdevtablet/qevdevtablethandler.cpp @@ -149,9 +149,11 @@ void QEvdevTabletData::report() qreal pressure = pressureRange ? (state.p - minValues.p) / qreal(pressureRange) : qreal(1); if (state.down || state.lastReportDown) { - QWindowSystemInterface::handleTabletEvent(0, state.down, QPointF(), globalPos, + QWindowSystemInterface::handleTabletEvent(0, QPointF(), globalPos, QTabletEvent::Stylus, pointer, - pressure, 0, 0, 0, 0, 0, q->deviceId(), qGuiApp->keyboardModifiers()); + state.down ? Qt::LeftButton : Qt::NoButton, + pressure, 0, 0, 0, 0, 0, q->deviceId(), + qGuiApp->keyboardModifiers()); } if (state.lastReportTool && !state.tool) diff --git a/src/platformsupport/input/evdevtablet/qevdevtablethandler_p.h b/src/platformsupport/input/evdevtablet/qevdevtablethandler_p.h index cd760ba40a..66e821117a 100644 --- a/src/platformsupport/input/evdevtablet/qevdevtablethandler_p.h +++ b/src/platformsupport/input/evdevtablet/qevdevtablethandler_p.h @@ -63,15 +63,12 @@ class QEvdevTabletData; class QEvdevTabletHandler : public QObject { - Q_OBJECT - public: explicit QEvdevTabletHandler(const QString &device, const QString &spec = QString(), QObject *parent = 0); ~QEvdevTabletHandler(); qint64 deviceId() const; -private slots: void readData(); private: diff --git a/src/platformsupport/input/evdevtablet/qevdevtabletmanager.cpp b/src/platformsupport/input/evdevtablet/qevdevtabletmanager.cpp index 4b00424e92..90949408ac 100644 --- a/src/platformsupport/input/evdevtablet/qevdevtabletmanager.cpp +++ b/src/platformsupport/input/evdevtablet/qevdevtabletmanager.cpp @@ -88,8 +88,11 @@ QEvdevTabletManager::QEvdevTabletManager(const QString &key, const QString &spec const QStringList devices = m_deviceDiscovery->scanConnectedDevices(); for (const QString &device : devices) addDevice(device); - connect(m_deviceDiscovery, SIGNAL(deviceDetected(QString)), this, SLOT(addDevice(QString))); - connect(m_deviceDiscovery, SIGNAL(deviceRemoved(QString)), this, SLOT(removeDevice(QString))); + + connect(m_deviceDiscovery, &QDeviceDiscovery::deviceDetected, + this, &QEvdevTabletManager::addDevice); + connect(m_deviceDiscovery, &QDeviceDiscovery::deviceRemoved, + this, &QEvdevTabletManager::removeDevice); } } } diff --git a/src/platformsupport/input/evdevtablet/qevdevtabletmanager_p.h b/src/platformsupport/input/evdevtablet/qevdevtabletmanager_p.h index d166c06cf3..cde91c55aa 100644 --- a/src/platformsupport/input/evdevtablet/qevdevtabletmanager_p.h +++ b/src/platformsupport/input/evdevtablet/qevdevtabletmanager_p.h @@ -62,12 +62,10 @@ class QEvdevTabletHandlerThread; class QEvdevTabletManager : public QObject { - Q_OBJECT public: QEvdevTabletManager(const QString &key, const QString &spec, QObject *parent = 0); ~QEvdevTabletManager(); -private slots: void addDevice(const QString &deviceNode); void removeDevice(const QString &deviceNode); diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp index 15e00cea82..c889965805 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp +++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp @@ -229,7 +229,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const if (m_fd >= 0) { m_notify = new QSocketNotifier(m_fd, QSocketNotifier::Read, this); - connect(m_notify, SIGNAL(activated(int)), this, SLOT(readData())); + connect(m_notify, &QSocketNotifier::activated, this, &QEvdevTouchScreenHandler::readData); } else { qErrnoWarning(errno, "evdevtouch: Cannot open input device %s", qPrintable(device)); return; diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h b/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h index 04e22e1b5e..56308d0352 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h +++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h @@ -82,7 +82,6 @@ public: bool isFiltered() const; -private slots: void readData(); signals: @@ -116,7 +115,6 @@ public: bool eventFilter(QObject *object, QEvent *event) override; -public slots: void scheduleTouchPointUpdate(); signals: diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp index ab71d08fb1..4cacbf03e5 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp +++ b/src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp @@ -88,8 +88,11 @@ QEvdevTouchManager::QEvdevTouchManager(const QString &key, const QString &specif const QStringList devices = m_deviceDiscovery->scanConnectedDevices(); for (const QString &device : devices) addDevice(device); - connect(m_deviceDiscovery, SIGNAL(deviceDetected(QString)), this, SLOT(addDevice(QString))); - connect(m_deviceDiscovery, SIGNAL(deviceRemoved(QString)), this, SLOT(removeDevice(QString))); + + connect(m_deviceDiscovery, &QDeviceDiscovery::deviceDetected, + this, &QEvdevTouchManager::addDevice); + connect(m_deviceDiscovery, &QDeviceDiscovery::deviceRemoved, + this, &QEvdevTouchManager::removeDevice); } } } diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchmanager_p.h b/src/platformsupport/input/evdevtouch/qevdevtouchmanager_p.h index 84e857ca57..e524c516f1 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouchmanager_p.h +++ b/src/platformsupport/input/evdevtouch/qevdevtouchmanager_p.h @@ -62,12 +62,10 @@ class QEvdevTouchScreenHandlerThread; class QEvdevTouchManager : public QObject { - Q_OBJECT public: QEvdevTouchManager(const QString &key, const QString &spec, QObject *parent = 0); ~QEvdevTouchManager(); -private slots: void addDevice(const QString &deviceNode); void removeDevice(const QString &deviceNode); diff --git a/src/platformsupport/input/libinput/qlibinputhandler.cpp b/src/platformsupport/input/libinput/qlibinputhandler.cpp index 4775eb0724..52eaa18f4b 100644 --- a/src/platformsupport/input/libinput/qlibinputhandler.cpp +++ b/src/platformsupport/input/libinput/qlibinputhandler.cpp @@ -107,14 +107,17 @@ QLibInputHandler::QLibInputHandler(const QString &key, const QString &spec) m_liFd = libinput_get_fd(m_li); m_notifier.reset(new QSocketNotifier(m_liFd, QSocketNotifier::Read)); - connect(m_notifier.data(), SIGNAL(activated(int)), SLOT(onReadyRead())); + + connect(m_notifier.data(), &QSocketNotifier::activated, this, &QLibInputHandler::onReadyRead); m_pointer.reset(new QLibInputPointer); m_keyboard.reset(new QLibInputKeyboard); m_touch.reset(new QLibInputTouch); - connect(QGuiApplicationPrivate::inputDeviceManager(), SIGNAL(cursorPositionChangeRequested(QPoint)), - this, SLOT(onCursorPositionChangeRequested(QPoint))); + QInputDeviceManager *manager = QGuiApplicationPrivate::inputDeviceManager(); + connect(manager, &QInputDeviceManager::cursorPositionChangeRequested, [=](const QPoint &pos) { + m_pointer->setPos(pos); + }); // Process the initial burst of DEVICE_ADDED events. onReadyRead(); @@ -154,10 +157,6 @@ void QLibInputHandler::processEvent(libinput_event *ev) // This is not just for hotplugging, it is also called for each input // device libinput reads from on startup. Hence it is suitable for doing // touch device registration. - const char *sysname = libinput_device_get_sysname(dev); // node name without path - const char *name = libinput_device_get_name(dev); - emit deviceAdded(QString::fromUtf8(sysname), QString::fromUtf8(name)); - QInputDeviceManagerPrivate *inputManagerPriv = QInputDeviceManagerPrivate::get( QGuiApplicationPrivate::inputDeviceManager()); if (libinput_device_has_capability(dev, LIBINPUT_DEVICE_CAP_TOUCH)) { @@ -180,10 +179,6 @@ void QLibInputHandler::processEvent(libinput_event *ev) } case LIBINPUT_EVENT_DEVICE_REMOVED: { - const char *sysname = libinput_device_get_sysname(dev); - const char *name = libinput_device_get_name(dev); - emit deviceRemoved(QString::fromUtf8(sysname), QString::fromUtf8(name)); - QInputDeviceManagerPrivate *inputManagerPriv = QInputDeviceManagerPrivate::get( QGuiApplicationPrivate::inputDeviceManager()); if (libinput_device_has_capability(dev, LIBINPUT_DEVICE_CAP_TOUCH)) { @@ -236,9 +231,4 @@ void QLibInputHandler::processEvent(libinput_event *ev) } } -void QLibInputHandler::onCursorPositionChangeRequested(const QPoint &pos) -{ - m_pointer->setPos(pos); -} - QT_END_NAMESPACE diff --git a/src/platformsupport/input/libinput/qlibinputhandler_p.h b/src/platformsupport/input/libinput/qlibinputhandler_p.h index f3dcf0f0be..ac7a267a4d 100644 --- a/src/platformsupport/input/libinput/qlibinputhandler_p.h +++ b/src/platformsupport/input/libinput/qlibinputhandler_p.h @@ -68,19 +68,11 @@ class QLibInputTouch; class QLibInputHandler : public QObject { - Q_OBJECT - public: QLibInputHandler(const QString &key, const QString &spec); ~QLibInputHandler(); -signals: - void deviceAdded(const QString &sysname, const QString &name); - void deviceRemoved(const QString &sysname, const QString &name); - -private slots: void onReadyRead(); - void onCursorPositionChangeRequested(const QPoint &pos); private: void processEvent(libinput_event *ev); diff --git a/src/platformsupport/input/libinput/qlibinputkeyboard_p.h b/src/platformsupport/input/libinput/qlibinputkeyboard_p.h index 12a3eb06eb..b7ee8a363f 100644 --- a/src/platformsupport/input/libinput/qlibinputkeyboard_p.h +++ b/src/platformsupport/input/libinput/qlibinputkeyboard_p.h @@ -64,8 +64,6 @@ QT_BEGIN_NAMESPACE class QLibInputKeyboard : public QObject { - Q_OBJECT - public: QLibInputKeyboard(); ~QLibInputKeyboard(); @@ -73,7 +71,6 @@ public: void processKey(libinput_event_keyboard *e); #ifndef QT_NO_XKBCOMMON_EVDEV -private slots: void handleRepeat(); private: diff --git a/src/platformsupport/input/libinput/qlibinputpointer.cpp b/src/platformsupport/input/libinput/qlibinputpointer.cpp index b20cc4c095..d85a01b7d7 100644 --- a/src/platformsupport/input/libinput/qlibinputpointer.cpp +++ b/src/platformsupport/input/libinput/qlibinputpointer.cpp @@ -96,21 +96,28 @@ void QLibInputPointer::processMotion(libinput_event_pointer *e) void QLibInputPointer::processAxis(libinput_event_pointer *e) { + double value; // default axis value is 15 degrees per wheel click + QPoint angleDelta; #if !QT_CONFIG(libinput_axis_api) - const double v = libinput_event_pointer_get_axis_value(e) * 120; - const Qt::Orientation ori = libinput_event_pointer_get_axis(e) == LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL - ? Qt::Vertical : Qt::Horizontal; - QWindowSystemInterface::handleWheelEvent(nullptr, m_pos, m_pos, qRound(-v), ori, QGuiApplication::keyboardModifiers()); + value = libinput_event_pointer_get_axis_value(e); + if (libinput_event_pointer_get_axis(e) == LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL) + angleDelta.setY(qRound(value)); + else + angleDelta.setX(qRound(value)); #else if (libinput_event_pointer_has_axis(e, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL)) { - const double v = libinput_event_pointer_get_axis_value(e, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL) * 120; - QWindowSystemInterface::handleWheelEvent(nullptr, m_pos, m_pos, qRound(-v), Qt::Vertical, QGuiApplication::keyboardModifiers()); + value = libinput_event_pointer_get_axis_value(e, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL); + angleDelta.setY(qRound(value)); } if (libinput_event_pointer_has_axis(e, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL)) { - const double v = libinput_event_pointer_get_axis_value(e, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL) * 120; - QWindowSystemInterface::handleWheelEvent(nullptr, m_pos, m_pos, qRound(-v), Qt::Horizontal, QGuiApplication::keyboardModifiers()); + value = libinput_event_pointer_get_axis_value(e, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL); + angleDelta.setX(qRound(value)); } #endif + const int factor = 8; + angleDelta *= -factor; + Qt::KeyboardModifiers mods = QGuiApplication::keyboardModifiers(); + QWindowSystemInterface::handleWheelEvent(nullptr, m_pos, m_pos, QPoint(), angleDelta, mods); } void QLibInputPointer::setPos(const QPoint &pos) diff --git a/src/platformsupport/platformsupport.pro b/src/platformsupport/platformsupport.pro index 248c1ae667..5549984d6a 100644 --- a/src/platformsupport/platformsupport.pro +++ b/src/platformsupport/platformsupport.pro @@ -40,8 +40,6 @@ darwin { SUBDIRS += \ clipboard \ graphics - macos: \ - SUBDIRS += cglconvenience } qtConfig(vulkan): \ |