From 3f1048cca783749c7da9a9f8b3a61959ed35a0de Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 28 Jul 2016 13:41:43 +0200 Subject: Android: Fix CJK text with Android 7.0 In Android 7, some fonts are packed in .ttc files. We fix this simply by including them when populating the font database. Freetype supports this and in fact, QBasicFontDatabase::populateFontDatabase() also adds *.ttc. [ChangeLog][Android] Fixed CJK font resolution on Android 7. Task-number: QTBUG-53511 Change-Id: Iebe51b0e6ba2d6987693306cd9a12013ce886b58 Reviewed-by: BogDan Vatra --- src/plugins/platforms/android/qandroidplatformfontdatabase.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp b/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp index 5725f5793e..86d50f487b 100644 --- a/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp +++ b/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp @@ -54,7 +54,8 @@ void QAndroidPlatformFontDatabase::populateFontDatabase() QStringList nameFilters; nameFilters << QLatin1String("*.ttf") - << QLatin1String("*.otf"); + << QLatin1String("*.otf") + << QLatin1String("*.ttc"); foreach (const QFileInfo &fi, dir.entryInfoList(nameFilters, QDir::Files)) { const QByteArray file = QFile::encodeName(fi.absoluteFilePath()); -- cgit v1.2.3 From dbb5c95f4d80644c6273b3adbe0148cdf30710d2 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 1 Aug 2016 16:15:13 +0200 Subject: Windows QPA: Handle key event sequences of surrogates Emoji characters as input by the virtual keyboard are received as a sequence of surrogates. Store state internally when a high surrogate is received and send off the sequence when the matching low surrogate is received via input method. Task-number: QTBUG-50617 Change-Id: I91e763ec3e0747d6852f7c5c2057a67b0c24e0f5 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/windows/qwindowskeymapper.cpp | 16 ++++++++++++++++ src/plugins/platforms/windows/qwindowskeymapper.h | 1 + 2 files changed, 17 insertions(+) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp index 403ac6ecfb..1e58b9b3d4 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.cpp +++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp @@ -37,6 +37,7 @@ #include "qwindowswindow.h" #include "qwindowsinputcontext.h" +#include #include #include #include @@ -1072,6 +1073,21 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms if (PeekMessage(&wm_char, 0, charType, charType, PM_REMOVE)) { // Found a ?_CHAR uch = QChar(ushort(wm_char.wParam)); + if (uch.isHighSurrogate()) { + m_lastHighSurrogate = uch; + return true; + } else if (uch.isLowSurrogate() && !m_lastHighSurrogate.isNull()) { + if (QObject *focusObject = QGuiApplication::focusObject()) { + const QChar chars[2] = {m_lastHighSurrogate, uch}; + QInputMethodEvent event; + event.setCommitString(QString(chars, 2)); + QCoreApplication::sendEvent(focusObject, &event); + } + m_lastHighSurrogate = QChar(); + return true; + } else { + m_lastHighSurrogate = QChar(); + } if (msgType == WM_SYSKEYDOWN && uch.isLetter() && (msg.lParam & KF_ALTDOWN)) uch = uch.toLower(); // (See doc of WM_SYSCHAR) Alt-letter if (!code && !uch.row()) diff --git a/src/plugins/platforms/windows/qwindowskeymapper.h b/src/plugins/platforms/windows/qwindowskeymapper.h index 3a3170e4ae..81ae1a3297 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.h +++ b/src/plugins/platforms/windows/qwindowskeymapper.h @@ -97,6 +97,7 @@ private: void deleteLayouts(); QWindow *m_keyGrabber; + QChar m_lastHighSurrogate; static const size_t NumKeyboardLayoutItems = 256; KeyboardLayoutItem keyLayout[NumKeyboardLayoutItems]; }; -- cgit v1.2.3 From dbfd7f304c4d91096e104ec2383d92a37502d836 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 3 Aug 2016 10:02:07 +0200 Subject: Windows QPA: Add missing parameter to qWarning() The warning printed when wrapping foreign windows is missing a parameter. Amends change f2ef587906062706e576e376e4c6481ab192f50d. Task-number: QTBUG-41186 Change-Id: Iefbd174c1acc42e87fd1a764d96452b1745aa4c0 Reviewed-by: Simon Hausmann --- src/plugins/platforms/windows/qwindowsintegration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index debe6dd131..f033e4235c 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -313,7 +313,7 @@ QPlatformWindow *QWindowsIntegration::createPlatformWindow(QWindow *window) cons if (window->type() == Qt::ForeignWindow) { const HWND hwnd = reinterpret_cast(window->winId()); if (!IsWindow(hwnd)) { - qWarning("Windows QPA: Invalid foreign window ID %p."); + qWarning("Windows QPA: Invalid foreign window ID %p.", hwnd); return nullptr; } QWindowsForeignWindow *result = new QWindowsForeignWindow(window, hwnd); -- cgit v1.2.3 From 457d91bb07a8ad0d1a582016566ba5119bb1ac95 Mon Sep 17 00:00:00 2001 From: charlycha Date: Tue, 9 Feb 2016 06:36:07 +0100 Subject: raspberry pi: manage eglfs display id with env var Specify the display to use by setting environment variable QT_QPA_EGLFS_DISPMANX_ID Possible values are : 0: MAIN LCD 1: AUX LCD 2: HDMI 3: SDTV 4: FORCE LCD 5: FORCE TV 6: FORCE OTHER Change-Id: I146db9a7f423bd4c6c1716c64d3df4d2388e85f9 Reviewed-by: Andy Nichols --- .../eglfs_brcm/qeglfsbrcmintegration.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmintegration.cpp index 4813d9be04..544ac31877 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmintegration.cpp @@ -87,9 +87,23 @@ void QEglFSBrcmIntegration::platformInit() bcm_host_init(); } +static int getDisplayId() +{ + // As defined in vc_dispmanx_types.h + // DISPMANX_ID_MAIN_LCD 0 + // DISPMANX_ID_AUX_LCD 1 + // DISPMANX_ID_HDMI 2 + // DISPMANX_ID_SDTV 3 + // DISPMANX_ID_FORCE_LCD 4 + // DISPMANX_ID_FORCE_TV 5 + // DISPMANX_ID_FORCE_OTHER 6 /* non-default display */ + static const int dispmanxId = qEnvironmentVariableIntValue("QT_QPA_EGLFS_DISPMANX_ID"); + return (dispmanxId >= 0 && dispmanxId <= 6) ? dispmanxId : 0; +} + EGLNativeDisplayType QEglFSBrcmIntegration::platformDisplay() const { - dispman_display = vc_dispmanx_display_open(0/* LCD */); + dispman_display = vc_dispmanx_display_open(getDisplayId()); return EGL_DEFAULT_DISPLAY; } @@ -101,7 +115,7 @@ void QEglFSBrcmIntegration::platformDestroy() QSize QEglFSBrcmIntegration::screenSize() const { uint32_t width, height; - graphics_get_display_size(0 /* LCD */, &width, &height); + graphics_get_display_size(getDisplayId(), &width, &height); return QSize(width, height); } -- cgit v1.2.3 From 7f66289f9d36458b0ab52d02d35ca4aa3ae722c4 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 3 Aug 2016 09:16:03 +0200 Subject: Windows QPA: Introduce command line options for DirectWrite Add option "nodirectwrite" to turn off DirectWrite fonts and "nocolorfonts" to turn off DirectWrite for colored fonts. Task-number: QTBUG-55096 Task-number: QTBUG-55097 Change-Id: If12133fbd20dc7657b3616eff833a8e8c116e070 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../platforms/windows/qwindowsfontdatabase.cpp | 32 ++++++++++++++-------- .../platforms/windows/qwindowsintegration.cpp | 4 +++ .../platforms/windows/qwindowsintegration.h | 4 ++- 3 files changed, 28 insertions(+), 12 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index 68a8fc5390..08769a3b39 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -40,6 +40,7 @@ #include "qwindowsfontdatabase.h" #include "qwindowsfontdatabase_ft.h" // for default font #include "qwindowscontext.h" +#include "qwindowsintegration.h" #include "qwindowsfontengine.h" #include "qwindowsfontenginedirectwrite.h" #include "qtwindows_additional.h" @@ -112,6 +113,18 @@ static void createDirectWriteFactory(IDWriteFactory **factory) *factory = static_cast(result); } + +static inline bool useDirectWrite(QFont::HintingPreference hintingPreference, bool isColorFont = false) +{ + const unsigned options = QWindowsIntegration::instance()->options(); + if (Q_UNLIKELY(options & QWindowsIntegration::DontUseDirectWriteFonts)) + return false; + if (isColorFont) + return (options & QWindowsIntegration::DontUseColorFonts) == 0; + return hintingPreference == QFont::PreferNoHinting + || hintingPreference == QFont::PreferVerticalHinting + || (QHighDpiScaling::isActive() && hintingPreference == QFont::PreferDefaultHinting); +} #endif // !QT_NO_DIRECTWRITE // Helper classes for creating font engines directly from font data @@ -1163,11 +1176,7 @@ QFontEngine *QWindowsFontDatabase::fontEngine(const QByteArray &fontData, qreal QFontEngine *fontEngine = 0; #if !defined(QT_NO_DIRECTWRITE) - bool useDirectWrite = (hintingPreference == QFont::PreferNoHinting) - || (hintingPreference == QFont::PreferVerticalHinting) - || (QHighDpiScaling::isActive() && hintingPreference == QFont::PreferDefaultHinting); - - if (!useDirectWrite) + if (!useDirectWrite(hintingPreference)) #endif { GUID guid; @@ -1804,12 +1813,13 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, isColorFont = true; } #endif - - bool useDirectWrite = (request.hintingPreference == QFont::PreferNoHinting) - || (request.hintingPreference == QFont::PreferVerticalHinting) - || (QHighDpiScaling::isActive() && request.hintingPreference == QFont::PreferDefaultHinting) - || isColorFont; - if (useDirectWrite) { + const QFont::HintingPreference hintingPreference = + static_cast(request.hintingPreference); + const bool useDw = useDirectWrite(hintingPreference, isColorFont); + qCDebug(lcQpaFonts) << __FUNCTION__ << request.family << request.pointSize + << "pt" << "hintingPreference=" << hintingPreference << "color=" << isColorFont + << dpi << "dpi" << "useDirectWrite=" << useDw; + if (useDw) { QWindowsFontEngineDirectWrite *fedw = new QWindowsFontEngineDirectWrite(directWriteFontFace, request.pixelSize, data); diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index f033e4235c..b6d2c16f89 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -199,6 +199,10 @@ static inline unsigned parseOptions(const QStringList ¶mList, } } else if (param == QLatin1String("gl=gdi")) { options |= QWindowsIntegration::DisableArb; + } else if (param == QLatin1String("nodirectwrite")) { + options |= QWindowsIntegration::DontUseDirectWriteFonts; + } else if (param == QLatin1String("nocolorfonts")) { + options |= QWindowsIntegration::DontUseColorFonts; } else if (param == QLatin1String("nomousefromtouch")) { options |= QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch; } else if (parseIntOption(param, QLatin1String("verbose"), 0, INT_MAX, &QWindowsContext::verbose) diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h index 9658ef711d..0c03274799 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.h +++ b/src/plugins/platforms/windows/qwindowsintegration.h @@ -60,7 +60,9 @@ public: DisableArb = 0x4, NoNativeDialogs = 0x8, XpNativeDialogs = 0x10, - DontPassOsMouseEventsSynthesizedFromTouch = 0x20 // Do not pass OS-generated mouse events from touch. + DontPassOsMouseEventsSynthesizedFromTouch = 0x20, // Do not pass OS-generated mouse events from touch. + DontUseDirectWriteFonts = 0x40, + DontUseColorFonts = 0x80 }; explicit QWindowsIntegration(const QStringList ¶mList); -- cgit v1.2.3 From 121b7b7a3cb401cb1597b8d56b9372f09aae6b51 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 5 Aug 2016 15:55:30 +0200 Subject: Windows: Fix Adobe/Mozilla format color fonts after Windows update After the Anniversary update of Windows 10 (update 1607), color fonts using the Adobe/Mozilla format with embedded SVGs are detected as color fonts by DirectWrite, but they do not contain any colored layers. The result of this was that we would no longer draw these fonts using the pen color, but we would also not support the colored glyphs in the fonts. In order to still support using these fonts as regular monochromatic fonts, we check if there is actually a palette in the font file before registering it as a color font. [ChangeLog][QtGui][Windows] Fixed rendering Adobe/Mozilla format color fonts with other colors than black after Windows 10 Anniversary update. Task-number: QTBUG-55097 Change-Id: I8d74787e49530d1167b9f2533ffdf7ab814c3358 Reviewed-by: Friedemann Kleint Reviewed-by: Tim Jenssen --- src/plugins/platforms/windows/qwindowsfontdatabase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index 08769a3b39..314da702eb 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -1810,7 +1810,7 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, if (SUCCEEDED(directWriteFontFace->QueryInterface(__uuidof(IDWriteFontFace2), reinterpret_cast(&directWriteFontFace2)))) { if (directWriteFontFace2->IsColorFont()) - isColorFont = true; + isColorFont = directWriteFontFace2->GetPaletteEntryCount() > 0; } #endif const QFont::HintingPreference hintingPreference = -- cgit v1.2.3 From 30eecdf6d8e593027542df8e809dc2b5f33cc60e Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 8 Aug 2016 14:21:14 +0200 Subject: Fix QGtk3Menu::removeMenuItem() The if-condition was broken, so items weren't removed from the container as appropriate. Accessing such dangling items caused a crash later on exit. Task-number: QTBUG-54432 Task-number: QTBUG-54462 Change-Id: I98fd9f29a93d72e3e4a8f0fb6bac40ad4728ba6f Reviewed-by: Heikki Halmet Reviewed-by: Mitch Curtis --- src/plugins/platformthemes/gtk3/qgtk3menu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platformthemes/gtk3/qgtk3menu.cpp b/src/plugins/platformthemes/gtk3/qgtk3menu.cpp index 288978ae84..52757587b4 100644 --- a/src/plugins/platformthemes/gtk3/qgtk3menu.cpp +++ b/src/plugins/platformthemes/gtk3/qgtk3menu.cpp @@ -371,7 +371,7 @@ void QGtk3Menu::insertMenuItem(QPlatformMenuItem *item, QPlatformMenuItem *befor void QGtk3Menu::removeMenuItem(QPlatformMenuItem *item) { QGtk3MenuItem *gitem = static_cast(item); - if (!gitem && !m_items.removeOne(gitem)) + if (!gitem || !m_items.removeOne(gitem)) return; GtkWidget *handle = gitem->handle(); -- cgit v1.2.3 From db79b89899e6537d540e290beaed263c46e3a885 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Tue, 5 Jul 2016 09:34:13 +0200 Subject: winrt: support fullscreen mode Enable switching application to fullscreen mode. This is mostly required for desktop targets of WinRT. Task-number: QTBUG-54517 Change-Id: I67e4020bc2ec8da86d94815e5765959f4ae2b63f Reviewed-by: Oliver Wolff --- src/plugins/platforms/winrt/qwinrtwindow.cpp | 51 +++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/winrt/qwinrtwindow.cpp b/src/plugins/platforms/winrt/qwinrtwindow.cpp index 75b43205b7..3bd0cd3ad7 100644 --- a/src/plugins/platforms/winrt/qwinrtwindow.cpp +++ b/src/plugins/platforms/winrt/qwinrtwindow.cpp @@ -320,10 +320,59 @@ void QWinRTWindow::setWindowState(Qt::WindowState state) if (d->state == state) return; +#if _MSC_VER >= 1900 + if (state == Qt::WindowFullScreen) { + HRESULT hr; + boolean success; + hr = QEventDispatcherWinRT::runOnXamlThread([&hr, &success]() { + ComPtr applicationViewStatics; + hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_ViewManagement_ApplicationView).Get(), + IID_PPV_ARGS(&applicationViewStatics)); + RETURN_HR_IF_FAILED("Could not access application view statics."); + ComPtr view; + hr = applicationViewStatics->GetForCurrentView(&view); + RETURN_HR_IF_FAILED("Could not access application view."); + ComPtr view3; + hr = view.As(&view3); + Q_ASSERT_SUCCEEDED(hr); + hr = view3->TryEnterFullScreenMode(&success); + return hr; + }); + if (FAILED(hr) || !success) { + qCDebug(lcQpaWindows) << "Failed to enter full screen mode."; + return; + } + d->state = state; + return; + } + + if (d->state == Qt::WindowFullScreen) { + HRESULT hr; + hr = QEventDispatcherWinRT::runOnXamlThread([&hr]() { + ComPtr applicationViewStatics; + hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_ViewManagement_ApplicationView).Get(), + IID_PPV_ARGS(&applicationViewStatics)); + RETURN_HR_IF_FAILED("Could not access application view statics."); + ComPtr view; + hr = applicationViewStatics->GetForCurrentView(&view); + RETURN_HR_IF_FAILED("Could not access application view."); + ComPtr view3; + hr = view.As(&view3); + Q_ASSERT_SUCCEEDED(hr); + hr = view3->ExitFullScreenMode(); + return hr; + }); + if (FAILED(hr)) { + qCDebug(lcQpaWindows) << "Failed to exit full screen mode."; + return; + } + } +#endif // _MSC_VER >= 1900 + if (state == Qt::WindowMinimized) setUIElementVisibility(d->uiElement.Get(), false); - if (d->state == Qt::WindowMinimized) + if (d->state == Qt::WindowMinimized || state == Qt::WindowNoState || state == Qt::WindowActive) setUIElementVisibility(d->uiElement.Get(), true); d->state = state; -- cgit v1.2.3 From ccfd699b854321d26be844e916cd26bb1a01ebca Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 6 Aug 2016 15:06:53 +0300 Subject: QNetworkManagerEngine: fix const-correctness Change-Id: I058617315e7cf2c6fa49f1ed0d16cb5e2a78dd72 Reviewed-by: Lars Knoll --- src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp | 8 ++++---- src/plugins/bearer/networkmanager/qnetworkmanagerengine.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index b0bc8a265e..8e6ab025cd 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -553,7 +553,7 @@ void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path, emit configurationAdded(ptr); } -bool QNetworkManagerEngine::isConnectionActive(const QString &settingsPath) +bool QNetworkManagerEngine::isConnectionActive(const QString &settingsPath) const { QHashIterator i(activeConnectionsList); while (i.hasNext()) { @@ -863,7 +863,7 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri return cpPriv; } -bool QNetworkManagerEngine::isActiveContext(const QString &contextPath) +bool QNetworkManagerEngine::isActiveContext(const QString &contextPath) const { if (ofonoManager && ofonoManager->isValid()) { const QString contextPart = contextPath.section('/', -1); @@ -1024,7 +1024,7 @@ QNetworkConfigurationPrivatePointer QNetworkManagerEngine::defaultConfiguration( return QNetworkConfigurationPrivatePointer(); } -QNetworkConfiguration::BearerType QNetworkManagerEngine::currentBearerType(const QString &id) +QNetworkConfiguration::BearerType QNetworkManagerEngine::currentBearerType(const QString &id) const { QString contextPart = id.section('/', -1); QHashIterator i(ofonoContextManagers); @@ -1055,7 +1055,7 @@ QNetworkConfiguration::BearerType QNetworkManagerEngine::currentBearerType(const return QNetworkConfiguration::BearerUnknown; } -QString QNetworkManagerEngine::contextName(const QString &path) +QString QNetworkManagerEngine::contextName(const QString &path) const { QString contextPart = path.section('/', -1); QHashIterator i(ofonoContextManagers); diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h index e8c40a881d..2296d6b2b6 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h @@ -140,14 +140,14 @@ private: QOfonoManagerInterface *ofonoManager; QHash ofonoContextManagers; - QNetworkConfiguration::BearerType currentBearerType(const QString &id); - QString contextName(const QString &path); + QNetworkConfiguration::BearerType currentBearerType(const QString &id) const; + QString contextName(const QString &path) const; - bool isConnectionActive(const QString &settingsPath); + bool isConnectionActive(const QString &settingsPath) const; QDBusServiceWatcher *ofonoWatcher; QDBusServiceWatcher *nmWatcher; - bool isActiveContext(const QString &contextPath); + bool isActiveContext(const QString &contextPath) const; bool nmAvailable; void setupConfigurations(); }; -- cgit v1.2.3 From 3400e7ee7fc9f8747de28aa4eba9a28a8a79f819 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 6 Aug 2016 15:08:34 +0300 Subject: QNetworkManagerEngine: add override keywords Change-Id: Ie926119ee58d330e415634f93eb334c6befeede1 Reviewed-by: Lars Knoll --- .../bearer/networkmanager/qnetworkmanagerengine.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h index 2296d6b2b6..2f425ddc02 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h @@ -74,26 +74,26 @@ public: bool networkManagerAvailable() const; - QString getInterfaceFromId(const QString &id); - bool hasIdentifier(const QString &id); + QString getInterfaceFromId(const QString &id) override; + bool hasIdentifier(const QString &id) override; - void connectToId(const QString &id); - void disconnectFromId(const QString &id); + void connectToId(const QString &id) override; + void disconnectFromId(const QString &id) override; Q_INVOKABLE void initialize(); Q_INVOKABLE void requestUpdate(); - QNetworkSession::State sessionStateForId(const QString &id); + QNetworkSession::State sessionStateForId(const QString &id) override; - quint64 bytesWritten(const QString &id); - quint64 bytesReceived(const QString &id); - quint64 startTime(const QString &id); + quint64 bytesWritten(const QString &id) override; + quint64 bytesReceived(const QString &id) override; + quint64 startTime(const QString &id) override; - QNetworkConfigurationManager::Capabilities capabilities() const; + QNetworkConfigurationManager::Capabilities capabilities() const override; - QNetworkSessionPrivate *createSessionBackend(); + QNetworkSessionPrivate *createSessionBackend() override; - QNetworkConfigurationPrivatePointer defaultConfiguration(); + QNetworkConfigurationPrivatePointer defaultConfiguration() override; private Q_SLOTS: void interfacePropertiesChanged(const QMap &properties); -- cgit v1.2.3 From 7305b3e82863f077c4f677d0a860e314ce6f806c Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 6 Aug 2016 15:11:44 +0300 Subject: QNetworkManagerEngine: port away from Java-style iterators They are slower, more annoying, and not safer than their STL counterparts. Port to C++11 range-for, or to "auto it, end" for loops in cases where the key was also accessed. Change-Id: Ib27608ddbe9c0775092a1c6495731ad324727d3e Reviewed-by: Lars Knoll --- .../networkmanager/qnetworkmanagerengine.cpp | 36 ++++++++-------------- 1 file changed, 12 insertions(+), 24 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index 8e6ab025cd..3cd9290420 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -555,12 +555,11 @@ void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path, bool QNetworkManagerEngine::isConnectionActive(const QString &settingsPath) const { - QHashIterator i(activeConnectionsList); - while (i.hasNext()) { - i.next(); - if (i.value()->connection().path() == settingsPath) { - if (i.value()->state() == NM_ACTIVE_CONNECTION_STATE_ACTIVATING - || i.value()->state() == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) { + for (QNetworkManagerConnectionActive *activeConnection : activeConnectionsList) { + if (activeConnection->connection().path() == settingsPath) { + const auto state = activeConnection->state(); + if (state == NM_ACTIVE_CONNECTION_STATE_ACTIVATING + || state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) { return true; } else { break; @@ -848,9 +847,7 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri if (ofonoManager && ofonoManager->isValid()) { const QString contextPart = connectionPath.section('/', -1); - QHashIterator i(ofonoContextManagers); - while (i.hasNext()) { - i.next(); + for (auto i = ofonoContextManagers.cbegin(), end = ofonoContextManagers.cend(); i != end; ++i) { const QString path = i.key() + QLatin1Char('/') +contextPart; if (isActiveContext(path)) { cpPriv->state |= QNetworkConfiguration::Active; @@ -867,10 +864,8 @@ bool QNetworkManagerEngine::isActiveContext(const QString &contextPath) const { if (ofonoManager && ofonoManager->isValid()) { const QString contextPart = contextPath.section('/', -1); - QHashIterator i(ofonoContextManagers); - while (i.hasNext()) { - i.next(); - PathPropertiesList list = i.value()->contextsWithProperties(); + for (QOfonoDataConnectionManagerInterface *iface : ofonoContextManagers) { + const PathPropertiesList list = iface->contextsWithProperties(); for (int i = 0; i < list.size(); ++i) { if (list.at(i).path.path().contains(contextPart)) { return list.at(i).properties.value(QStringLiteral("Active")).toBool(); @@ -1012,10 +1007,7 @@ QNetworkSessionPrivate *QNetworkManagerEngine::createSessionBackend() QNetworkConfigurationPrivatePointer QNetworkManagerEngine::defaultConfiguration() { - QHashIterator i(activeConnectionsList); - while (i.hasNext()) { - i.next(); - QNetworkManagerConnectionActive *activeConnection = i.value(); + for (QNetworkManagerConnectionActive *activeConnection : qAsConst(activeConnectionsList)) { if ((activeConnection->defaultRoute() || activeConnection->default6Route())) { return accessPointConfigurations.value(activeConnection->connection().path()); } @@ -1027,9 +1019,7 @@ QNetworkConfigurationPrivatePointer QNetworkManagerEngine::defaultConfiguration( QNetworkConfiguration::BearerType QNetworkManagerEngine::currentBearerType(const QString &id) const { QString contextPart = id.section('/', -1); - QHashIterator i(ofonoContextManagers); - while (i.hasNext()) { - i.next(); + for (auto i = ofonoContextManagers.begin(), end = ofonoContextManagers.end(); i != end; ++i) { QString contextPath = i.key() + QLatin1Char('/') +contextPart; if (i.value()->contexts().contains(contextPath)) { @@ -1058,10 +1048,8 @@ QNetworkConfiguration::BearerType QNetworkManagerEngine::currentBearerType(const QString QNetworkManagerEngine::contextName(const QString &path) const { QString contextPart = path.section('/', -1); - QHashIterator i(ofonoContextManagers); - while (i.hasNext()) { - i.next(); - PathPropertiesList list = i.value()->contextsWithProperties(); + for (QOfonoDataConnectionManagerInterface *iface : ofonoContextManagers) { + const PathPropertiesList list = iface->contextsWithProperties(); for (int i = 0; i < list.size(); ++i) { if (list.at(i).path.path().contains(contextPart)) { return list.at(i).properties.value(QStringLiteral("Name")).toString(); -- cgit v1.2.3 From 8ebe8ae35ee7556de0749bc27737ced7c61f5153 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 5 Aug 2016 16:12:00 -0700 Subject: HiDPI Drag and Drop: Properly render the default image on Mac MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is only when the attached MIME data contains text, and we fall back to rendering that text into a pixmap. It requires getting the device pixel ratio from the source which, for now, may be a QWidget or a QWindow. Other cases may exist, but that would bring more dependencies than desired. Similarly, it fixes the draggabletext example. Other examples would require either to get updated pixmaps or change substantially in order to support HiDPI (e.g., the fridgemagnets example). Change-Id: I66198214233e3e06c87505744e2aaa9691fe1bb6 Reviewed-by: Filipe Azevedo Reviewed-by: Timur Pocheptsov Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoadrag.mm | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoadrag.mm b/src/plugins/platforms/cocoa/qcocoadrag.mm index 80006ae9b8..1e9c355788 100644 --- a/src/plugins/platforms/cocoa/qcocoadrag.mm +++ b/src/plugins/platforms/cocoa/qcocoadrag.mm @@ -34,6 +34,9 @@ #include "qcocoadrag.h" #include "qmacclipboard.h" #include "qcocoahelpers.h" +#ifndef QT_NO_WIDGETS +#include +#endif QT_BEGIN_NAMESPACE @@ -181,7 +184,18 @@ QPixmap QCocoaDrag::dragPixmap(QDrag *drag, QPoint &hotSpot) const const int width = fm.width(s); const int height = fm.height(); if (width > 0 && height > 0) { - pm = QPixmap(width, height); + qreal dpr = 1.0; + if (const QWindow *sourceWindow = qobject_cast(drag->source())) { + dpr = sourceWindow->devicePixelRatio(); + } +#ifndef QT_NO_WIDGETS + else if (const QWidget *sourceWidget = qobject_cast(drag->source())) { + if (const QWindow *sourceWindow = sourceWidget->window()->windowHandle()) + dpr = sourceWindow->devicePixelRatio(); + } +#endif + pm = QPixmap(width * dpr, height * dpr); + pm.setDevicePixelRatio(dpr); QPainter p(&pm); p.fillRect(0, 0, pm.width(), pm.height(), Qt::color0); p.setPen(Qt::color1); -- cgit v1.2.3 From af7b4e3f5564f8a47c4ca14c543d74c5684238ee Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 8 Aug 2016 10:42:28 +0200 Subject: eglfs: Enable virtual desktop with EGLDevice as well Not clear why separateScreen was overridden to true. The GBM-based backend goes with the default of false, leading to setting up the screens as virtual siblings and reporting the correct virtual desktop geometry. The difference currently lies in the OpenGL mouse cursor, which, unlike the GBM hardware cursor, does not yet support virtual desktops. Its behavior is not affected of the flag however. Task-number: QTBUG-54151 Task-number: QTBUG-55161 Task-number: QTBUG-55188 Change-Id: I888ffc43ed4add66065a2f7c606c9b3a2d56a9ab Reviewed-by: Andy Nichols Reviewed-by: Dominik Holland --- .../eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp | 5 ----- .../eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h | 2 -- .../eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp | 1 + .../eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp | 2 +- 4 files changed, 2 insertions(+), 8 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp index 28967d71ff..cbf7cfe7d0 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp @@ -222,11 +222,6 @@ QEglFSWindow *QEglFSKmsEglDeviceIntegration::createWindow(QWindow *window) const return eglWindow; } -bool QEglFSKmsEglDeviceIntegration::separateScreens() const -{ - return true; -} - QEglFSKmsDevice *QEglFSKmsEglDeviceIntegration::createDevice(const QString &devicePath) { Q_UNUSED(devicePath) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h index f04c42267a..af6b3f81ce 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h @@ -61,8 +61,6 @@ public: bool supportsPBuffers() const Q_DECL_OVERRIDE; QEglFSWindow *createWindow(QWindow *window) const Q_DECL_OVERRIDE; - virtual bool separateScreens() const Q_DECL_OVERRIDE; - EGLDeviceEXT eglDevice() const { return m_egl_device; } protected: diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp index f4ffee569d..934f7802ac 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp @@ -376,6 +376,7 @@ void QEglFSKmsDevice::createScreens() drmModeFreeResources(resources); if (!m_integration->separateScreens()) { + // set up a virtual desktop Q_FOREACH (QPlatformScreen *screen, siblings) static_cast(screen)->setVirtualSiblings(siblings); } diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp index e6b256f6b2..addcb366eb 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp @@ -81,7 +81,7 @@ QEglFSKmsScreen::QEglFSKmsScreen(QEglFSKmsIntegration *integration, , m_powerState(PowerStateOn) , m_interruptHandler(new QEglFSKmsInterruptHandler(this)) { - m_siblings << this; + m_siblings << this; // gets overridden by QEglFSKmsDevice later if !separateScreens } QEglFSKmsScreen::~QEglFSKmsScreen() -- cgit v1.2.3 From e93042522817003f35402adea83b8a537dba7c87 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 8 Aug 2016 12:06:40 +0200 Subject: eglfs: Fix QT_QPA_EGLFS_ROTATION with the KMS/DRM screeen It overrides geometry(). Change-Id: I93c607567d7cb688221d200dcd47c1a6ba23b26b Reviewed-by: Andy Nichols --- .../eglfs_kms_support/qeglfskmsscreen.cpp | 26 +++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp index addcb366eb..fb8233a875 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp @@ -101,9 +101,29 @@ QEglFSKmsScreen::~QEglFSKmsScreen() QRect QEglFSKmsScreen::geometry() const { const int mode = m_output.mode; - return QRect(m_pos.x(), m_pos.y(), - m_output.modes[mode].hdisplay, - m_output.modes[mode].vdisplay); + QRect r(m_pos.x(), m_pos.y(), + m_output.modes[mode].hdisplay, + m_output.modes[mode].vdisplay); + + static int rotation = qEnvironmentVariableIntValue("QT_QPA_EGLFS_ROTATION"); + switch (rotation) { + case 0: + case 180: + case -180: + break; + case 90: + case -90: { + int h = r.height(); + r.setHeight(r.width()); + r.setWidth(h); + break; + } + default: + qWarning("Invalid rotation %d specified in QT_QPA_EGLFS_ROTATION", rotation); + break; + } + + return r; } int QEglFSKmsScreen::depth() const -- cgit v1.2.3 From b305702d1e38d72765325dd7b1f2a7fde14e5529 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 8 Aug 2016 11:37:43 +0200 Subject: eglfs: Support virtual desktops in the OpenGL cursor The GBM-based hardware cursor already has this. Let's implement it in the commonly used OpenGL cursor too. The main user will be the EGLDevice backend which does not currently have a hardware cursor but supports multiple screens. This also means QEglFSCursor must be capable of operating on different contexts (and what's more, non-sharing contexts). Task-number: QTBUG-55161 Change-Id: Ie23bba1e6aab34b04d689f26a84c19a2bde518da Reviewed-by: Andy Nichols --- src/plugins/platforms/eglfs/api/qeglfscursor.cpp | 163 +++++++++++++-------- src/plugins/platforms/eglfs/api/qeglfscursor_p.h | 27 ++-- .../eglfs/api/qeglfsdeviceintegration.cpp | 3 +- .../eglfs_kms_egldevice/qeglfskmsegldevice.cpp | 33 ++++- .../eglfs_kms_egldevice/qeglfskmsegldevice.h | 12 ++ .../qeglfskmsegldeviceintegration.cpp | 6 + .../qeglfskmsegldeviceintegration.h | 1 + .../qeglfskmsegldevicescreen.cpp | 22 +++ .../eglfs_kms_egldevice/qeglfskmsegldevicescreen.h | 7 + 9 files changed, 198 insertions(+), 76 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/eglfs/api/qeglfscursor.cpp b/src/plugins/platforms/eglfs/api/qeglfscursor.cpp index 7c1f11372a..0040ecd59d 100644 --- a/src/plugins/platforms/eglfs/api/qeglfscursor.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfscursor.cpp @@ -59,12 +59,11 @@ QT_BEGIN_NAMESPACE QEglFSCursor::QEglFSCursor(QPlatformScreen *screen) - : m_visible(true), - m_screen(static_cast(screen)), - m_program(0), - m_textureEntry(0), - m_deviceListener(0), - m_updateRequested(false) + : m_visible(true), + m_screen(static_cast(screen)), + m_activeScreen(nullptr), + m_deviceListener(0), + m_updateRequested(false) { QByteArray hideCursorVal = qgetenv("QT_QPA_EGLFS_HIDECURSOR"); if (!hideCursorVal.isEmpty()) @@ -116,15 +115,14 @@ void QEglFSCursorDeviceListener::onDeviceListChanged(QInputDeviceManager::Device void QEglFSCursor::resetResources() { - if (QOpenGLContext::currentContext()) { - delete m_program; - glDeleteTextures(1, &m_cursor.customCursorTexture); - glDeleteTextures(1, &m_cursorAtlas.texture); + if (QOpenGLContext *ctx = QOpenGLContext::currentContext()) { + GraphicsContextData &gfx(m_gfx[ctx]); + delete gfx.program; + glDeleteTextures(1, &gfx.customCursorTexture); + glDeleteTextures(1, &gfx.atlasTexture); + gfx = GraphicsContextData(); } - m_program = 0; - m_cursor.customCursorTexture = 0; m_cursor.customCursorPending = !m_cursor.customCursorImage.isNull(); - m_cursorAtlas.texture = 0; } void QEglFSCursor::createShaderPrograms() @@ -146,15 +144,16 @@ void QEglFSCursor::createShaderPrograms() " gl_FragColor = texture2D(texture, textureCoord).bgra;\n" "}\n"; - m_program = new QOpenGLShaderProgram; - m_program->addShaderFromSourceCode(QOpenGLShader::Vertex, textureVertexProgram); - m_program->addShaderFromSourceCode(QOpenGLShader::Fragment, textureFragmentProgram); - m_program->bindAttributeLocation("vertexCoordEntry", 0); - m_program->bindAttributeLocation("textureCoordEntry", 1); - m_program->link(); + GraphicsContextData &gfx(m_gfx[QOpenGLContext::currentContext()]); + gfx.program = new QOpenGLShaderProgram; + gfx.program->addShaderFromSourceCode(QOpenGLShader::Vertex, textureVertexProgram); + gfx.program->addShaderFromSourceCode(QOpenGLShader::Fragment, textureFragmentProgram); + gfx.program->bindAttributeLocation("vertexCoordEntry", 0); + gfx.program->bindAttributeLocation("textureCoordEntry", 1); + gfx.program->link(); - m_textureEntry = m_program->uniformLocation("texture"); - m_matEntry = m_program->uniformLocation("mat"); + gfx.textureEntry = gfx.program->uniformLocation("texture"); + gfx.matEntry = gfx.program->uniformLocation("mat"); } void QEglFSCursor::createCursorTexture(uint *texture, const QImage &image) @@ -214,7 +213,7 @@ void QEglFSCursor::changeCursor(QCursor *cursor, QWindow *window) Q_UNUSED(window); const QRect oldCursorRect = cursorRect(); if (setCurrentCursor(cursor)) - update(oldCursorRect | cursorRect()); + update(oldCursorRect | cursorRect(), false); } bool QEglFSCursor::setCurrentCursor(QCursor *cursor) @@ -238,16 +237,17 @@ bool QEglFSCursor::setCurrentCursor(QCursor *cursor) hs * (m_cursor.shape / m_cursorAtlas.cursorsPerRow), ws, hs); m_cursor.hotSpot = m_cursorAtlas.hotSpots[m_cursor.shape]; - m_cursor.texture = m_cursorAtlas.texture; + m_cursor.useCustomCursor = false; m_cursor.size = QSize(m_cursorAtlas.cursorWidth, m_cursorAtlas.cursorHeight); } else { QImage image = cursor->pixmap().toImage(); m_cursor.textureRect = QRectF(0, 0, 1, 1); m_cursor.hotSpot = cursor->hotSpot(); - m_cursor.texture = 0; // will get updated in the next render() + m_cursor.useCustomCursor = false; // will get updated in the next render() m_cursor.size = image.size(); m_cursor.customCursorImage = image; m_cursor.customCursorPending = true; + m_cursor.customCursorKey = m_cursor.customCursorImage.cacheKey(); } return true; @@ -257,17 +257,20 @@ bool QEglFSCursor::setCurrentCursor(QCursor *cursor) class CursorUpdateEvent : public QEvent { public: - CursorUpdateEvent(const QPoint &pos, const QRegion &rgn) + CursorUpdateEvent(const QPoint &pos, const QRect &rect, bool allScreens) : QEvent(QEvent::Type(QEvent::User + 1)), m_pos(pos), - m_region(rgn) + m_rect(rect), + m_allScreens(allScreens) { } QPoint pos() const { return m_pos; } - QRegion region() const { return m_region; } + QRegion rect() const { return m_rect; } + bool allScreens() const { return m_allScreens; } private: QPoint m_pos; - QRegion m_region; + QRect m_rect; + bool m_allScreens; }; bool QEglFSCursor::event(QEvent *e) @@ -275,21 +278,30 @@ bool QEglFSCursor::event(QEvent *e) if (e->type() == QEvent::User + 1) { CursorUpdateEvent *ev = static_cast(e); m_updateRequested = false; - QWindowSystemInterface::handleExposeEvent(m_screen->topLevelAt(ev->pos()), ev->region()); - QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents); + if (!ev->allScreens()) { + QWindow *w = m_screen->topLevelAt(ev->pos()); // works for the entire virtual desktop, no need to loop + if (w) { + QWindowSystemInterface::handleExposeEvent(w, ev->rect()); + QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents); + } + } else { + for (QWindow *w : qGuiApp->topLevelWindows()) + QWindowSystemInterface::handleExposeEvent(w, w->geometry()); + QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents); + } return true; } return QPlatformCursor::event(e); } -void QEglFSCursor::update(const QRegion &rgn) +void QEglFSCursor::update(const QRect &rect, bool allScreens) { if (!m_updateRequested) { // Must not flush the window system events directly from here since we are likely to // be a called directly from QGuiApplication's processMouseEvents. Flushing events // could cause reentering by dispatching more queued mouse events. m_updateRequested = true; - QCoreApplication::postEvent(this, new CursorUpdateEvent(m_cursor.pos, rgn)); + QCoreApplication::postEvent(this, new CursorUpdateEvent(m_cursor.pos, rect, allScreens)); } } @@ -308,8 +320,9 @@ void QEglFSCursor::setPos(const QPoint &pos) QGuiApplicationPrivate::inputDeviceManager()->setCursorPos(pos); const QRect oldCursorRect = cursorRect(); m_cursor.pos = pos; - update(oldCursorRect | cursorRect()); - m_screen->handleCursorMove(m_cursor.pos); + update(oldCursorRect | cursorRect(), false); + for (QPlatformScreen *screen : m_screen->virtualSiblings()) + static_cast(screen)->handleCursorMove(m_cursor.pos); } void QEglFSCursor::pointerEvent(const QMouseEvent &event) @@ -318,8 +331,9 @@ void QEglFSCursor::pointerEvent(const QMouseEvent &event) return; const QRect oldCursorRect = cursorRect(); m_cursor.pos = event.screenPos().toPoint(); - update(oldCursorRect | cursorRect()); - m_screen->handleCursorMove(m_cursor.pos); + update(oldCursorRect | cursorRect(), false); + for (QPlatformScreen *screen : m_screen->virtualSiblings()) + static_cast(screen)->handleCursorMove(m_cursor.pos); } void QEglFSCursor::paintOnScreen() @@ -327,15 +341,35 @@ void QEglFSCursor::paintOnScreen() if (!m_visible) return; - const QRectF cr = cursorRect(); - const QRect screenRect(m_screen->geometry()); - const GLfloat x1 = 2 * (cr.left() / screenRect.width()) - 1; - const GLfloat x2 = 2 * (cr.right() / screenRect.width()) - 1; - const GLfloat y1 = 1 - (cr.top() / screenRect.height()) * 2; - const GLfloat y2 = 1 - (cr.bottom() / screenRect.height()) * 2; - QRectF r(QPointF(x1, y1), QPointF(x2, y2)); + QRect cr = cursorRect(); // hotspot included + + // Support virtual desktop too. Backends with multi-screen support (e.g. all + // variants of KMS/DRM) will enable this by default. In this case all + // screens are siblings of each other. When not enabled, the sibling list + // only contains m_screen itself. + for (QPlatformScreen *screen : m_screen->virtualSiblings()) { + if (screen->geometry().contains(cr.topLeft() + m_cursor.hotSpot) + && QOpenGLContext::currentContext()->screen() == screen->screen()) + { + cr.translate(-screen->geometry().topLeft()); + const QSize screenSize = screen->geometry().size(); + const GLfloat x1 = 2 * (cr.left() / GLfloat(screenSize.width())) - 1; + const GLfloat x2 = 2 * (cr.right() / GLfloat(screenSize.width())) - 1; + const GLfloat y1 = 1 - (cr.top() / GLfloat(screenSize.height())) * 2; + const GLfloat y2 = 1 - (cr.bottom() / GLfloat(screenSize.height())) * 2; + QRectF r(QPointF(x1, y1), QPointF(x2, y2)); + + draw(r); + + if (screen != m_activeScreen) { + m_activeScreen = screen; + // Do not want a leftover cursor on the screen the cursor just left. + update(cursorRect(), true); + } - draw(r); + break; + } + } } // In order to prevent breaking code doing custom OpenGL rendering while @@ -437,30 +471,33 @@ void QEglFSCursor::draw(const QRectF &r) { StateSaver stateSaver; - if (!m_program) { + GraphicsContextData &gfx(m_gfx[QOpenGLContext::currentContext()]); + if (!gfx.program) { // one time initialization initializeOpenGLFunctions(); createShaderPrograms(); - if (!m_cursorAtlas.texture) { - createCursorTexture(&m_cursorAtlas.texture, m_cursorAtlas.image); + if (!gfx.atlasTexture) { + createCursorTexture(&gfx.atlasTexture, m_cursorAtlas.image); if (m_cursor.shape != Qt::BitmapCursor) - m_cursor.texture = m_cursorAtlas.texture; + m_cursor.useCustomCursor = false; } } - if (m_cursor.shape == Qt::BitmapCursor && m_cursor.customCursorPending) { + if (m_cursor.shape == Qt::BitmapCursor && (m_cursor.customCursorPending || m_cursor.customCursorKey != gfx.customCursorKey)) { // upload the custom cursor - createCursorTexture(&m_cursor.customCursorTexture, m_cursor.customCursorImage); - m_cursor.texture = m_cursor.customCursorTexture; + createCursorTexture(&gfx.customCursorTexture, m_cursor.customCursorImage); + m_cursor.useCustomCursor = true; m_cursor.customCursorPending = false; + gfx.customCursorKey = m_cursor.customCursorKey; } - Q_ASSERT(m_cursor.texture); + GLuint cursorTexture = !m_cursor.useCustomCursor ? gfx.atlasTexture : gfx.customCursorTexture; + Q_ASSERT(cursorTexture); - m_program->bind(); + gfx.program->bind(); const GLfloat x1 = r.left(); const GLfloat x2 = r.right(); @@ -485,20 +522,20 @@ void QEglFSCursor::draw(const QRectF &r) }; glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, m_cursor.texture); + glBindTexture(GL_TEXTURE_2D, cursorTexture); if (stateSaver.vaoHelper->isValid()) stateSaver.vaoHelper->glBindVertexArray(0); glBindBuffer(GL_ARRAY_BUFFER, 0); - m_program->enableAttributeArray(0); - m_program->enableAttributeArray(1); - m_program->setAttributeArray(0, cursorCoordinates, 2); - m_program->setAttributeArray(1, textureCoordinates, 2); + gfx.program->enableAttributeArray(0); + gfx.program->enableAttributeArray(1); + gfx.program->setAttributeArray(0, cursorCoordinates, 2); + gfx.program->setAttributeArray(1, textureCoordinates, 2); - m_program->setUniformValue(m_textureEntry, 0); - m_program->setUniformValue(m_matEntry, m_rotationMatrix); + gfx.program->setUniformValue(gfx.textureEntry, 0); + gfx.program->setUniformValue(gfx.matEntry, m_rotationMatrix); glDisable(GL_CULL_FACE); glFrontFace(GL_CCW); @@ -508,9 +545,9 @@ void QEglFSCursor::draw(const QRectF &r) glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - m_program->disableAttributeArray(0); - m_program->disableAttributeArray(1); - m_program->release(); + gfx.program->disableAttributeArray(0); + gfx.program->disableAttributeArray(1); + gfx.program->release(); } QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/api/qeglfscursor_p.h b/src/plugins/platforms/eglfs/api/qeglfscursor_p.h index f72e4c0374..8ccbe4493c 100644 --- a/src/plugins/platforms/eglfs/api/qeglfscursor_p.h +++ b/src/plugins/platforms/eglfs/api/qeglfscursor_p.h @@ -105,30 +105,29 @@ private: bool setCurrentCursor(QCursor *cursor); #endif void draw(const QRectF &rect); - void update(const QRegion ®ion); + void update(const QRect &rect, bool allScreens); void createShaderPrograms(); void createCursorTexture(uint *texture, const QImage &image); void initCursorAtlas(); // current cursor information struct Cursor { - Cursor() : texture(0), shape(Qt::BlankCursor), customCursorTexture(0), customCursorPending(false) { } - uint texture; // a texture from 'image' or the atlas + Cursor() : shape(Qt::BlankCursor), customCursorPending(false), customCursorKey(0), useCustomCursor(false) { } Qt::CursorShape shape; QRectF textureRect; // normalized rect inside texture QSize size; // size of the cursor QPoint hotSpot; QImage customCursorImage; QPoint pos; // current cursor position - uint customCursorTexture; bool customCursorPending; + qint64 customCursorKey; + bool useCustomCursor; } m_cursor; // cursor atlas information struct CursorAtlas { - CursorAtlas() : cursorsPerRow(0), texture(0), cursorWidth(0), cursorHeight(0) { } + CursorAtlas() : cursorsPerRow(0), cursorWidth(0), cursorHeight(0) { } int cursorsPerRow; - uint texture; int width, height; // width and height of the atlas int cursorWidth, cursorHeight; // width and height of cursors inside the atlas QList hotSpots; @@ -137,12 +136,22 @@ private: bool m_visible; QEglFSScreen *m_screen; - QOpenGLShaderProgram *m_program; - int m_textureEntry; - int m_matEntry; + QPlatformScreen *m_activeScreen; QEglFSCursorDeviceListener *m_deviceListener; bool m_updateRequested; QMatrix4x4 m_rotationMatrix; + + struct GraphicsContextData { + GraphicsContextData() : program(nullptr), textureEntry(0), matEntry(0), + customCursorTexture(0), atlasTexture(0), customCursorKey(0) { } + QOpenGLShaderProgram *program; + int textureEntry; + int matEntry; + uint customCursorTexture; + uint atlasTexture; + qint64 customCursorKey; + }; + QHash m_gfx; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp index 3848e99221..6f65929913 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp @@ -41,6 +41,7 @@ #include "qeglfsintegration.h" #include "qeglfscursor_p.h" #include "qeglfswindow_p.h" +#include "qeglfsscreen_p.h" #include "qeglfshooks_p.h" #include @@ -311,7 +312,7 @@ bool QEglFSDeviceIntegration::hasCapability(QPlatformIntegration::Capability cap QPlatformCursor *QEglFSDeviceIntegration::createCursor(QPlatformScreen *screen) const { - return new QEglFSCursor(screen); + return new QEglFSCursor(static_cast(screen)); } void QEglFSDeviceIntegration::waitForVSync(QPlatformSurface *surface) const diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp index 743f714cf0..f45b947fa6 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp @@ -40,11 +40,15 @@ #include "qeglfskmsegldevice.h" #include "qeglfskmsegldevicescreen.h" #include "qeglfskmsegldeviceintegration.h" +#include "private/qeglfscursor_p.h" #include +QT_BEGIN_NAMESPACE + QEglFSKmsEglDevice::QEglFSKmsEglDevice(QEglFSKmsIntegration *integration, const QString &path) - : QEglFSKmsDevice(integration, path) + : QEglFSKmsDevice(integration, path), + m_globalCursor(nullptr) { } @@ -52,6 +56,8 @@ bool QEglFSKmsEglDevice::open() { Q_ASSERT(fd() == -1); + qCDebug(qLcEglfsKmsDebug, "Opening DRM device %s", qPrintable(devicePath())); + int fd = drmOpen(devicePath().toLocal8Bit().constData(), Q_NULLPTR); if (Q_UNLIKELY(fd < 0)) qFatal("Could not open DRM device"); @@ -63,6 +69,8 @@ bool QEglFSKmsEglDevice::open() void QEglFSKmsEglDevice::close() { + qCDebug(qLcEglfsKmsDebug, "Closing DRM device"); + if (qt_safe_close(fd()) == -1) qErrnoWarning("Could not close DRM device"); @@ -74,7 +82,26 @@ EGLNativeDisplayType QEglFSKmsEglDevice::nativeDisplay() const return static_cast(m_integration)->eglDevice(); } -QEglFSKmsScreen *QEglFSKmsEglDevice::createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, QEglFSKmsOutput output, QPoint position) +QEglFSKmsScreen *QEglFSKmsEglDevice::createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, + QEglFSKmsOutput output, QPoint position) { - return new QEglFSKmsEglDeviceScreen(integration, device, output, position); + QEglFSKmsScreen *screen = new QEglFSKmsEglDeviceScreen(integration, device, output, position); + + if (!m_globalCursor && !integration->separateScreens()) { + qCDebug(qLcEglfsKmsDebug, "Creating new global mouse cursor"); + m_globalCursor = new QEglFSCursor(screen); + } + + return screen; } + +void QEglFSKmsEglDevice::destroyGlobalCursor() +{ + if (m_globalCursor) { + qCDebug(qLcEglfsKmsDebug, "Destroying global mouse cursor"); + delete m_globalCursor; + m_globalCursor = nullptr; + } +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h index b1c98f3fe6..a27112fb4f 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h @@ -42,6 +42,10 @@ #include +QT_BEGIN_NAMESPACE + +class QPlatformCursor; + class QEglFSKmsEglDevice: public QEglFSKmsDevice { public: @@ -56,6 +60,14 @@ public: QEglFSKmsDevice *device, QEglFSKmsOutput output, QPoint position) Q_DECL_OVERRIDE; + + QPlatformCursor *globalCursor() { return m_globalCursor; } + void destroyGlobalCursor(); + +private: + QPlatformCursor *m_globalCursor; }; +QT_END_NAMESPACE + #endif // QEGLFSKMSEGLDEVICE_H diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp index cbf7cfe7d0..0120c0726d 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp @@ -41,6 +41,7 @@ #include "qeglfskmsegldeviceintegration.h" #include #include "private/qeglfswindow_p.h" +#include "private/qeglfscursor_p.h" #include "qeglfskmsegldevice.h" #include "qeglfskmsscreen.h" #include @@ -258,4 +259,9 @@ bool QEglFSKmsEglDeviceIntegration::query_egl_device() return true; } +QPlatformCursor *QEglFSKmsEglDeviceIntegration::createCursor(QPlatformScreen *screen) const +{ + return separateScreens() ? new QEglFSCursor(screen) : nullptr; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h index af6b3f81ce..375c388548 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h @@ -65,6 +65,7 @@ public: protected: QEglFSKmsDevice *createDevice(const QString &devicePath) Q_DECL_OVERRIDE; + QPlatformCursor *createCursor(QPlatformScreen *screen) const Q_DECL_OVERRIDE; private: bool setup_kms(); diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp index da1b577801..b0deabe834 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp @@ -39,12 +39,32 @@ #include "qeglfskmsegldevicescreen.h" #include "qeglfskmsegldevice.h" +#include + +QT_BEGIN_NAMESPACE QEglFSKmsEglDeviceScreen::QEglFSKmsEglDeviceScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, QEglFSKmsOutput output, QPoint position) : QEglFSKmsScreen(integration, device, output, position) { } +QEglFSKmsEglDeviceScreen::~QEglFSKmsEglDeviceScreen() +{ + const int remainingScreenCount = qGuiApp->screens().count(); + qCDebug(qLcEglfsKmsDebug, "Screen dtor. Remaining screens: %d", remainingScreenCount); + if (!remainingScreenCount && !m_integration->separateScreens()) + static_cast(device())->destroyGlobalCursor(); +} + +QPlatformCursor *QEglFSKmsEglDeviceScreen::cursor() const +{ + // The base class creates a cursor via integration->createCursor() + // in its ctor. With separateScreens just use that. Otherwise + // there's a virtual desktop and the device has a global cursor + // and the base class has no dedicated cursor at all. + return m_integration->separateScreens() ? QEglFSScreen::cursor() : static_cast(device())->globalCursor(); +} + void QEglFSKmsEglDeviceScreen::waitForFlip() { if (!output().mode_set) { @@ -76,3 +96,5 @@ void QEglFSKmsEglDeviceScreen::waitForFlip() } } + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.h index 0cd46e9f9d..7fceae4978 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.h @@ -42,6 +42,8 @@ #include +QT_BEGIN_NAMESPACE + class QEglFSKmsEglDeviceScreen : public QEglFSKmsScreen { public: @@ -49,8 +51,13 @@ public: QEglFSKmsDevice *device, QEglFSKmsOutput output, QPoint position); + ~QEglFSKmsEglDeviceScreen(); + + QPlatformCursor *cursor() const Q_DECL_OVERRIDE; void waitForFlip() Q_DECL_OVERRIDE; }; +QT_END_NAMESPACE + #endif // QEGLFSKMSEGLDEVICESCREEN_H -- cgit v1.2.3 From 7de7f981dceb86775bdcc1ebb2b39b58ddca6d71 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 8 Aug 2016 16:54:52 +0200 Subject: eglfs: Add physicalWidth and height overrides to KMS config Task-number: QTBUG-55188 Change-Id: I751b8c3c4b6f7a33b08ec23fd16cd025a5792ba6 Reviewed-by: Dominik Holland Reviewed-by: Andy Nichols --- .../eglfs_kms_support/qeglfskmsdevice.cpp | 28 +++++++++++++++------- .../eglfs_kms_support/qeglfskmsdevice.h | 2 +- 2 files changed, 20 insertions(+), 10 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp index 934f7802ac..30cd2f3225 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp @@ -159,7 +159,7 @@ static bool parseModeline(const QByteArray &text, drmModeModeInfoPtr mode) return true; } -QEglFSKmsScreen *QEglFSKmsDevice::screenForConnector(drmModeResPtr resources, drmModeConnectorPtr connector, QPoint pos) +QEglFSKmsScreen *QEglFSKmsDevice::createScreenForConnector(drmModeResPtr resources, drmModeConnectorPtr connector, QPoint pos) { const QByteArray connectorName = nameForConnector(connector); @@ -173,8 +173,11 @@ QEglFSKmsScreen *QEglFSKmsDevice::screenForConnector(drmModeResPtr resources, dr QSize configurationSize; drmModeModeInfo configurationModeline; - const QByteArray mode = m_integration->outputSettings().value(QString::fromUtf8(connectorName)) - .value(QStringLiteral("mode"), QStringLiteral("preferred")).toByteArray().toLower(); + auto userConfig = m_integration->outputSettings(); + auto userConnectorConfig = userConfig.value(QString::fromUtf8(connectorName)); + // default to the preferred mode unless overridden in the config + const QByteArray mode = userConnectorConfig.value(QStringLiteral("mode"), QStringLiteral("preferred")) + .toByteArray().toLower(); if (mode == "off") { configuration = OutputConfigOff; } else if (mode == "preferred") { @@ -287,18 +290,25 @@ QEglFSKmsScreen *QEglFSKmsDevice::screenForConnector(drmModeResPtr resources, dr qCDebug(qLcEglfsKmsDebug) << "Selected mode" << selected_mode << ":" << width << "x" << height << '@' << refresh << "hz for output" << connectorName; } + + // physical size from connector < config values < env vars static const int width = qEnvironmentVariableIntValue("QT_QPA_EGLFS_PHYSICAL_WIDTH"); static const int height = qEnvironmentVariableIntValue("QT_QPA_EGLFS_PHYSICAL_HEIGHT"); - QSizeF size(width, height); - if (size.isEmpty()) { - size.setWidth(connector->mmWidth); - size.setHeight(connector->mmHeight); + QSizeF physSize(width, height); + if (physSize.isEmpty()) { + physSize = QSize(userConnectorConfig.value(QStringLiteral("physicalWidth")).toInt(), + userConnectorConfig.value(QStringLiteral("physicalHeight")).toInt()); + if (physSize.isEmpty()) { + physSize.setWidth(connector->mmWidth); + physSize.setHeight(connector->mmHeight); + } } + QEglFSKmsOutput output = { QString::fromUtf8(connectorName), connector->connector_id, crtc_id, - size, + physSize, selected_mode, false, drmModeGetCrtc(m_dri_fd, crtc_id), @@ -360,7 +370,7 @@ void QEglFSKmsDevice::createScreens() if (!connector) continue; - QEglFSKmsScreen *screen = screenForConnector(resources, connector, pos); + QEglFSKmsScreen *screen = createScreenForConnector(resources, connector, pos); if (screen) { integration->addScreen(screen); pos.rx() += screen->geometry().width(); diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h index 041c063695..6561949780 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h @@ -80,7 +80,7 @@ protected: quint32 m_connector_allocator; int crtcForConnector(drmModeResPtr resources, drmModeConnectorPtr connector); - QEglFSKmsScreen *screenForConnector(drmModeResPtr resources, drmModeConnectorPtr connector, QPoint pos); + QEglFSKmsScreen *createScreenForConnector(drmModeResPtr resources, drmModeConnectorPtr connector, QPoint pos); drmModePropertyPtr connectorProperty(drmModeConnectorPtr connector, const QByteArray &name); static void pageFlipHandler(int fd, -- cgit v1.2.3 From 9ab5c329bfe17122441000f0c8cdd1f32f09072b Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 9 Aug 2016 09:16:38 +0200 Subject: eglfs: Add basic support for controlling how the virtual desktop is formed Choose between horizontal (default) and vertical. Task-number: QTBUG-55188 Change-Id: Ibc490b0ad8c60b66db785455c57987eb8afdad0d Reviewed-by: Dominik Holland Reviewed-by: Andy Nichols --- .../eglfs_kms_support/qeglfskmsdevice.cpp | 7 +++++- .../eglfs_kms_support/qeglfskmsintegration.cpp | 25 ++++++++++++++++++---- .../eglfs_kms_support/qeglfskmsintegration.h | 7 ++++++ 3 files changed, 34 insertions(+), 5 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp index 30cd2f3225..74c7667f1f 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp @@ -373,7 +373,12 @@ void QEglFSKmsDevice::createScreens() QEglFSKmsScreen *screen = createScreenForConnector(resources, connector, pos); if (screen) { integration->addScreen(screen); - pos.rx() += screen->geometry().width(); + + if (m_integration->virtualDesktopLayout() == QEglFSKmsIntegration::VirtualDesktopLayoutVertical) + pos.ry() += screen->geometry().height(); + else + pos.rx() += screen->geometry().width(); + siblings << screen; if (!primaryScreen) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp index 7389050efc..0f64d5b28e 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp @@ -65,6 +65,7 @@ QEglFSKmsIntegration::QEglFSKmsIntegration() , m_hwCursor(false) , m_pbuffers(false) , m_separateScreens(false) + , m_virtualDesktopLayout(VirtualDesktopLayoutHorizontal) {} void QEglFSKmsIntegration::platformInit() @@ -149,6 +150,11 @@ bool QEglFSKmsIntegration::separateScreens() const return m_separateScreens; } +QEglFSKmsIntegration::VirtualDesktopLayout QEglFSKmsIntegration::virtualDesktopLayout() const +{ + return m_virtualDesktopLayout; +} + QMap QEglFSKmsIntegration::outputSettings() const { return m_outputSettings; @@ -169,15 +175,15 @@ void QEglFSKmsIntegration::loadConfig() QFile file(QString::fromUtf8(json)); if (!file.open(QFile::ReadOnly)) { - qCDebug(qLcEglfsKmsDebug) << "Could not open config file" - << json << "for reading"; + qCWarning(qLcEglfsKmsDebug) << "Could not open config file" + << json << "for reading"; return; } const QJsonDocument doc = QJsonDocument::fromJson(file.readAll()); if (!doc.isObject()) { - qCDebug(qLcEglfsKmsDebug) << "Invalid config file" << json - << "- no top-level JSON object"; + qCWarning(qLcEglfsKmsDebug) << "Invalid config file" << json + << "- no top-level JSON object"; return; } @@ -188,6 +194,16 @@ void QEglFSKmsIntegration::loadConfig() m_devicePath = object.value(QLatin1String("device")).toString(); m_separateScreens = object.value(QLatin1String("separateScreens")).toBool(m_separateScreens); + const QString vdOriString = object.value(QLatin1String("virtualDesktopLayout")).toString(); + if (!vdOriString.isEmpty()) { + if (vdOriString == QLatin1String("horizontal")) + m_virtualDesktopLayout = VirtualDesktopLayoutHorizontal; + else if (vdOriString == QLatin1String("vertical")) + m_virtualDesktopLayout = VirtualDesktopLayoutVertical; + else + qCWarning(qLcEglfsKmsDebug) << "Unknown virtualDesktop value" << vdOriString; + } + const QJsonArray outputs = object.value(QLatin1String("outputs")).toArray(); for (int i = 0; i < outputs.size(); i++) { const QVariantMap outputSettings = outputs.at(i).toObject().toVariantMap(); @@ -207,6 +223,7 @@ void QEglFSKmsIntegration::loadConfig() << "\thwcursor:" << m_hwCursor << "\n" << "\tpbuffers:" << m_pbuffers << "\n" << "\tseparateScreens:" << m_separateScreens << "\n" + << "\tvirtualDesktopLayout:" << m_virtualDesktopLayout << "\n" << "\toutputs:" << m_outputSettings; } diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h index 81386881ff..ba49945715 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h @@ -56,6 +56,11 @@ Q_EGLFS_EXPORT Q_DECLARE_LOGGING_CATEGORY(qLcEglfsKmsDebug) class Q_EGLFS_EXPORT QEglFSKmsIntegration : public QEglFSDeviceIntegration { public: + enum VirtualDesktopLayout { + VirtualDesktopLayoutHorizontal, + VirtualDesktopLayoutVertical + }; + QEglFSKmsIntegration(); void platformInit() Q_DECL_OVERRIDE; @@ -70,6 +75,7 @@ public: virtual bool hwCursor() const; virtual bool separateScreens() const; + virtual VirtualDesktopLayout virtualDesktopLayout() const; QMap outputSettings() const; QEglFSKmsDevice *device() const; @@ -83,6 +89,7 @@ protected: bool m_hwCursor; bool m_pbuffers; bool m_separateScreens; + VirtualDesktopLayout m_virtualDesktopLayout; QString m_devicePath; QMap m_outputSettings; }; -- cgit v1.2.3 From e9fe0a15a8ede45020def7059ed4f49a5c20186d Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 9 Aug 2016 11:53:01 +0200 Subject: eglfs: Fix rotation support with the DRM backends The change in QEglFSScreen::geometry() was not reflected in the advanced backends that subclass it. Change-Id: I6494a96f0b9afaea3722c61035d4b46bf2473897 Reviewed-by: Andy Nichols --- src/plugins/platforms/eglfs/api/qeglfsscreen.cpp | 4 ++-- src/plugins/platforms/eglfs/api/qeglfsscreen_p.h | 2 +- src/plugins/platforms/eglfs/api/qeglfswindow.cpp | 4 ++-- .../eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp | 4 ++-- .../eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp | 4 ++-- .../eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp | 4 +++- .../eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h | 2 +- 7 files changed, 13 insertions(+), 11 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp index 47ef2f64e7..b0c32e5176 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp @@ -65,7 +65,7 @@ QEglFSScreen::~QEglFSScreen() QRect QEglFSScreen::geometry() const { - QRect r = geometryForSurface(); + QRect r = rawGeometry(); static int rotation = qEnvironmentVariableIntValue("QT_QPA_EGLFS_ROTATION"); switch (rotation) { @@ -88,7 +88,7 @@ QRect QEglFSScreen::geometry() const return r; } -QRect QEglFSScreen::geometryForSurface() const +QRect QEglFSScreen::rawGeometry() const { return QRect(QPoint(0, 0), qt_egl_device_integration()->screenSize()); } diff --git a/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h b/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h index 232525fae3..daba9fc591 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h +++ b/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h @@ -68,7 +68,7 @@ public: ~QEglFSScreen(); QRect geometry() const Q_DECL_OVERRIDE; - QRect geometryForSurface() const; + virtual QRect rawGeometry() const; int depth() const Q_DECL_OVERRIDE; QImage::Format format() const Q_DECL_OVERRIDE; diff --git a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp index 74723955c6..5ce88e6bd8 100644 --- a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp @@ -142,7 +142,7 @@ void QEglFSWindow::create() context->setScreen(window()->screen()); if (Q_UNLIKELY(!context->create())) qFatal("EGLFS: Failed to create compositing context"); - compositor->setTarget(context, window(), screen->geometryForSurface()); + compositor->setTarget(context, window(), screen->rawGeometry()); compositor->setRotation(qEnvironmentVariableIntValue("QT_QPA_EGLFS_ROTATION")); // If there is a "root" window into which raster and QOpenGLWidget content is // composited, all other contexts must share with its context. @@ -190,7 +190,7 @@ void QEglFSWindow::resetSurface() m_config = QEglFSDeviceIntegration::chooseConfig(display, platformFormat); m_format = q_glFormatFromConfig(display, m_config, platformFormat); - const QSize surfaceSize = screen()->geometryForSurface().size(); + const QSize surfaceSize = screen()->rawGeometry().size(); m_window = qt_egl_device_integration()->createNativeWindow(this, surfaceSize, m_format); m_surface = eglCreateWindowSurface(display, m_config, m_window, NULL); } diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp index 7a17b60a5e..9ffffd7471 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp @@ -130,8 +130,8 @@ gbm_surface *QEglFSKmsGbmScreen::createSurface() if (!m_gbm_surface) { qCDebug(qLcEglfsKmsDebug) << "Creating window for screen" << name(); m_gbm_surface = gbm_surface_create(static_cast(device())->gbmDevice(), - geometry().width(), - geometry().height(), + rawGeometry().width(), + rawGeometry().height(), GBM_FORMAT_XRGB8888, GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); } diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp index 0120c0726d..ddb2499751 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp @@ -194,8 +194,8 @@ void QEglJetsonTK1Window::resetSurface() m_format = q_glFormatFromConfig(display, m_config); qCDebug(qLcEglfsKmsDebug) << "Stream producer format is" << m_format; - const int w = cur_screen->geometry().width(); - const int h = cur_screen->geometry().height(); + const int w = cur_screen->rawGeometry().width(); + const int h = cur_screen->rawGeometry().height(); qCDebug(qLcEglfsKmsDebug, "Creating stream producer surface of size %dx%d", w, h); const EGLint stream_producer_attribs[] = { diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp index fb8233a875..55417e4525 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp @@ -98,7 +98,9 @@ QEglFSKmsScreen::~QEglFSKmsScreen() delete m_interruptHandler; } -QRect QEglFSKmsScreen::geometry() const +// Reimplement rawGeometry(), not geometry(). The base class implementation of +// geometry() calls rawGeometry() and may apply additional transforms. +QRect QEglFSKmsScreen::rawGeometry() const { const int mode = m_output.mode; QRect r(m_pos.x(), m_pos.y(), diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h index 9679f70260..7b424b5382 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h @@ -78,7 +78,7 @@ public: QPoint position); ~QEglFSKmsScreen(); - QRect geometry() const Q_DECL_OVERRIDE; + QRect rawGeometry() const Q_DECL_OVERRIDE; int depth() const Q_DECL_OVERRIDE; QImage::Format format() const Q_DECL_OVERRIDE; -- cgit v1.2.3 From e694ced803589b3504b6bdb2fc8bf97bc891c794 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 4 Aug 2016 12:22:05 +0200 Subject: Add X11 support for the DRIVE CX The spec, added in 5.7.0, simply defined WIN_INTERFACE_CUSTOM, leading to the generic, non-X11 typedefs for the EGL native types. This is fine for the typical embedded use, but is not what is wanted when targeting xcb, and leads to disabling EGL-on-X support. Therefore, move the define into a comon header and let the individual libs decide by defining or not defining QT_EGL_NO_X11. This sets both MESA_EGL_NO_X11_HEADERS and WIN_INTERFACE_CUSTOM in qt_egl_p.h. This way Qt builds supporting all three of eglfs (DRM+EGLDevice), wayland, and xcb (EGL) can be generated out of the box. [ChangeLog][Platform Specific Changes][Linux] xcb with EGL and OpenGL ES, as well as eglfs with the eglfs_x11 backend, are now supported on DRIVE CX boards when using the linux-drive-cx-g++ device spec. Done-with: Louai Al-Khanji Task-number: QTBUG-55140 Change-Id: I6f186d16612e170995e3bca1214bcabad59af08e Reviewed-by: Andy Nichols --- src/plugins/platforms/directfb/qdirectfb_egl.cpp | 2 +- .../platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro | 4 ++-- src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro | 4 ++-- .../deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro | 3 ++- .../eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro | 4 ++-- .../platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro | 4 ++-- src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro | 4 ++-- .../eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp | 4 ++-- src/plugins/platforms/eglfs/eglfs_device_lib.pro | 4 ++-- src/plugins/platforms/eglfs/qeglfsglobal.h | 2 +- src/plugins/platforms/minimalegl/minimalegl.pro | 4 ++-- src/plugins/platforms/minimalegl/qminimaleglintegration.cpp | 2 +- src/plugins/platforms/minimalegl/qminimaleglscreen.h | 2 +- src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglinclude.h | 2 +- src/plugins/platforms/xcb/qxcbintegration.cpp | 2 +- 15 files changed, 24 insertions(+), 23 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/directfb/qdirectfb_egl.cpp b/src/plugins/platforms/directfb/qdirectfb_egl.cpp index 0e706d789a..2a04c0bba3 100644 --- a/src/plugins/platforms/directfb/qdirectfb_egl.cpp +++ b/src/plugins/platforms/directfb/qdirectfb_egl.cpp @@ -49,7 +49,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro index e2ebf9f7ee..2b710ac24c 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro @@ -8,8 +8,8 @@ CONFIG += egl LIBS += -lbcm_host QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF -# Avoid X11 header collision -DEFINES += MESA_EGL_NO_X11_HEADERS +# Avoid X11 header collision, use generic EGL native types +DEFINES += QT_EGL_NO_X11 SOURCES += $$PWD/qeglfsbrcmmain.cpp \ $$PWD/qeglfsbrcmintegration.cpp diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro index 979bfe3ea9..b1791240ab 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro @@ -8,8 +8,8 @@ QT += core-private gui-private platformsupport-private eglfs_device_lib-private INCLUDEPATH += $$PWD/../.. $$PWD/../eglfs_kms_support -# Avoid X11 header collision -DEFINES += MESA_EGL_NO_X11_HEADERS +# Avoid X11 header collision, use generic EGL native types +DEFINES += QT_EGL_NO_X11 CONFIG += link_pkgconfig !contains(QT_CONFIG, no-pkg-config) { diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro index 3a380b7525..e2263f6cbf 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro @@ -4,7 +4,8 @@ QT += core-private gui-private platformsupport-private eglfs_device_lib-private INCLUDEPATH += $$PWD/../.. $$PWD/../eglfs_kms_support -DEFINES += MESA_EGL_NO_X11_HEADERS +# Avoid X11 header collision, use generic EGL native types +DEFINES += QT_EGL_NO_X11 CONFIG += link_pkgconfig !contains(QT_CONFIG, no-pkg-config) { diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro index 6355fe6abd..32f15f33fb 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro @@ -6,8 +6,8 @@ QT += core-private gui-private platformsupport-private eglfs_device_lib-private INCLUDEPATH += $$PWD/../.. -# Avoid X11 header collision -DEFINES += MESA_EGL_NO_X11_HEADERS +# Avoid X11 header collision, use generic EGL native types +DEFINES += QT_EGL_NO_X11 CONFIG += link_pkgconfig !contains(QT_CONFIG, no-pkg-config) { diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro index 7fc4568ae3..3e486bd1bd 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro @@ -2,8 +2,8 @@ TARGET = qeglfs-mali-integration QT += core-private gui-private platformsupport-private eglfs_device_lib-private -# Avoid X11 header collision -DEFINES += MESA_EGL_NO_X11_HEADERS +# Avoid X11 header collision, use generic EGL native types +DEFINES += QT_EGL_NO_X11 INCLUDEPATH += $$PWD/../.. CONFIG += egl diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro index 83f0c74910..1948d73750 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro @@ -2,8 +2,8 @@ TARGET = qeglfs-x11-integration QT += core-private gui-private platformsupport-private eglfs_device_lib-private -# Avoid X11 header collision -DEFINES += MESA_EGL_NO_X11_HEADERS +# Avoid X11 header collision, use generic EGL native types +DEFINES += QT_EGL_NO_X11 INCLUDEPATH += $$PWD/../.. diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp index 74a687b382..f9924fe5ce 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp @@ -281,12 +281,12 @@ EGLNativeWindowType QEglFSX11Integration::createNativeWindow(QPlatformWindow *pl xcb_flush(m_connection); - return m_window; + return qt_egl_cast(m_window); } void QEglFSX11Integration::destroyNativeWindow(EGLNativeWindowType window) { - xcb_destroy_window(m_connection, window); + xcb_destroy_window(m_connection, qt_egl_cast(window)); } bool QEglFSX11Integration::hasCapability(QPlatformIntegration::Capability cap) const diff --git a/src/plugins/platforms/eglfs/eglfs_device_lib.pro b/src/plugins/platforms/eglfs/eglfs_device_lib.pro index f784020fb6..974b85b1dd 100644 --- a/src/plugins/platforms/eglfs/eglfs_device_lib.pro +++ b/src/plugins/platforms/eglfs/eglfs_device_lib.pro @@ -9,8 +9,8 @@ CONFIG += no_module_headers internal_module QT += core-private gui-private platformsupport-private LIBS += $$QMAKE_LIBS_DYNLOAD -# Avoid X11 header collision -DEFINES += MESA_EGL_NO_X11_HEADERS +# Avoid X11 header collision, use generic EGL native types +DEFINES += QT_EGL_NO_X11 DEFINES += QT_BUILD_EGL_DEVICE_LIB diff --git a/src/plugins/platforms/eglfs/qeglfsglobal.h b/src/plugins/platforms/eglfs/qeglfsglobal.h index d6aba565ce..309655e86c 100644 --- a/src/plugins/platforms/eglfs/qeglfsglobal.h +++ b/src/plugins/platforms/eglfs/qeglfsglobal.h @@ -48,7 +48,7 @@ #define Q_EGLFS_EXPORT Q_DECL_IMPORT #endif -#include +#include #undef Status #undef None #undef Bool diff --git a/src/plugins/platforms/minimalegl/minimalegl.pro b/src/plugins/platforms/minimalegl/minimalegl.pro index ac67249591..b8a91729fd 100644 --- a/src/plugins/platforms/minimalegl/minimalegl.pro +++ b/src/plugins/platforms/minimalegl/minimalegl.pro @@ -6,8 +6,8 @@ QT += core-private gui-private platformsupport-private #DEFINES += Q_OPENKODE -#Avoid X11 header collision -DEFINES += MESA_EGL_NO_X11_HEADERS +# Avoid X11 header collision, use generic EGL native types +DEFINES += QT_EGL_NO_X11 SOURCES = main.cpp \ qminimaleglintegration.cpp \ diff --git a/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp b/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp index cf31eec75f..b1d3691a10 100644 --- a/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp +++ b/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp @@ -58,7 +58,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/minimalegl/qminimaleglscreen.h b/src/plugins/platforms/minimalegl/qminimaleglscreen.h index 825d5e8541..4b53bbd39a 100644 --- a/src/plugins/platforms/minimalegl/qminimaleglscreen.h +++ b/src/plugins/platforms/minimalegl/qminimaleglscreen.h @@ -44,7 +44,7 @@ #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglinclude.h b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglinclude.h index 9729f610b6..7c6524c8ee 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglinclude.h +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglinclude.h @@ -46,7 +46,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index cdbf9b295e..5a89113a4f 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -65,7 +65,7 @@ #include #ifdef XCB_USE_EGL -#include +# include #endif #ifdef XCB_USE_XLIB -- cgit v1.2.3 From 23ac125bcb750575b86edfaa08448f8358260e4b Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Mon, 13 Jun 2016 17:05:43 +0300 Subject: Android: don't wait if the event loop is stopped QAndroidEventDispatcherStopper is stopped when the application is in background and the user uses the task manager to kill the task. If the application has services the task manager doesn't kills it, but instead it tries to gently terminate the activity. The problem is that the activity is still backgrounded (meaning that the Qt event loop is freezed), therefore terminateQt will hang. Task-number: QTBUG-54012 Change-Id: I6e333cbcaf41e9e298eeb8b2b0bc3adcf446783f Reviewed-by: Christian Stromme --- src/plugins/platforms/android/androidjnimain.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp index 671dad98b2..fe2401f561 100644 --- a/src/plugins/platforms/android/androidjnimain.cpp +++ b/src/plugins/platforms/android/androidjnimain.cpp @@ -539,8 +539,11 @@ static void quitQtAndroidPlugin(JNIEnv *env, jclass /*clazz*/) static void terminateQt(JNIEnv *env, jclass /*clazz*/) { - sem_wait(&m_terminateSemaphore); - sem_destroy(&m_terminateSemaphore); + // QAndroidEventDispatcherStopper is stopped when the user uses the task manager to kill the application + if (!QAndroidEventDispatcherStopper::instance()->stopped()) { + sem_wait(&m_terminateSemaphore); + sem_destroy(&m_terminateSemaphore); + } env->DeleteGlobalRef(m_applicationClass); env->DeleteGlobalRef(m_classLoaderObject); if (m_resourcesObj) @@ -558,8 +561,11 @@ static void terminateQt(JNIEnv *env, jclass /*clazz*/) m_androidPlatformIntegration = nullptr; delete m_androidAssetsFileEngineHandler; m_androidAssetsFileEngineHandler = nullptr; - sem_post(&m_exitSemaphore); - pthread_join(m_qtAppThread, nullptr); + + if (!QAndroidEventDispatcherStopper::instance()->stopped()) { + sem_post(&m_exitSemaphore); + pthread_join(m_qtAppThread, nullptr); + } } static void setSurface(JNIEnv *env, jobject /*thiz*/, jint id, jobject jSurface, jint w, jint h) -- cgit v1.2.3 From 23ea54d861be1b68e5df4264c75e0e8d0f5d3c04 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 5 Aug 2016 16:18:50 -0700 Subject: Drag and Drop: Don't let Cocoa override proposed actions When pressing the Command key, or any other modifier key, Cocoa will filter whatever the application has set in the QDrag object. However, Qt is already taking all this into account, so we should not let yet another voice chime in. Task-number: QTBUG-55177 Change-Id: I7c56e72d846d10cdfc132776bdfdd6b79799bcff Reviewed-by: Timur Pocheptsov Reviewed-by: Jake Petroules --- src/plugins/platforms/cocoa/qnsview.mm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 913ce08d17..784b1ca14b 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -1922,7 +1922,15 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin - (BOOL) ignoreModifierKeysWhileDragging { - return NO; + // According to the "Dragging Sources" chapter on Cocoa DnD Programming + // (https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/DragandDrop/Concepts/dragsource.html), + // if the control, option, or command key is pressed, the source’s + // operation mask is filtered to only contain a reduced set of operations. + // + // Since Qt already takes care of tracking the keyboard modifiers, we + // don't need (or want) Cocoa to filter anything. Instead, we'll let + // the application do the actual filtering. + return YES; } - (BOOL)wantsPeriodicDraggingUpdates -- cgit v1.2.3 From 4c002a8343baa8453a5485ce7939569bfc5b3267 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 5 Aug 2016 11:41:47 -0700 Subject: Cocoa: Update deprecated dragging session APIs Change-Id: I06e2dd3861c4bc5d85421ac71daf188732279e77 Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/cocoa/qnsview.mm | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 784b1ca14b..c67bcfd23b 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -1913,15 +1913,18 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin return target->mapFromGlobal(source->mapToGlobal(point)); } -- (NSDragOperation) draggingSourceOperationMaskForLocal:(BOOL)isLocal +- (NSDragOperation)draggingSession:(NSDraggingSession *)session + sourceOperationMaskForDraggingContext:(NSDraggingContext)context { - Q_UNUSED(isLocal); + Q_UNUSED(session); + Q_UNUSED(context); QCocoaDrag* nativeDrag = QCocoaIntegration::instance()->drag(); return qt_mac_mapDropActions(nativeDrag->currentDrag()->supportedActions()); } -- (BOOL) ignoreModifierKeysWhileDragging +- (BOOL)ignoreModifierKeysForDraggingSession:(NSDraggingSession *)session { + Q_UNUSED(session); // According to the "Dragging Sources" chapter on Cocoa DnD Programming // (https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/DragandDrop/Concepts/dragsource.html), // if the control, option, or command key is pressed, the source’s @@ -2075,27 +2078,27 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin return response.isAccepted(); } -- (void)draggedImage:(NSImage*) img endedAt:(NSPoint) point operation:(NSDragOperation) operation +- (void)draggingSession:(NSDraggingSession *)session + endedAtPoint:(NSPoint)screenPoint + operation:(NSDragOperation)operation { - Q_UNUSED(img); + Q_UNUSED(session); Q_UNUSED(operation); QWindow *target = findEventTargetWindow(m_window); if (!target) return; -// keep our state, and QGuiApplication state (buttons member) in-sync, -// or future mouse events will be processed incorrectly + // keep our state, and QGuiApplication state (buttons member) in-sync, + // or future mouse events will be processed incorrectly NSUInteger pmb = [NSEvent pressedMouseButtons]; for (int buttonNumber = 0; buttonNumber < 32; buttonNumber++) { // see cocoaButton2QtButton() for the 32 value if (!(pmb & (1 << buttonNumber))) m_buttons &= ~cocoaButton2QtButton(buttonNumber); } - NSPoint windowPoint = [self convertPoint: point fromView: nil]; + NSPoint windowPoint = [self.window convertRectFromScreen:NSMakeRect(screenPoint.x, screenPoint.y, 1, 1)].origin; QPoint qtWindowPoint(windowPoint.x, windowPoint.y); - NSWindow *window = [self window]; - NSPoint screenPoint = [window convertRectToScreen:NSMakeRect(point.x, point.y, 0, 0)].origin; QPoint qtScreenPoint = QPoint(screenPoint.x, qt_mac_flipYCoordinate(screenPoint.y)); QWindowSystemInterface::handleMouseEvent(target, mapWindowCoordinates(m_window, target, qtWindowPoint), qtScreenPoint, m_buttons); -- cgit v1.2.3 From 2afead0211302799519abee5c164ae0602a7e13b Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 9 Aug 2016 10:08:46 +0200 Subject: eglfs: Configurable screen order in the virtual desktop Say one wants a virtual desktop with the display on HDMI above the display on DisplayPort: { "device": "drm-nvdc", "virtualDesktopOrientation": "vertical", "outputs": [ { "name": "HDMI1", "virtualIndex": 0 }, { "name": "DP1" } ] } Undefined virtualIndex values map to INT_MAX and will go after the explicitly specified ones. However, the sorting is stable so the original order from the DRM connector list is preserved between such outputs. Task-number: QTBUG-55188 Change-Id: I204fb08205ea7dbfbcdefd1d22ed22f5387f3e8c Reviewed-by: Andy Nichols --- .../eglfs_kms/qeglfskmsgbmdevice.cpp | 4 +- .../eglfs_kms/qeglfskmsgbmdevice.h | 3 +- .../eglfs_kms/qeglfskmsgbmscreen.cpp | 7 +- .../eglfs_kms/qeglfskmsgbmscreen.h | 5 +- .../eglfs_kms_egldevice/qeglfskmsegldevice.cpp | 4 +- .../eglfs_kms_egldevice/qeglfskmsegldevice.h | 3 +- .../qeglfskmsegldevicescreen.cpp | 4 +- .../eglfs_kms_egldevice/qeglfskmsegldevicescreen.h | 3 +- .../eglfs_kms_support/qeglfskmsdevice.cpp | 77 +++++++++++++++------- .../eglfs_kms_support/qeglfskmsdevice.h | 5 +- .../eglfs_kms_support/qeglfskmsintegration.cpp | 2 +- .../eglfs_kms_support/qeglfskmsscreen.cpp | 35 +++------- .../eglfs_kms_support/qeglfskmsscreen.h | 6 +- 13 files changed, 84 insertions(+), 74 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp index 278752bddf..99f6cfb0ca 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp @@ -142,10 +142,10 @@ void QEglFSKmsGbmDevice::handleDrmEvent() drmHandleEvent(fd(), &drmEvent); } -QEglFSKmsScreen *QEglFSKmsGbmDevice::createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, QEglFSKmsOutput output, QPoint position) +QEglFSKmsScreen *QEglFSKmsGbmDevice::createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, QEglFSKmsOutput output) { static bool firstScreen = true; - QEglFSKmsGbmScreen *screen = new QEglFSKmsGbmScreen(integration, device, output, position); + QEglFSKmsGbmScreen *screen = new QEglFSKmsGbmScreen(integration, device, output); if (firstScreen && integration->hwCursor()) { m_globalCursor = new QEglFSKmsGbmCursor(screen); diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h index 6a45f9ffa0..7c0af84422 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h @@ -68,8 +68,7 @@ public: virtual QEglFSKmsScreen *createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, - QEglFSKmsOutput output, - QPoint position) Q_DECL_OVERRIDE; + QEglFSKmsOutput output) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(QEglFSKmsGbmDevice) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp index 9ffffd7471..dde386fc57 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp @@ -93,10 +93,9 @@ QEglFSKmsGbmScreen::FrameBuffer *QEglFSKmsGbmScreen::framebufferForBufferObject( } QEglFSKmsGbmScreen::QEglFSKmsGbmScreen(QEglFSKmsIntegration *integration, - QEglFSKmsDevice *device, - QEglFSKmsOutput output, - QPoint position) - : QEglFSKmsScreen(integration, device, output, position) + QEglFSKmsDevice *device, + QEglFSKmsOutput output) + : QEglFSKmsScreen(integration, device, output) , m_gbm_surface(Q_NULLPTR) , m_gbm_bo_current(Q_NULLPTR) , m_gbm_bo_next(Q_NULLPTR) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h index 3381bbfdbb..d7ad348291 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h @@ -55,9 +55,8 @@ class QEglFSKmsGbmScreen : public QEglFSKmsScreen { public: QEglFSKmsGbmScreen(QEglFSKmsIntegration *integration, - QEglFSKmsDevice *device, - QEglFSKmsOutput output, - QPoint position); + QEglFSKmsDevice *device, + QEglFSKmsOutput output); ~QEglFSKmsGbmScreen(); QPlatformCursor *cursor() const Q_DECL_OVERRIDE; diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp index f45b947fa6..d30963ff96 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp @@ -83,9 +83,9 @@ EGLNativeDisplayType QEglFSKmsEglDevice::nativeDisplay() const } QEglFSKmsScreen *QEglFSKmsEglDevice::createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, - QEglFSKmsOutput output, QPoint position) + QEglFSKmsOutput output) { - QEglFSKmsScreen *screen = new QEglFSKmsEglDeviceScreen(integration, device, output, position); + QEglFSKmsScreen *screen = new QEglFSKmsEglDeviceScreen(integration, device, output); if (!m_globalCursor && !integration->separateScreens()) { qCDebug(qLcEglfsKmsDebug, "Creating new global mouse cursor"); diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h index a27112fb4f..8c8f79f70c 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h @@ -58,8 +58,7 @@ public: virtual QEglFSKmsScreen *createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, - QEglFSKmsOutput output, - QPoint position) Q_DECL_OVERRIDE; + QEglFSKmsOutput output) Q_DECL_OVERRIDE; QPlatformCursor *globalCursor() { return m_globalCursor; } void destroyGlobalCursor(); diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp index b0deabe834..55d5941e5f 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp @@ -43,8 +43,8 @@ QT_BEGIN_NAMESPACE -QEglFSKmsEglDeviceScreen::QEglFSKmsEglDeviceScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, QEglFSKmsOutput output, QPoint position) - : QEglFSKmsScreen(integration, device, output, position) +QEglFSKmsEglDeviceScreen::QEglFSKmsEglDeviceScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, QEglFSKmsOutput output) + : QEglFSKmsScreen(integration, device, output) { } diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.h index 7fceae4978..c57f52c6b7 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.h @@ -49,8 +49,7 @@ class QEglFSKmsEglDeviceScreen : public QEglFSKmsScreen public: QEglFSKmsEglDeviceScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, - QEglFSKmsOutput output, - QPoint position); + QEglFSKmsOutput output); ~QEglFSKmsEglDeviceScreen(); QPlatformCursor *cursor() const Q_DECL_OVERRIDE; diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp index 74c7667f1f..842896bbad 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp @@ -159,7 +159,7 @@ static bool parseModeline(const QByteArray &text, drmModeModeInfoPtr mode) return true; } -QEglFSKmsScreen *QEglFSKmsDevice::createScreenForConnector(drmModeResPtr resources, drmModeConnectorPtr connector, QPoint pos) +QEglFSKmsScreen *QEglFSKmsDevice::createScreenForConnector(drmModeResPtr resources, drmModeConnectorPtr connector, int *virtualIndex) { const QByteArray connectorName = nameForConnector(connector); @@ -192,6 +192,8 @@ QEglFSKmsScreen *QEglFSKmsDevice::createScreenForConnector(drmModeResPtr resourc qWarning("Invalid mode \"%s\" for output %s", mode.constData(), connectorName.constData()); configuration = OutputConfigPreferred; } + if (virtualIndex) + *virtualIndex = userConnectorConfig.value(QStringLiteral("virtualIndex"), INT_MAX).toInt(); const uint32_t crtc_id = resources->crtcs[crtc]; @@ -303,6 +305,7 @@ QEglFSKmsScreen *QEglFSKmsDevice::createScreenForConnector(drmModeResPtr resourc physSize.setHeight(connector->mmHeight); } } + qCDebug(qLcEglfsKmsDebug) << "Physical size is" << physSize << "mm" << "for output" << connectorName; QEglFSKmsOutput output = { QString::fromUtf8(connectorName), @@ -320,7 +323,7 @@ QEglFSKmsScreen *QEglFSKmsDevice::createScreenForConnector(drmModeResPtr resourc m_crtc_allocator |= (1 << output.crtc_id); m_connector_allocator |= (1 << output.connector_id); - return createScreen(m_integration, this, output, pos); + return createScreen(m_integration, this, output); } drmModePropertyPtr QEglFSKmsDevice::connectorProperty(drmModeConnectorPtr connector, const QByteArray &name) @@ -352,6 +355,26 @@ QEglFSKmsDevice::~QEglFSKmsDevice() { } +struct OrderedScreen +{ + OrderedScreen() : screen(nullptr), index(-1) { } + OrderedScreen(QEglFSKmsScreen *screen, int index) : screen(screen), index(index) { } + QEglFSKmsScreen *screen; + int index; +}; + +QDebug operator<<(QDebug dbg, const OrderedScreen &s) +{ + QDebugStateSaver saver(dbg); + dbg.nospace() << "OrderedScreen(" << s.screen << " : " << s.index << ")"; + return dbg; +} + +static bool orderedScreenLessThan(const OrderedScreen &a, const OrderedScreen &b) +{ + return a.index < b.index; +} + void QEglFSKmsDevice::createScreens() { drmModeResPtr resources = drmModeGetResources(m_dri_fd); @@ -360,38 +383,46 @@ void QEglFSKmsDevice::createScreens() return; } - QEglFSKmsScreen *primaryScreen = Q_NULLPTR; - QList siblings; - QPoint pos(0, 0); - QEglFSIntegration *integration = static_cast(QGuiApplicationPrivate::platformIntegration()); + QVector screens; for (int i = 0; i < resources->count_connectors; i++) { drmModeConnectorPtr connector = drmModeGetConnector(m_dri_fd, resources->connectors[i]); if (!connector) continue; - QEglFSKmsScreen *screen = createScreenForConnector(resources, connector, pos); - if (screen) { - integration->addScreen(screen); - - if (m_integration->virtualDesktopLayout() == QEglFSKmsIntegration::VirtualDesktopLayoutVertical) - pos.ry() += screen->geometry().height(); - else - pos.rx() += screen->geometry().width(); - - siblings << screen; - - if (!primaryScreen) - primaryScreen = screen; - } + int virtualIndex; + QEglFSKmsScreen *screen = createScreenForConnector(resources, connector, &virtualIndex); + if (screen) + screens.append(OrderedScreen(screen, virtualIndex)); drmModeFreeConnector(connector); } drmModeFreeResources(resources); + // Use stable sort to preserve the original order for outputs with unspecified indices. + std::stable_sort(screens.begin(), screens.end(), orderedScreenLessThan); + qCDebug(qLcEglfsKmsDebug) << "Sorted screen list:" << screens; + + QPoint pos(0, 0); + QList siblings; + QEglFSIntegration *qpaIntegration = static_cast(QGuiApplicationPrivate::platformIntegration()); + + for (const OrderedScreen &orderedScreen : screens) { + QEglFSKmsScreen *s = orderedScreen.screen; + // set up a horizontal or vertical virtual desktop + s->setVirtualPosition(pos); + if (m_integration->virtualDesktopLayout() == QEglFSKmsIntegration::VirtualDesktopLayoutVertical) + pos.ry() += s->geometry().height(); + else + pos.rx() += s->geometry().width(); + qCDebug(qLcEglfsKmsDebug) << "Adding screen" << s << "to QPA with geometry" << s->geometry(); + qpaIntegration->addScreen(s); + siblings << s; + } + if (!m_integration->separateScreens()) { - // set up a virtual desktop + // enable the virtual desktop Q_FOREACH (QPlatformScreen *screen, siblings) static_cast(screen)->setVirtualSiblings(siblings); } @@ -407,9 +438,9 @@ QString QEglFSKmsDevice::devicePath() const return m_path; } -QEglFSKmsScreen *QEglFSKmsDevice::createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, QEglFSKmsOutput output, QPoint position) +QEglFSKmsScreen *QEglFSKmsDevice::createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, QEglFSKmsOutput output) { - return new QEglFSKmsScreen(integration, device, output, position); + return new QEglFSKmsScreen(integration, device, output); } void QEglFSKmsDevice::setFd(int fd) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h index 6561949780..4aad2e0143 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h @@ -68,8 +68,7 @@ public: protected: virtual QEglFSKmsScreen *createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, - QEglFSKmsOutput output, - QPoint position); + QEglFSKmsOutput output); void setFd(int fd); QEglFSKmsIntegration *m_integration; @@ -80,7 +79,7 @@ protected: quint32 m_connector_allocator; int crtcForConnector(drmModeResPtr resources, drmModeConnectorPtr connector); - QEglFSKmsScreen *createScreenForConnector(drmModeResPtr resources, drmModeConnectorPtr connector, QPoint pos); + QEglFSKmsScreen *createScreenForConnector(drmModeResPtr resources, drmModeConnectorPtr connector, int *virtualIndex); drmModePropertyPtr connectorProperty(drmModeConnectorPtr connector, const QByteArray &name); static void pageFlipHandler(int fd, diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp index 0f64d5b28e..6c30e8f930 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp @@ -201,7 +201,7 @@ void QEglFSKmsIntegration::loadConfig() else if (vdOriString == QLatin1String("vertical")) m_virtualDesktopLayout = VirtualDesktopLayoutVertical; else - qCWarning(qLcEglfsKmsDebug) << "Unknown virtualDesktop value" << vdOriString; + qCWarning(qLcEglfsKmsDebug) << "Unknown virtualDesktopOrientation value" << vdOriString; } const QJsonArray outputs = object.value(QLatin1String("outputs")).toArray(); diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp index 55417e4525..f690cd668e 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp @@ -71,13 +71,11 @@ private: QEglFSKmsScreen::QEglFSKmsScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, - QEglFSKmsOutput output, - QPoint position) + QEglFSKmsOutput output) : QEglFSScreen(eglGetDisplay(device->nativeDisplay())) , m_integration(integration) , m_device(device) , m_output(output) - , m_pos(position) , m_powerState(PowerStateOn) , m_interruptHandler(new QEglFSKmsInterruptHandler(this)) { @@ -98,34 +96,19 @@ QEglFSKmsScreen::~QEglFSKmsScreen() delete m_interruptHandler; } +void QEglFSKmsScreen::setVirtualPosition(const QPoint &pos) +{ + m_pos = pos; +} + // Reimplement rawGeometry(), not geometry(). The base class implementation of // geometry() calls rawGeometry() and may apply additional transforms. QRect QEglFSKmsScreen::rawGeometry() const { const int mode = m_output.mode; - QRect r(m_pos.x(), m_pos.y(), - m_output.modes[mode].hdisplay, - m_output.modes[mode].vdisplay); - - static int rotation = qEnvironmentVariableIntValue("QT_QPA_EGLFS_ROTATION"); - switch (rotation) { - case 0: - case 180: - case -180: - break; - case 90: - case -90: { - int h = r.height(); - r.setHeight(r.width()); - r.setWidth(h); - break; - } - default: - qWarning("Invalid rotation %d specified in QT_QPA_EGLFS_ROTATION", rotation); - break; - } - - return r; + return QRect(m_pos.x(), m_pos.y(), + m_output.modes[mode].hdisplay, + m_output.modes[mode].vdisplay); } int QEglFSKmsScreen::depth() const diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h index 7b424b5382..2b6a0ffe6c 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h @@ -74,11 +74,13 @@ class Q_EGLFS_EXPORT QEglFSKmsScreen : public QEglFSScreen public: QEglFSKmsScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, - QEglFSKmsOutput output, - QPoint position); + QEglFSKmsOutput output); ~QEglFSKmsScreen(); + void setVirtualPosition(const QPoint &pos); + QRect rawGeometry() const Q_DECL_OVERRIDE; + int depth() const Q_DECL_OVERRIDE; QImage::Format format() const Q_DECL_OVERRIDE; -- cgit v1.2.3 From dfae6a7593a6bb4ad6accc30d6aaf01a98bc2a6f Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 9 Aug 2016 15:48:12 +0200 Subject: evdevtouch: Enable touch in multi-screen eglfs environments Parse the touchDevice property from the KMS/DRM config file. When all outputs have an explicitly specified index in the virtual desktop, we can set up a mapping between the device node and the screen index. It is somewhat fragile (device nodes may change, requires explicit virtualIndex properties for all outputs, etc.) but better than nothing. For example, having the screen on DisplayPort as primary and the touchscreen on HDMI as the secondary screen breaks by default because touching the second screen generates touch (and synthesized mouse) events for the first screen. Assuming the touchscreen is /dev/input/event5, the issue can now be fixed by setting QT_QPA_EGLFS_KMS_CONFIG with a configuration like the following: { "device": "drm-nvdc", "outputs": [ { "name": "HDMI1", "touchDevice": "/dev/input/event5", "virtualIndex": 1 }, { "name": "DP1", "virtualIndex": 0 } ] } Task-number: QTBUG-54151 Change-Id: If97fa18a65599ccfe64ce408ea43086ec3863682 Reviewed-by: Andy Nichols --- .../eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/plugins') diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp index 842896bbad..5944e8d51f 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp @@ -417,6 +417,9 @@ void QEglFSKmsDevice::createScreens() else pos.rx() += s->geometry().width(); qCDebug(qLcEglfsKmsDebug) << "Adding screen" << s << "to QPA with geometry" << s->geometry(); + // The order in qguiapp's screens list will match the order set by + // virtualIndex. This is not only handy but also required since for instance + // evdevtouch relies on it when performing touch device - screen mapping. qpaIntegration->addScreen(s); siblings << s; } -- cgit v1.2.3 From a2ae631c04fee752e492f2c0b8fd25f06abffd6b Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Wed, 3 Aug 2016 12:00:41 +0200 Subject: Doc: Change instances of '(Mac) OS X' to 'macOS' As of version 10.12 (Sierra), the name of Apple's desktop operating system will be macOS. Change the occurrences where the Mac platform is discussed to use a macro \macos, which expands to 'macOS'. This helps with adapting to future renaming. Update the instructions on mac-specific Q_OS_* macro usage. Add a \target for the old 'Qt for OS X' topic to keep links working for other documentation modules that try to link with the old name. Change-Id: Id33fb0cd985df702a4ae4efb4c5fd428e77d9b85 Reviewed-by: Leena Miettinen --- src/plugins/platforms/cocoa/qcocoahelpers.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index 58d2961111..058209da7e 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -649,7 +649,7 @@ QString qt_mac_removeAmpersandEscapes(QString s) returned if it can't be obtained. It is the caller's responsibility to CGContextRelease the context when finished using it. - \warning This function is only available on OS X. + \warning This function is only available on \macos. \warning This function is duplicated in qmacstyle_mac.mm */ CGContextRef qt_mac_cg_context(QPaintDevice *pdev) -- cgit v1.2.3 From ac899f6d60758fef03ec10850272361bf6a06dcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 23 Jun 2016 11:59:32 +0200 Subject: Cocoa: use QImage::toCGImage() Keep behavior of converting via Format_ARGB32_Premultiplied for unsupported formats Change-Id: I64083a88a99640dde42a0a201ce8ea08affe5259 Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/cocoa/qcocoahelpers.mm | 52 ++++++---------------------- 1 file changed, 10 insertions(+), 42 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index 9b4055d92d..8601e222ec 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -101,6 +101,16 @@ void *qt_mac_QStringListToNSMutableArrayVoid(const QStringList &list) return result; } +CGImageRef qt_mac_toCGImage(const QImage &inImage) +{ + CGImageRef cgImage = inImage.toCGImage(); + if (cgImage) + return cgImage; + + // Convert image data to a known-good format if the fast conversion fails. + return inImage.convertToFormat(QImage::Format_ARGB32_Premultiplied).toCGImage(); +} + static void qt_mac_deleteImage(void *image, const void *, size_t) { delete static_cast(image); @@ -114,48 +124,6 @@ CGDataProviderRef qt_mac_CGDataProvider(const QImage &image) image.byteCount(), qt_mac_deleteImage); } -CGImageRef qt_mac_toCGImage(const QImage &inImage) -{ - if (inImage.isNull()) - return 0; - - QImage image = inImage; - - uint cgflags = kCGImageAlphaNone; - switch (image.format()) { - case QImage::Format_ARGB32: - cgflags = kCGImageAlphaFirst | kCGBitmapByteOrder32Host; - break; - case QImage::Format_RGB32: - cgflags = kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host; - break; - case QImage::Format_RGB888: - cgflags = kCGImageAlphaNone | kCGBitmapByteOrder32Big; - break; - case QImage::Format_RGBA8888_Premultiplied: - cgflags = kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big; - break; - case QImage::Format_RGBA8888: - cgflags = kCGImageAlphaLast | kCGBitmapByteOrder32Big; - break; - case QImage::Format_RGBX8888: - cgflags = kCGImageAlphaNoneSkipLast | kCGBitmapByteOrder32Big; - break; - default: - // Everything not recognized explicitly is converted to ARGB32_Premultiplied. - image = inImage.convertToFormat(QImage::Format_ARGB32_Premultiplied); - // no break; - case QImage::Format_ARGB32_Premultiplied: - cgflags = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host; - break; - } - - QCFType dataProvider = qt_mac_CGDataProvider(image); - return CGImageCreate(image.width(), image.height(), 8, 32, - image.bytesPerLine(), - qt_mac_genericColorSpace(), - cgflags, dataProvider, 0, false, kCGRenderingIntentDefault); -} CGImageRef qt_mac_toCGImageMask(const QImage &image) { -- cgit v1.2.3 From dfa8854cf7e00705e0122cf7022ff1ea4f8e5a74 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 11 Aug 2016 20:25:23 +0200 Subject: Cocoa: make dialogs emit the "selected" signals MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-54951 Change-Id: Iba031a9038aad00e0d06f608eac8d95184ca6950 Reviewed-by: Jake Petroules Reviewed-by: Gabriel de Dietrich Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm | 9 +++++++++ src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm | 1 + 2 files changed, 10 insertions(+) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index 4eb35f5495..475e6c7afb 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -582,6 +582,15 @@ void QCocoaFileDialogHelper::QNSOpenSavePanelDelegate_panelClosed(bool accepted) QCocoaMenuBar::resetKnownMenuItemsToQt(); if (accepted) { emit accept(); + + QString filter = selectedNameFilter(); + if (filter.isEmpty()) + emit filterSelected(filter); + + QList files = selectedFiles(); + emit filesSelected(files); + if (files.count() == 1) + emit fileSelected(files.first()); } else { emit reject(); } diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm index dc7dfb788f..dfda22d376 100644 --- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm @@ -365,6 +365,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate); emit mHelper->reject(); } else { emit mHelper->accept(); + emit mHelper->fontSelected(mHelper->currentFont()); } } } -- cgit v1.2.3 From 2d83e28f08b6a0c21857a497c36c86459723787d Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 9 Aug 2016 15:09:34 +0200 Subject: remove redundant LIBS += -lGAL it's part of the egl libs. Change-Id: Id41909f2e1cc5a6a1a22a49d4bf24da43e69a417 Reviewed-by: Lars Knoll Reviewed-by: Laszlo Agocs --- src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro | 1 - .../platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro | 1 - 2 files changed, 2 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro index a53aac2041..16880535e3 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro @@ -5,7 +5,6 @@ QT += core-private gui-private platformsupport-private eglfsdeviceintegration-pr INCLUDEPATH += $$PWD/../.. CONFIG += egl DEFINES += LINUX=1 EGL_API_FB=1 -LIBS += -lGAL QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF SOURCES += $$PWD/qeglfsvivmain.cpp \ diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro index 38259f4a5d..374c5bba6b 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro @@ -5,7 +5,6 @@ QT += core-private gui-private platformsupport-private eglfsdeviceintegration-pr INCLUDEPATH += $$PWD/../.. CONFIG += egl DEFINES += LINUX=1 EGL_API_FB=1 -LIBS += -lGAL QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF SOURCES += $$PWD/qeglfsvivwlmain.cpp \ -- cgit v1.2.3 From d08db1100874fdc36ea169d34a8902133186b84b Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 6 Aug 2016 17:26:37 +0300 Subject: Remove last uses of Java-style (non-mutable) iterators from QtBase Change-Id: I7531ffd4f2d5b2193bb6231c743ff0a074618b99 Reviewed-by: Lars Knoll --- .../networkmanager/qnetworkmanagerservice.cpp | 30 +++++----------------- .../platforminputcontexts/ibus/qibustypes.cpp | 5 +--- src/plugins/platforms/qnx/qqnxscreen.cpp | 6 ++--- 3 files changed, 10 insertions(+), 31 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp index 6c3c661db6..081cb1288d 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp @@ -215,9 +215,7 @@ QString QNetworkManagerInterface::version() const void QNetworkManagerInterface::propertiesSwap(QMap map) { - QMapIterator i(map); - while (i.hasNext()) { - i.next(); + for (auto i = map.cbegin(), end = map.cend(); i != end; ++i) { propertyMap.insert(i.key(),i.value()); if (i.key() == QLatin1String("State")) { @@ -334,11 +332,8 @@ quint32 QNetworkManagerInterfaceAccessPoint::strength() const void QNetworkManagerInterfaceAccessPoint::propertiesSwap(QMap map) { - QMapIterator i(map); - while (i.hasNext()) { - i.next(); + for (auto i = map.cbegin(), end = map.cend(); i != end; ++i) propertyMap.insert(i.key(),i.value()); - } } QNetworkManagerInterfaceDevice::QNetworkManagerInterfaceDevice(const QString &deviceObjectPath, QObject *parent) @@ -421,9 +416,7 @@ QDBusObjectPath QNetworkManagerInterfaceDevice::ip4config() const void QNetworkManagerInterfaceDevice::propertiesSwap(QMap map) { - QMapIterator i(map); - while (i.hasNext()) { - i.next(); + for (auto i = map.cbegin(), end = map.cend(); i != end; ++i) { if (i.key() == QLatin1String("AvailableConnections")) { //Device const QDBusArgument &dbusArgs = i.value().value(); QDBusObjectPath path; @@ -516,9 +509,7 @@ QStringList QNetworkManagerInterfaceDeviceWired::availableConnections() void QNetworkManagerInterfaceDeviceWired::propertiesSwap(QMap map) { - QMapIterator i(map); - while (i.hasNext()) { - i.next(); + for (auto i = map.cbegin(), end = map.cend(); i != end; ++i) { propertyMap.insert(i.key(),i.value()); if (i.key() == QLatin1String("Carrier")) Q_EMIT carrierChanged(i.value().toBool()); @@ -694,9 +685,7 @@ void QNetworkManagerInterfaceDeviceWireless::requestScan() void QNetworkManagerInterfaceDeviceWireless::propertiesSwap(QMap map) { - QMapIterator i(map); - while (i.hasNext()) { - i.next(); + for (auto i = map.cbegin(), end = map.cend(); i != end; ++i) { propertyMap.insert(i.key(),i.value()); if (i.key() == QLatin1String("ActiveAccessPoint")) //DeviceWireless Q_EMIT propertiesChanged(map); @@ -753,11 +742,8 @@ QNetworkManagerInterfaceDeviceModem::ModemCapabilities QNetworkManagerInterfaceD void QNetworkManagerInterfaceDeviceModem::propertiesSwap(QMap map) { - QMapIterator i(map); - while (i.hasNext()) { - i.next(); + for (auto i = map.cbegin(), end = map.cend(); i != end; ++i) propertyMap.insert(i.key(),i.value()); - } Q_EMIT propertiesChanged(map); } @@ -1051,9 +1037,7 @@ bool QNetworkManagerConnectionActive::default6Route() const void QNetworkManagerConnectionActive::propertiesSwap(QMap map) { - QMapIterator i(map); - while (i.hasNext()) { - i.next(); + for (auto i = map.cbegin(), end = map.cend(); i != end; ++i) { propertyMap.insert(i.key(),i.value()); if (i.key() == QLatin1String("State")) { quint32 state = i.value().toUInt(); diff --git a/src/plugins/platforminputcontexts/ibus/qibustypes.cpp b/src/plugins/platforminputcontexts/ibus/qibustypes.cpp index ac82fa3931..a2551f1320 100644 --- a/src/plugins/platforminputcontexts/ibus/qibustypes.cpp +++ b/src/plugins/platforminputcontexts/ibus/qibustypes.cpp @@ -73,10 +73,7 @@ void QIBusSerializable::serializeTo(QDBusArgument &argument) const argument.beginMap(qMetaTypeId(), qMetaTypeId()); - QHashIterator i(attachments); - while (i.hasNext()) { - i.next(); - + for (auto i = attachments.begin(), end = attachments.end(); i != end; ++i) { argument.beginMapEntry(); argument << i.key(); diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp index 678e83cd57..f8ae5121d1 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.cpp +++ b/src/plugins/platforms/qnx/qqnxscreen.cpp @@ -385,10 +385,8 @@ Qt::ScreenOrientation QQnxScreen::orientation() const QWindow *QQnxScreen::topLevelAt(const QPoint &point) const { - QListIterator it(m_childWindows); - it.toBack(); - while (it.hasPrevious()) { - QWindow *win = it.previous()->window(); + for (auto it = m_childWindows.rbegin(), end = m_childWindows.rend(); it != end; ++it) { + QWindow *win = (*it)->window(); if (win->geometry().contains(point)) return win; } -- cgit v1.2.3 From a5e89005445ac8ca18ac046eaf55fe2230e47cd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 23 Jun 2016 12:04:48 +0200 Subject: Cocoa: Make qt_mac_toCGImageMask be self contained Remove qt_mac_deleteImage and qt_mac_toCGImageMask which are not used elsewhere. Change-Id: Idd3177d4c521eea318b58dc664efe6907896d022 Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/cocoa/qcocoahelpers.mm | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index 8601e222ec..6c6bc3e4eb 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -111,23 +111,13 @@ CGImageRef qt_mac_toCGImage(const QImage &inImage) return inImage.convertToFormat(QImage::Format_ARGB32_Premultiplied).toCGImage(); } -static void qt_mac_deleteImage(void *image, const void *, size_t) -{ - delete static_cast(image); -} - -// Creates a CGDataProvider with the data from the given image. -// The data provider retains a copy of the image. -CGDataProviderRef qt_mac_CGDataProvider(const QImage &image) -{ - return CGDataProviderCreateWithData(new QImage(image), image.bits(), - image.byteCount(), qt_mac_deleteImage); -} - - CGImageRef qt_mac_toCGImageMask(const QImage &image) { - QCFType dataProvider = qt_mac_CGDataProvider(image); + static const auto deleter = [](void *image, const void *, size_t) { delete static_cast(image); }; + QCFType dataProvider = + CGDataProviderCreateWithData(new QImage(image), image.bits(), + image.byteCount(), deleter); + return CGImageMaskCreate(image.width(), image.height(), 8, image.depth(), image.bytesPerLine(), dataProvider, NULL, false); } -- cgit v1.2.3 From 2e2b32a9ab459f6618d02e4b454c75a787172def Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sat, 13 Aug 2016 17:17:56 +0200 Subject: QGtk3Dialog::show(): add missing null-check to avoid warnings Or else QObject::connect() warns about 'invalid null parameter' when showing parentless dialogs. Task-number: QTBUG-55298 Change-Id: I39b1dfc81e5da0c793c86cff763f946db15c13ae Reviewed-by: Dmitry Shachnev Reviewed-by: Shawn Rutledge --- src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp index a21b4d8a65..ced5fe7086 100644 --- a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp +++ b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp @@ -117,8 +117,10 @@ void QGtk3Dialog::exec() bool QGtk3Dialog::show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) { - connect(parent, &QWindow::destroyed, this, &QGtk3Dialog::onParentWindowDestroyed, - Qt::UniqueConnection); + if (parent) { + connect(parent, &QWindow::destroyed, this, &QGtk3Dialog::onParentWindowDestroyed, + Qt::UniqueConnection); + } setParent(parent); setFlags(flags); setModality(modality); -- cgit v1.2.3 From 02a03e52f7456009818ec5c3a403242768d4fcf0 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 5 Aug 2016 09:05:29 +0200 Subject: QCocoaFileIconEngine: Add icon size 256 Change-Id: Ib36025f802404f74f6ce5494f3858dfe0e283004 Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoatheme.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm index 3a3d634f5a..cb8ffee556 100644 --- a/src/plugins/platforms/cocoa/qcocoatheme.mm +++ b/src/plugins/platforms/cocoa/qcocoatheme.mm @@ -287,7 +287,8 @@ public: const qreal devicePixelRatio = qGuiApp->devicePixelRatio(); const int sizes[] = { qRound(16 * devicePixelRatio), qRound(32 * devicePixelRatio), - qRound(64 * devicePixelRatio), qRound(128 * devicePixelRatio) + qRound(64 * devicePixelRatio), qRound(128 * devicePixelRatio), + qRound(256 * devicePixelRatio) }; return QAbstractFileIconEngine::toSizeList(sizes, sizes + sizeof(sizes) / sizeof(sizes[0])); } -- cgit v1.2.3 From 3c6220c4f8893b58af5e68ffaeff5951efe1f331 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 4 Aug 2016 15:46:20 +0200 Subject: Android selection handles This commits implement the cursor and selection handle in the platform plugin. Task-number: QTBUG-34867 Change-Id: Icb3fd9ddfd9f4152e2004078a92a3d9502e9113c Reviewed-by: BogDan Vatra --- src/plugins/platforms/android/androidjniinput.cpp | 30 +++- src/plugins/platforms/android/androidjniinput.h | 3 + .../platforms/android/qandroidinputcontext.cpp | 171 ++++++++++++++++++--- .../platforms/android/qandroidinputcontext.h | 12 ++ 4 files changed, 191 insertions(+), 25 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/android/androidjniinput.cpp b/src/plugins/platforms/android/androidjniinput.cpp index 5be128a0c5..62140c9816 100644 --- a/src/plugins/platforms/android/androidjniinput.cpp +++ b/src/plugins/platforms/android/androidjniinput.cpp @@ -1,7 +1,8 @@ /**************************************************************************** ** ** Copyright (C) 2012 BogDan Vatra -** Contact: https://www.qt.io/licensing/ +** Copyright (C) 2016 Olivier Goffart +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** @@ -120,6 +121,12 @@ namespace QtAndroidInput return m_softwareKeyboardRect; } + void updateHandles(int mode, QPoint cursor, QPoint anchor) + { + QJNIObjectPrivate::callStaticMethod(applicationClass(), "updateHandles", "(IIIII)V", + mode, cursor.x(), cursor.y(), anchor.x(), + anchor.y()); + } static void mouseDown(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/, jint x, jint y) { @@ -225,6 +232,12 @@ namespace QtAndroidInput double(dw*size), double(dh*size)); m_touchPoints.push_back(touchPoint); + + if (state == Qt::TouchPointPressed) { + QAndroidInputContext *inputContext = QAndroidInputContext::androidInputContext(); + if (inputContext && qGuiApp) + QMetaObject::invokeMethod(inputContext, "touchDown", Q_ARG(int, x), Q_ARG(int, y)); + } } static void touchEnd(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/, jint /*action*/) @@ -786,6 +799,18 @@ namespace QtAndroidInput #endif } + static void handleLocationChanged(JNIEnv */*env*/, jobject /*thiz*/, int id, int x, int y) + { +#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL + qDebug() << "@@@ handleLocationChanged" << id << x << y; +#endif + QAndroidInputContext *inputContext = QAndroidInputContext::androidInputContext(); + if (inputContext && qGuiApp) + QMetaObject::invokeMethod(inputContext, "handleLocationChanged", + Q_ARG(int, id), Q_ARG(int, x), Q_ARG(int, y)); + + } + static JNINativeMethod methods[] = { {"touchBegin","(I)V",(void*)touchBegin}, {"touchAdd","(IIIZIIFF)V",(void*)touchAdd}, @@ -799,7 +824,8 @@ namespace QtAndroidInput {"keyDown", "(IIIZ)V", (void *)keyDown}, {"keyUp", "(IIIZ)V", (void *)keyUp}, {"keyboardVisibilityChanged", "(Z)V", (void *)keyboardVisibilityChanged}, - {"keyboardGeometryChanged", "(IIII)V", (void *)keyboardGeometryChanged} + {"keyboardGeometryChanged", "(IIII)V", (void *)keyboardGeometryChanged}, + {"handleLocationChanged", "(III)V", (void *)handleLocationChanged} }; bool registerNatives(JNIEnv *env) diff --git a/src/plugins/platforms/android/androidjniinput.h b/src/plugins/platforms/android/androidjniinput.h index 682abde098..f9d2f1a2a7 100644 --- a/src/plugins/platforms/android/androidjniinput.h +++ b/src/plugins/platforms/android/androidjniinput.h @@ -56,6 +56,9 @@ namespace QtAndroidInput void updateSelection(int selStart, int selEnd, int candidatesStart, int candidatesEnd); // Software keyboard support + // cursor/selection handles + void updateHandles(int handleCount, QPoint cursor = QPoint(), QPoint anchor = QPoint()); + bool registerNatives(JNIEnv *env); } diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp index 125a03469f..c64e80479c 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.cpp +++ b/src/plugins/platforms/android/qandroidinputcontext.cpp @@ -2,6 +2,7 @@ ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2012 BogDan Vatra +** Copyright (C) 2016 Olivier Goffart ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. @@ -342,9 +343,28 @@ static JNINativeMethod methods[] = { {"updateCursorPosition", "()Z", (void *)updateCursorPosition} }; +static QRect inputItemRectangle() +{ + QRectF itemRect = qGuiApp->inputMethod()->inputItemRectangle(); + QRect rect = qGuiApp->inputMethod()->inputItemTransform().mapRect(itemRect).toRect(); + QWindow *window = qGuiApp->focusWindow(); + if (window) + rect = QRect(window->mapToGlobal(rect.topLeft()), rect.size()); + double pixelDensity = window + ? QHighDpiScaling::factor(window) + : QHighDpiScaling::factor(QtAndroid::androidPlatformIntegration()->screen()); + if (pixelDensity != 1.0) { + rect.setX(rect.x() * pixelDensity); + rect.setY(rect.y() * pixelDensity); + rect.setWidth(rect.width() * pixelDensity); + rect.setHeight(rect.height() * pixelDensity); + } + return rect; +} QAndroidInputContext::QAndroidInputContext() - : QPlatformInputContext(), m_composingTextStart(-1), m_blockUpdateSelection(false), m_batchEditNestingLevel(0), m_focusObject(0) + : QPlatformInputContext(), m_composingTextStart(-1), m_blockUpdateSelection(false), + m_cursorHandleShown(CursorHandleNotShown), m_batchEditNestingLevel(0), m_focusObject(0) { jclass clazz = QJNIEnvironmentPrivate::findClass(QtNativeInputConnectionClassName); if (Q_UNLIKELY(!clazz)) { @@ -415,6 +435,9 @@ QAndroidInputContext::QAndroidInputContext() qRegisterMetaType("QInputMethodEvent*"); qRegisterMetaType("QInputMethodQueryEvent*"); m_androidInputContext = this; + + QObject::connect(QGuiApplication::inputMethod(), &QInputMethod::cursorRectangleChanged, + this, &QAndroidInputContext::updateSelectionHandles); } QAndroidInputContext::~QAndroidInputContext() @@ -452,6 +475,7 @@ void QAndroidInputContext::reset() { clear(); m_batchEditNestingLevel = 0; + m_cursorHandleShown = QAndroidInputContext::CursorHandleNotShown; if (qGuiApp->focusObject()) { QSharedPointer query = focusObjectInputMethodQueryThreadSafe(Qt::ImEnabled); if (!query.isNull() && query->value(Qt::ImEnabled).toBool()) { @@ -500,6 +524,103 @@ void QAndroidInputContext::updateCursorPosition() } } +void QAndroidInputContext::updateSelectionHandles() +{ + auto im = qGuiApp->inputMethod(); + if (!m_focusObject || (m_cursorHandleShown == CursorHandleNotShown)) { + // Hide the handles + QtAndroidInput::updateHandles(0); + return; + } + QWindow *window = qGuiApp->focusWindow(); + double pixelDensity = window + ? QHighDpiScaling::factor(window) + : QHighDpiScaling::factor(QtAndroid::androidPlatformIntegration()->screen()); + + QInputMethodQueryEvent query(Qt::ImCursorPosition | Qt::ImAnchorPosition | Qt::ImEnabled); + QCoreApplication::sendEvent(m_focusObject, &query); + int cpos = query.value(Qt::ImCursorPosition).toInt(); + int anchor = query.value(Qt::ImAnchorPosition).toInt(); + + if (cpos == anchor || im->anchorRectangle().isNull()) { + if (!query.value(Qt::ImEnabled).toBool()) { + QtAndroidInput::updateHandles(0); + return; + } + + auto curRect = im->cursorRectangle(); + QPoint cursorPoint(curRect.center().x(), curRect.bottom()); + QtAndroidInput::updateHandles(m_cursorHandleShown, cursorPoint * pixelDensity); + return; + } + + auto leftRect = im->cursorRectangle(); + auto rightRect = im->anchorRectangle(); + if (cpos > anchor) + std::swap(leftRect, rightRect); + + QPoint leftPoint(leftRect.bottomLeft().toPoint() * pixelDensity); + QPoint righPoint(rightRect.bottomRight().toPoint() * pixelDensity); + QtAndroidInput::updateHandles(CursorHandleShowSelection, leftPoint, righPoint); +} + +/* + Called from Java when a cursor/selection handle was dragged to a new position + + handleId of 1 means the cursor handle, 2 means the left handle, 3 means the right handle + */ +void QAndroidInputContext::handleLocationChanged(int handleId, int x, int y) +{ + auto im = qGuiApp->inputMethod(); + auto leftRect = im->cursorRectangle(); + // The handle is down of the cursor, but we want the position in the middle. + QWindow *window = qGuiApp->focusWindow(); + double pixelDensity = window + ? QHighDpiScaling::factor(window) + : QHighDpiScaling::factor(QtAndroid::androidPlatformIntegration()->screen()); + QPoint point(x / pixelDensity, y / pixelDensity); + y -= leftRect.width() / 2; + if (handleId == 1) { + setSelectionOnFocusObject(point, point); + return; + } + + QInputMethodQueryEvent query(Qt::ImCursorPosition | Qt::ImAnchorPosition); + QCoreApplication::sendEvent(m_focusObject, &query); + int cpos = query.value(Qt::ImCursorPosition).toInt(); + int anchor = query.value(Qt::ImAnchorPosition).toInt(); + + auto rightRect = im->anchorRectangle(); + if (cpos > anchor) + std::swap(leftRect, rightRect); + + if (handleId == 2) { + QPoint rightPoint(rightRect.center().toPoint()); + setSelectionOnFocusObject(point, rightPoint); + } else if (handleId == 3) { + QPoint leftPoint(leftRect.center().toPoint()); + setSelectionOnFocusObject(leftPoint, point); + } +} + +void QAndroidInputContext::touchDown(int x, int y) +{ + if (m_focusObject && inputItemRectangle().contains(x, y) && !m_cursorHandleShown) { + // If the user touch the input rectangle, we can show the cursor handle + m_cursorHandleShown = QAndroidInputContext::CursorHandleShowNormal; + updateSelectionHandles(); + } +} + +void QAndroidInputContext::keyDown() +{ + if (m_cursorHandleShown) { + // When the user enter text on the keyboard, we hide the cursor handle + m_cursorHandleShown = QAndroidInputContext::CursorHandleNotShown; + updateSelectionHandles(); + } +} + void QAndroidInputContext::update(Qt::InputMethodQueries queries) { QSharedPointer query = focusObjectInputMethodQueryThreadSafe(queries); @@ -543,22 +664,11 @@ void QAndroidInputContext::showInputPanel() m_updateCursorPosConnection = connect(qGuiApp->focusObject(), SIGNAL(cursorPositionChanged(int,int)), this, SLOT(updateCursorPosition())); else m_updateCursorPosConnection = connect(qGuiApp->focusObject(), SIGNAL(cursorPositionChanged()), this, SLOT(updateCursorPosition())); - QRectF itemRect = qGuiApp->inputMethod()->inputItemRectangle(); - QRect rect = qGuiApp->inputMethod()->inputItemTransform().mapRect(itemRect).toRect(); - QWindow *window = qGuiApp->focusWindow(); - if (window) - rect = QRect(window->mapToGlobal(rect.topLeft()), rect.size()); - double pixelDensity = window ? QHighDpiScaling::factor(window) - : QHighDpiScaling::factor(QtAndroid::androidPlatformIntegration()->screen()); - - QtAndroidInput::showSoftwareKeyboard(rect.left() * pixelDensity, - rect.top() * pixelDensity, - rect.width() * pixelDensity, - rect.height() * pixelDensity, + QRect rect = inputItemRectangle(); + QtAndroidInput::showSoftwareKeyboard(rect.left(), rect.top(), rect.width(), rect.height(), query->value(Qt::ImHints).toUInt(), - query->value(Qt::ImEnterKeyType).toUInt() - ); + query->value(Qt::ImEnterKeyType).toUInt()); } void QAndroidInputContext::showInputPanelLater(Qt::ApplicationState state) @@ -601,6 +711,7 @@ void QAndroidInputContext::setFocusObject(QObject *object) reset(); } QPlatformInputContext::setFocusObject(object); + updateSelectionHandles(); } jboolean QAndroidInputContext::beginBatchEdit() @@ -858,6 +969,8 @@ jboolean QAndroidInputContext::setComposingText(const QString &text, jint newCur QInputMethodEvent event(m_composingText, attributes); sendInputMethodEventThreadSafe(&event); + QMetaObject::invokeMethod(this, "keyDown"); + updateCursorPosition(); return JNI_TRUE; @@ -979,20 +1092,21 @@ jboolean QAndroidInputContext::setSelection(jint start, jint end) jboolean QAndroidInputContext::selectAll() { -#warning TODO - return JNI_FALSE; + sendShortcut(QKeySequence::SelectAll); + return JNI_TRUE; } jboolean QAndroidInputContext::cut() { -#warning TODO - return JNI_FALSE; + m_cursorHandleShown = CursorHandleNotShown; + sendShortcut(QKeySequence::Cut); + return JNI_TRUE; } jboolean QAndroidInputContext::copy() { -#warning TODO - return JNI_FALSE; + sendShortcut(QKeySequence::Copy); + return JNI_TRUE; } jboolean QAndroidInputContext::copyURL() @@ -1003,10 +1117,21 @@ jboolean QAndroidInputContext::copyURL() jboolean QAndroidInputContext::paste() { -#warning TODO - return JNI_FALSE; + m_cursorHandleShown = CursorHandleNotShown; + sendShortcut(QKeySequence::Paste); + return JNI_TRUE; } +void QAndroidInputContext::sendShortcut(const QKeySequence &sequence) +{ + for (int i = 0; i < sequence.count(); ++i) { + const int keys = sequence[i]; + Qt::Key key = Qt::Key(keys & ~Qt::KeyboardModifierMask); + Qt::KeyboardModifiers mod = Qt::KeyboardModifiers(keys & Qt::KeyboardModifierMask); + QGuiApplication::postEvent(m_focusObject, new QKeyEvent(QEvent::KeyPress, key, mod)); + QGuiApplication::postEvent(m_focusObject, new QKeyEvent(QEvent::KeyRelease, key, mod)); + } +} Q_INVOKABLE QVariant QAndroidInputContext::queryFocusObjectUnsafe(Qt::InputMethodQuery query, QVariant argument) { diff --git a/src/plugins/platforms/android/qandroidinputcontext.h b/src/plugins/platforms/android/qandroidinputcontext.h index 5ab85dcab0..c7b2b907b7 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.h +++ b/src/plugins/platforms/android/qandroidinputcontext.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 BogDan Vatra +** Copyright (C) 2016 Olivier Goffart ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. @@ -94,6 +95,7 @@ public: bool isComposing() const; void clear(); void setFocusObject(QObject *object); + void sendShortcut(const QKeySequence &); //---------------// jboolean beginBatchEdit(); @@ -117,6 +119,10 @@ public: public slots: void updateCursorPosition(); + void updateSelectionHandles(); + void handleLocationChanged(int handleId, int x, int y); + void touchDown(int x, int y); + void keyDown(); private slots: void showInputPanelLater(Qt::ApplicationState); @@ -138,6 +144,12 @@ private: int m_composingCursor; QMetaObject::Connection m_updateCursorPosConnection; bool m_blockUpdateSelection; + enum CursorHandleShowMode { + CursorHandleNotShown, + CursorHandleShowNormal = 1, + CursorHandleShowSelection = 2 + }; + CursorHandleShowMode m_cursorHandleShown; int m_batchEditNestingLevel; QObject *m_focusObject; }; -- cgit v1.2.3 From 6903cad03edc7db2ed808f5a90f0e02bfca5fe7d Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 15 Jul 2016 16:29:37 +0200 Subject: Make the ICO image format a configurable feature ... including a [-no]-ico command line option. Change-Id: I3cb13d2be72b512f72f8dcdb9de72e7a99e36e47 Reviewed-by: Lars Knoll Reviewed-by: Oswald Buddenhagen --- src/plugins/imageformats/imageformats.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/imageformats/imageformats.pro b/src/plugins/imageformats/imageformats.pro index 3de77c056d..f3ed37b722 100644 --- a/src/plugins/imageformats/imageformats.pro +++ b/src/plugins/imageformats/imageformats.pro @@ -1,5 +1,5 @@ TEMPLATE = subdirs -!contains(QT_CONFIG, no-ico):SUBDIRS += ico +contains(QT_CONFIG, ico): SUBDIRS += ico contains(QT_CONFIG, jpeg): SUBDIRS += jpeg contains(QT_CONFIG, gif): SUBDIRS += gif -- cgit v1.2.3 From d5dc46d319bb1f58f8a0ba64d2ef270eecbe8e65 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Sat, 13 Aug 2016 21:38:19 +0200 Subject: employ QMAKE_USE: LIBS += $$QMAKE_LIBS_FOO this migrates the cases where the build system already made (some) use of variables (possibly) set by configure. Change-Id: I43a08caed481d5f887a3a40821e71a4797760e7e Reviewed-by: Lars Knoll --- src/plugins/platforminputcontexts/compose/compose.pro | 3 +-- src/plugins/platforms/directfb/directfb.pro | 3 +-- .../xcb/gl_integrations/gl_integrations_plugin_base.pri | 9 +++------ src/plugins/platforms/xcb/xcb_qpa_lib.pro | 15 +++++---------- src/plugins/platformthemes/gtk3/gtk3.pro | 3 +-- src/plugins/sqldrivers/mysql/mysql.pro | 14 +------------- src/plugins/sqldrivers/odbc/odbc.pro | 11 ++--------- src/plugins/sqldrivers/psql/psql.pro | 8 +------- src/plugins/sqldrivers/sqlite/sqlite.pro | 5 ++--- src/plugins/sqldrivers/tds/tds.pro | 8 +------- 10 files changed, 18 insertions(+), 61 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforminputcontexts/compose/compose.pro b/src/plugins/platforminputcontexts/compose/compose.pro index 86bdd4729b..df61873902 100644 --- a/src/plugins/platforminputcontexts/compose/compose.pro +++ b/src/plugins/platforminputcontexts/compose/compose.pro @@ -17,8 +17,7 @@ contains(QT_CONFIG, xkbcommon-qt): { QT_CONFIG -= use-xkbcommon-x11support include(../../../3rdparty/xkbcommon.pri) } else { - LIBS += $$QMAKE_LIBS_XKBCOMMON - QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XKBCOMMON + QMAKE_USE += xkbcommon } OTHER_FILES += $$PWD/compose.json diff --git a/src/plugins/platforms/directfb/directfb.pro b/src/plugins/platforms/directfb/directfb.pro index 5c81e0283a..d4977bf40f 100644 --- a/src/plugins/platforms/directfb/directfb.pro +++ b/src/plugins/platforms/directfb/directfb.pro @@ -2,8 +2,7 @@ TARGET = qdirectfb QT += core-private gui-private platformsupport-private -LIBS += $$QMAKE_LIBS_DIRECTFB -QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_DIRECTFB +QMAKE_USE += directfb SOURCES = main.cpp \ qdirectfbintegration.cpp \ diff --git a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri index c2d3849d8e..8fd57da29d 100644 --- a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri +++ b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri @@ -21,18 +21,15 @@ contains(QT_CONFIG, xcb-sm) { DEFINES += XCB_USE_SM } -DEFINES += $$QMAKE_DEFINES_XCB -LIBS += $$QMAKE_LIBS_XCB -QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XCB - CONFIG += qpa/genericunixfontdatabase contains(QT_CONFIG, xcb-qt) { DEFINES += XCB_USE_RENDER XCB_DIR = $$clean_path($$PWD/../../../../3rdparty/xcb) INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/include/xcb $$XCB_DIR/sysinclude - LIBS += -lxcb -L$$MODULE_BASE_OUTDIR/lib -lxcb-static$$qtPlatformTargetSuffix() + LIBS += -L$$MODULE_BASE_OUTDIR/lib -lxcb-static$$qtPlatformTargetSuffix() + QMAKE_USE += xcb } else { - LIBS += -lxcb -lxcb-image -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-shm -lxcb-randr -lxcb-shape -lxcb-keysyms !contains(DEFINES, QT_NO_XKB):LIBS += -lxcb-xkb + QMAKE_USE += xcb_syslibs } diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro index 2013f40dd0..1cf13c7795 100644 --- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro +++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro @@ -72,26 +72,22 @@ contains(QT_CONFIG, xcb-sm) { include(gl_integrations/gl_integrations.pri) -DEFINES += $$QMAKE_DEFINES_XCB -LIBS += $$QMAKE_LIBS_XCB -QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XCB -QMAKE_CFLAGS += $$QMAKE_CFLAGS_XCB - CONFIG += qpa/genericunixfontdatabase contains(QT_CONFIG, dbus-linked) { QT += dbus - LIBS += $$QMAKE_LIBS_DBUS } contains(QT_CONFIG, xcb-qt) { DEFINES += XCB_USE_RENDER XCB_DIR = ../../../3rdparty/xcb INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/sysinclude - LIBS += -lxcb -L$$MODULE_BASE_OUTDIR/lib -lxcb-static$$qtPlatformTargetSuffix() + LIBS += -L$$MODULE_BASE_OUTDIR/lib -lxcb-static$$qtPlatformTargetSuffix() + QMAKE_USE += xcb } else { - LIBS += -lxcb -lxcb-image -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-shm -lxcb-randr -lxcb-shape -lxcb-keysyms -lxcb-xinerama + LIBS += -lxcb-xinerama ### there is no configure test for this! !contains(DEFINES, QT_NO_XKB):LIBS += -lxcb-xkb + QMAKE_USE += xcb_syslibs } # libxkbcommon @@ -99,8 +95,7 @@ contains(QT_CONFIG, xkbcommon-qt) { QT_CONFIG += use-xkbcommon-x11support include(../../../3rdparty/xkbcommon.pri) } else { - LIBS += $$QMAKE_LIBS_XKBCOMMON - QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XKBCOMMON + QMAKE_USE += xkbcommon } load(qt_module) diff --git a/src/plugins/platformthemes/gtk3/gtk3.pro b/src/plugins/platformthemes/gtk3/gtk3.pro index 72a33efeac..12364b0b57 100644 --- a/src/plugins/platformthemes/gtk3/gtk3.pro +++ b/src/plugins/platformthemes/gtk3/gtk3.pro @@ -8,8 +8,7 @@ load(qt_plugin) QT += core-private gui-private platformsupport-private CONFIG += X11 -QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_GTK3 -LIBS += $$QMAKE_LIBS_GTK3 +QMAKE_USE += gtk3 HEADERS += \ qgtk3dialoghelpers.h \ diff --git a/src/plugins/sqldrivers/mysql/mysql.pro b/src/plugins/sqldrivers/mysql/mysql.pro index 3bd8cd0040..56dd5f598c 100644 --- a/src/plugins/sqldrivers/mysql/mysql.pro +++ b/src/plugins/sqldrivers/mysql/mysql.pro @@ -3,19 +3,7 @@ TARGET = qsqlmysql HEADERS += $$PWD/qsql_mysql_p.h SOURCES += $$PWD/qsql_mysql.cpp $$PWD/main.cpp -QMAKE_CXXFLAGS *= $$QMAKE_CFLAGS_MYSQL -LIBS += $$QMAKE_LIBS_MYSQL - -unix { - isEmpty(QMAKE_LIBS_MYSQL) { - !contains(LIBS, .*mysqlclient.*):!contains(LIBS, .*mysqld.*) { - use_libmysqlclient_r:LIBS += -lmysqlclient_r - else:LIBS += -lmysqlclient - } - } -} else { - !contains(LIBS, .*mysql.*):!contains(LIBS, .*mysqld.*):LIBS += -llibmysql -} +QMAKE_USE += mysql OTHER_FILES += mysql.json diff --git a/src/plugins/sqldrivers/odbc/odbc.pro b/src/plugins/sqldrivers/odbc/odbc.pro index 0e49f1ac66..17844f27d2 100644 --- a/src/plugins/sqldrivers/odbc/odbc.pro +++ b/src/plugins/sqldrivers/odbc/odbc.pro @@ -3,15 +3,8 @@ TARGET = qsqlodbc HEADERS += $$PWD/qsql_odbc_p.h SOURCES += $$PWD/qsql_odbc.cpp $$PWD/main.cpp -unix { - DEFINES += UNICODE - !contains(LIBS, .*odbc.*) { - osx:LIBS += -liodbc - else:LIBS += $$QMAKE_LIBS_ODBC - } -} else { - LIBS *= -lodbc32 -} +QMAKE_USE += odbc +unix: DEFINES += UNICODE OTHER_FILES += odbc.json diff --git a/src/plugins/sqldrivers/psql/psql.pro b/src/plugins/sqldrivers/psql/psql.pro index 4a05266120..c44a6319c3 100644 --- a/src/plugins/sqldrivers/psql/psql.pro +++ b/src/plugins/sqldrivers/psql/psql.pro @@ -3,13 +3,7 @@ TARGET = qsqlpsql HEADERS += $$PWD/qsql_psql_p.h SOURCES += $$PWD/qsql_psql.cpp $$PWD/main.cpp -unix|mingw { - LIBS += $$QMAKE_LIBS_PSQL - !contains(LIBS, .*pq.*):LIBS += -lpq - QMAKE_CXXFLAGS *= $$QMAKE_CFLAGS_PSQL -} else { - !contains(LIBS, .*pq.*):LIBS += -llibpq -lws2_32 -ladvapi32 -} +QMAKE_USE += psql OTHER_FILES += psql.json diff --git a/src/plugins/sqldrivers/sqlite/sqlite.pro b/src/plugins/sqldrivers/sqlite/sqlite.pro index c98655f85c..bcdf7d36f3 100644 --- a/src/plugins/sqldrivers/sqlite/sqlite.pro +++ b/src/plugins/sqldrivers/sqlite/sqlite.pro @@ -3,11 +3,10 @@ TARGET = qsqlite HEADERS += $$PWD/qsql_sqlite_p.h SOURCES += $$PWD/qsql_sqlite.cpp $$PWD/smain.cpp -!system-sqlite:!contains(LIBS, .*sqlite3.*) { +!system-sqlite { include($$PWD/../../../3rdparty/sqlite.pri) } else { - LIBS += $$QMAKE_LIBS_SQLITE - QMAKE_CXXFLAGS *= $$QMAKE_CFLAGS_SQLITE + QMAKE_USE += sqlite } OTHER_FILES += sqlite.json diff --git a/src/plugins/sqldrivers/tds/tds.pro b/src/plugins/sqldrivers/tds/tds.pro index b5d32ae5a8..67bc0f5c48 100644 --- a/src/plugins/sqldrivers/tds/tds.pro +++ b/src/plugins/sqldrivers/tds/tds.pro @@ -3,13 +3,7 @@ TARGET = qsqltds HEADERS += $$PWD/qsql_tds_p.h SOURCES += $$PWD/qsql_tds.cpp $$PWD/main.cpp -unix|mingw: { - LIBS += $$QMAKE_LIBS_TDS - !contains(LIBS, .*sybdb.*):LIBS += -lsybdb - QMAKE_CXXFLAGS *= $$QMAKE_CFLAGS_TDS -} else { - LIBS *= -lNTWDBLIB -} +QMAKE_USE += tds OTHER_FILES += tds.json -- cgit v1.2.3 From 4b288e30efda67212b54d7f2e084d0f3acc594ae Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 12 Aug 2016 20:19:33 +0200 Subject: employ QMAKE_USE: LIBS += -lfoo this switches all instances of LIBS[_PRIVATE] += -lfoo where a config tests exists for foo. this removes some code duplication between tests and project files (in case of conditionals), and ensures that the projects always actually use the libraries configure has found. Change-Id: Ia7e80c8db5f329290c7f1a4e03a8bf78882a687e Reviewed-by: Lars Knoll Reviewed-by: Oswald Buddenhagen --- src/plugins/generic/tslib/tslib.pro | 2 +- src/plugins/imageformats/jpeg/jpeg.pro | 5 +---- .../platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro | 8 +------- .../eglfs_kms_egldevice/eglfs_kms_egldevice.pro | 8 +------- .../deviceintegration/eglfs_kms_support/eglfs_kms_support.pro | 8 +------- .../platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro | 2 +- src/plugins/platforms/openwfd/openwf.pro | 3 ++- src/plugins/platforms/qnx/qnx.pro | 6 +++--- .../xcb/gl_integrations/gl_integrations_plugin_base.pri | 2 +- src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro | 5 ++--- src/plugins/platforms/xcb/xcb_qpa_lib.pro | 10 +++++----- src/plugins/printsupport/cups/cups.pro | 2 +- src/plugins/sqldrivers/db2/db2.pro | 6 +----- src/plugins/sqldrivers/ibase/ibase.pro | 9 ++------- src/plugins/sqldrivers/oci/oci.pro | 7 ++----- src/plugins/sqldrivers/sqlite2/sqlite2.pro | 2 +- 16 files changed, 26 insertions(+), 59 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/generic/tslib/tslib.pro b/src/plugins/generic/tslib/tslib.pro index 200d231cc8..d6a0eea3a0 100644 --- a/src/plugins/generic/tslib/tslib.pro +++ b/src/plugins/generic/tslib/tslib.pro @@ -4,7 +4,7 @@ SOURCES = main.cpp QT += gui-private platformsupport-private -LIBS += -lts +QMAKE_USE += tslib OTHER_FILES += tslib.json diff --git a/src/plugins/imageformats/jpeg/jpeg.pro b/src/plugins/imageformats/jpeg/jpeg.pro index 8954cc6402..3cbf60ec8a 100644 --- a/src/plugins/imageformats/jpeg/jpeg.pro +++ b/src/plugins/imageformats/jpeg/jpeg.pro @@ -6,10 +6,7 @@ SOURCES += main.cpp qjpeghandler.cpp HEADERS += main.h qjpeghandler_p.h contains(QT_CONFIG, system-jpeg) { - msvc: \ - LIBS += libjpeg.lib - else: \ - LIBS += -ljpeg + QMAKE_USE += libjpeg } else { include($$PWD/../../../3rdparty/libjpeg.pri) } diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro index 6670a4c0bc..70ff054172 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro @@ -11,13 +11,7 @@ INCLUDEPATH += $$PWD/../.. $$PWD/../eglfs_kms_support # Avoid X11 header collision, use generic EGL native types DEFINES += QT_EGL_NO_X11 -CONFIG += link_pkgconfig -!contains(QT_CONFIG, no-pkg-config) { - PKGCONFIG += libdrm gbm -} else { - LIBS += -ldrm -lgbm -} - +QMAKE_USE += gbm drm CONFIG += egl QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro index f613d68ecb..5f47b98369 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro @@ -7,13 +7,7 @@ INCLUDEPATH += $$PWD/../.. $$PWD/../eglfs_kms_support # Avoid X11 header collision, use generic EGL native types DEFINES += QT_EGL_NO_X11 -CONFIG += link_pkgconfig -!contains(QT_CONFIG, no-pkg-config) { - PKGCONFIG += libdrm -} else { - LIBS += -ldrm -} - +QMAKE_USE += drm CONFIG += egl QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro index cc77810793..464c64539f 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro @@ -9,13 +9,7 @@ INCLUDEPATH += $$PWD/../.. # Avoid X11 header collision, use generic EGL native types DEFINES += QT_EGL_NO_X11 -CONFIG += link_pkgconfig -!contains(QT_CONFIG, no-pkg-config) { - PKGCONFIG += libdrm -} else { - LIBS += -ldrm -} - +QMAKE_USE += drm CONFIG += egl QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro index 17be384955..10af57e487 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro @@ -8,7 +8,7 @@ DEFINES += QT_EGL_NO_X11 INCLUDEPATH += $$PWD/../.. CONFIG += egl -LIBS += -lX11 -lX11-xcb -lxcb +QMAKE_USE += xcb_xlib QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF SOURCES += $$PWD/qeglfsx11main.cpp \ diff --git a/src/plugins/platforms/openwfd/openwf.pro b/src/plugins/platforms/openwfd/openwf.pro index 152e4f57d7..79f349f472 100644 --- a/src/plugins/platforms/openwfd/openwf.pro +++ b/src/plugins/platforms/openwfd/openwf.pro @@ -31,7 +31,8 @@ SOURCES += \ qopenwfdportmode.cpp \ qopenwfdwindow.cpp -LIBS += -lWFD -lgbm -lGLESv2 -lEGL +LIBS += -lWFD +QMAKE_USE += gbm opengl_es2 egl PLUGIN_TYPE = platforms PLUGIN_CLASS_NAME = QOpenWFDIntegrationPlugin diff --git a/src/plugins/platforms/qnx/qnx.pro b/src/plugins/platforms/qnx/qnx.pro index 5a0f4f5c98..51ffa5624f 100644 --- a/src/plugins/platforms/qnx/qnx.pro +++ b/src/plugins/platforms/qnx/qnx.pro @@ -82,7 +82,7 @@ contains(QT_CONFIG, opengles2) { HEADERS += qqnxglcontext.h \ qqnxeglwindow.h - LIBS += -lEGL + QMAKE_USE += egl } CONFIG(qqnx_pps) { @@ -100,7 +100,7 @@ CONFIG(qqnx_pps) { qqnxnavigatoreventnotifier.h \ qqnxvirtualkeyboardpps.h - LIBS += -lpps + QMAKE_USE += pps !contains(DEFINES, QT_NO_CLIPBOARD): LIBS += -lclipboard CONFIG(qqnx_imf) { @@ -116,7 +116,7 @@ CONFIG(qqnx_pps) { lgmon { DEFINES += QQNX_LGMON SOURCES += qqnxlgmon.cpp - LIBS += -llgmon + QMAKE_USE += lgmon } OTHER_FILES += qnx.json diff --git a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri index 8fd57da29d..b60de79fa0 100644 --- a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri +++ b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri @@ -30,6 +30,6 @@ contains(QT_CONFIG, xcb-qt) { LIBS += -L$$MODULE_BASE_OUTDIR/lib -lxcb-static$$qtPlatformTargetSuffix() QMAKE_USE += xcb } else { - !contains(DEFINES, QT_NO_XKB):LIBS += -lxcb-xkb + !contains(DEFINES, QT_NO_XKB): QMAKE_USE += xcb_xkb QMAKE_USE += xcb_syslibs } diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro index 67fd68765a..adac4b2e22 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro @@ -5,12 +5,11 @@ include(../gl_integrations_plugin_base.pri) #should be removed from the sources DEFINES += XCB_USE_GLX XCB_USE_XLIB -LIBS += -lxcb - contains(QT_CONFIG, xcb-glx) { DEFINES += XCB_HAS_XCB_GLX - LIBS += -lxcb-glx + QMAKE_USE += xcb_glx } +QMAKE_USE += xcb LIBS += $$QMAKE_LIBS_DYNLOAD diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro index 1cf13c7795..b81d38fab1 100644 --- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro +++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro @@ -42,12 +42,12 @@ DEFINES += QT_BUILD_XCB_PLUGIN # needed by Xcursor ... contains(QT_CONFIG, xcb-xlib) { DEFINES += XCB_USE_XLIB - LIBS += -lX11 -lX11-xcb + QMAKE_USE += xcb_xlib contains(QT_CONFIG, xinput2) { DEFINES += XCB_USE_XINPUT2 SOURCES += qxcbconnection_xi2.cpp - LIBS += -lXi + QMAKE_USE += xinput2 !isEmpty(QMAKE_XINPUT2_VERSION_MAJOR) { DEFINES += LIBXI_MAJOR=$$QMAKE_XINPUT2_VERSION_MAJOR \ LIBXI_MINOR=$$QMAKE_XINPUT2_VERSION_MINOR \ @@ -59,13 +59,13 @@ contains(QT_CONFIG, xcb-xlib) { # to support custom cursors with depth > 1 contains(QT_CONFIG, xcb-render) { DEFINES += XCB_USE_RENDER - LIBS += -lxcb-render -lxcb-render-util + QMAKE_USE += xcb_render } # build with session management support contains(QT_CONFIG, xcb-sm) { DEFINES += XCB_USE_SM - LIBS += -lSM -lICE + QMAKE_USE += x11sm SOURCES += qxcbsessionmanager.cpp HEADERS += qxcbsessionmanager.h } @@ -86,7 +86,7 @@ contains(QT_CONFIG, xcb-qt) { QMAKE_USE += xcb } else { LIBS += -lxcb-xinerama ### there is no configure test for this! - !contains(DEFINES, QT_NO_XKB):LIBS += -lxcb-xkb + !contains(DEFINES, QT_NO_XKB): QMAKE_USE += xcb_xkb QMAKE_USE += xcb_syslibs } diff --git a/src/plugins/printsupport/cups/cups.pro b/src/plugins/printsupport/cups/cups.pro index 757408e7f7..58bc11606b 100644 --- a/src/plugins/printsupport/cups/cups.pro +++ b/src/plugins/printsupport/cups/cups.pro @@ -3,7 +3,7 @@ MODULE = cupsprintersupport QT += core-private gui-private printsupport printsupport-private -LIBS_PRIVATE += -lcups +QMAKE_USE_PRIVATE += cups INCLUDEPATH += ../../../printsupport/kernel diff --git a/src/plugins/sqldrivers/db2/db2.pro b/src/plugins/sqldrivers/db2/db2.pro index 31822ef8dc..eef65fac66 100644 --- a/src/plugins/sqldrivers/db2/db2.pro +++ b/src/plugins/sqldrivers/db2/db2.pro @@ -3,11 +3,7 @@ TARGET = qsqldb2 HEADERS += $$PWD/qsql_db2_p.h SOURCES += $$PWD/qsql_db2.cpp $$PWD/main.cpp -unix { - !contains(LIBS, .*db2.*):LIBS += -ldb2 -} else { - !contains(LIBS, .*db2.*):LIBS += -ldb2cli -} +QMAKE_USE += db2 OTHER_FILES += db2.json diff --git a/src/plugins/sqldrivers/ibase/ibase.pro b/src/plugins/sqldrivers/ibase/ibase.pro index 8237245183..e5709207d1 100644 --- a/src/plugins/sqldrivers/ibase/ibase.pro +++ b/src/plugins/sqldrivers/ibase/ibase.pro @@ -3,13 +3,8 @@ TARGET = qsqlibase HEADERS += $$PWD/qsql_ibase_p.h SOURCES += $$PWD/qsql_ibase.cpp $$PWD/main.cpp -unix { - !contains(LIBS, .*gds.*):!contains(LIBS, .*libfb.*):LIBS += -lgds -} else { - !contains(LIBS, .*gds.*):!contains(LIBS, .*fbclient.*) { - LIBS += -lgds32_ms - } -} +# FIXME: ignores libfb (unix)/fbclient (win32) - but that's for the test anyway +QMAKE_USE += ibase OTHER_FILES += ibase.json diff --git a/src/plugins/sqldrivers/oci/oci.pro b/src/plugins/sqldrivers/oci/oci.pro index a22d1181bf..e6ef71f20f 100644 --- a/src/plugins/sqldrivers/oci/oci.pro +++ b/src/plugins/sqldrivers/oci/oci.pro @@ -3,11 +3,8 @@ TARGET = qsqloci HEADERS += $$PWD/qsql_oci_p.h SOURCES += $$PWD/qsql_oci.cpp $$PWD/main.cpp -unix { - !contains(LIBS, .*clnts.*):LIBS += -lclntsh -} else { - LIBS *= -loci -} +QMAKE_USE += oci + darwin:QMAKE_LFLAGS += -Wl,-flat_namespace,-U,_environ OTHER_FILES += oci.json diff --git a/src/plugins/sqldrivers/sqlite2/sqlite2.pro b/src/plugins/sqldrivers/sqlite2/sqlite2.pro index d0ab0eef41..721facb5b8 100644 --- a/src/plugins/sqldrivers/sqlite2/sqlite2.pro +++ b/src/plugins/sqldrivers/sqlite2/sqlite2.pro @@ -3,7 +3,7 @@ TARGET = qsqlite2 HEADERS += $$PWD/qsql_sqlite2_p.h SOURCES += $$PWD/qsql_sqlite2.cpp $$PWD/smain.cpp -!contains(LIBS, .*sqlite.*):LIBS += -lsqlite +QMAKE_USE += sqlite2 OTHER_FILES += sqlite2.json -- cgit v1.2.3 From 48b4e0bf6f1cc4ce4831c2212d57f00fe792468f Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 20 Jul 2016 12:44:16 +0200 Subject: Improve library version handling Output the version as a define into the private config header as a define using a hex number. Like that we can easily do version checks on libraries using the QT_LIBRARY_VERSION(lib) and QT_VERSION_CHECK() macros. Change-Id: I6dc4ac6550886ca95c5542b6e75cd933ed079d76 Reviewed-by: Lars Knoll Reviewed-by: Oswald Buddenhagen --- src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 9 ++++++--- src/plugins/platforms/xcb/xcb_qpa_lib.pro | 5 ----- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index 5b7f45fb6c..bda167bce9 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -697,7 +697,7 @@ void QXcbConnection::xi2ProcessTouch(void *xiDevEvent, QXcbWindow *platformWindo if (m_xiGrab) { // XIAllowTouchEvents deadlocks with libXi < 1.7.4 (this has nothing to do with the XI2 versions like 2.2) // http://lists.x.org/archives/xorg-devel/2014-July/043059.html -#ifndef LIBXI_MAJOR +#ifndef XCB_USE_XINPUT2 static bool allowTouchWarningShown = false; if (!allowTouchWarningShown) { allowTouchWarningShown = true; @@ -705,13 +705,16 @@ void QXcbConnection::xi2ProcessTouch(void *xiDevEvent, QXcbWindow *platformWindo " Minimum libXi version required is 1.7.4." " Expect issues with touch behavior."); } -#elif LIBXI_MAJOR == 1 && (LIBXI_MINOR < 7 || (LIBXI_MINOR == 7 && LIBXI_PATCH < 4)) +#elif QT_LIBRARY_VERSION(xinput2) < QT_VERSION_CHECK(1, 7, 4) static bool allowTouchWarningShown = false; if (!allowTouchWarningShown) { allowTouchWarningShown = true; qWarning("Skipping XIAllowTouchEvents() due to not having libXi >= 1.7.4." " libXi version at build time was %d.%d.%d." - " Expect issues with touch behavior.", LIBXI_MAJOR, LIBXI_MINOR, LIBXI_PATCH); + " Expect issues with touch behavior.", + QT_LIBRARY_VERSION_MAJOR(xinput2), + QT_LIBRARY_VERSION_MINOR(xinput2), + QT_LIBRARY_VERSION_PATCH(xinput2)); } #else XIAllowTouchEvents(static_cast(m_xlib_display), xiDeviceEvent->deviceid, diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro index b81d38fab1..d2584ca291 100644 --- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro +++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro @@ -48,11 +48,6 @@ contains(QT_CONFIG, xcb-xlib) { DEFINES += XCB_USE_XINPUT2 SOURCES += qxcbconnection_xi2.cpp QMAKE_USE += xinput2 - !isEmpty(QMAKE_XINPUT2_VERSION_MAJOR) { - DEFINES += LIBXI_MAJOR=$$QMAKE_XINPUT2_VERSION_MAJOR \ - LIBXI_MINOR=$$QMAKE_XINPUT2_VERSION_MINOR \ - LIBXI_PATCH=$$QMAKE_XINPUT2_VERSION_PATCH - } } } -- cgit v1.2.3 From 56ee007b3f44eb3276b244a630f55482c2b02228 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 18 Aug 2016 22:25:08 +0200 Subject: Rework privateFeature privateFeature would add QT_NO_FEATURE to the DEFINES in the private .pri file, which was somewhat inelegant. Additionally, it would add the feature to the _public_ QT_CONFIG variable, which was plain wrong. Replace the implementation with the one just introduced for publicFeature, with the difference that the features are written to the private files instead. As this entirely disposes of the old system, all usages in the project files need to be replaced atomically as well. Change-Id: I506b5d41054410659ea503bc6901736cd5edec6e Reviewed-by: Lars Knoll Reviewed-by: Oswald Buddenhagen --- src/plugins/platforms/bsdfb/qbsdfbintegration.cpp | 4 ++-- src/plugins/platforms/eglfs/qeglfsintegration.cpp | 18 +++++++++--------- src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp | 14 +++++++------- src/plugins/platforms/vnc/qvncintegration.cpp | 2 +- .../gl_integrations/gl_integrations_plugin_base.pri | 2 +- src/plugins/platforms/xcb/qxcbconnection.cpp | 8 ++++---- src/plugins/platforms/xcb/qxcbconnection.h | 3 ++- src/plugins/platforms/xcb/qxcbkeyboard.cpp | 12 ++++++------ src/plugins/platforms/xcb/qxcbkeyboard.h | 6 +++--- src/plugins/platforms/xcb/xcb_qpa_lib.pro | 2 +- 10 files changed, 36 insertions(+), 35 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp b/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp index edb4f4e660..e935d89c9f 100644 --- a/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp +++ b/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp @@ -48,7 +48,7 @@ #include #include -#if !defined(QT_NO_TSLIB) +#if QT_CONFIG(tslib) #include #endif @@ -127,7 +127,7 @@ QPlatformServices *QBsdFbIntegration::services() const void QBsdFbIntegration::createInputHandlers() { -#ifndef QT_NO_TSLIB +#if QT_CONFIG(tslib) const bool useTslib = qEnvironmentVariableIntValue("QT_QPA_FB_TSLIB"); if (useTslib) new QTsLibMouseHandler(QLatin1String("TsLib"), QString()); diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp index 8c8ef99bc2..418ff6119b 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp @@ -70,17 +70,17 @@ #include -#ifndef QT_NO_LIBINPUT +#if QT_CONFIG(libinput) #include #endif -#if !defined(QT_NO_EVDEV) && !defined(Q_OS_ANDROID) +#if QT_CONFIG(evdev) #include #include #include #endif -#if !defined(QT_NO_TSLIB) && !defined(Q_OS_ANDROID) +#if QT_CONFIG(tslib) #include #endif @@ -386,7 +386,7 @@ QPlatformNativeInterface::NativeResourceForContextFunction QEglFSIntegration::na QFunctionPointer QEglFSIntegration::platformFunction(const QByteArray &function) const { -#if !defined(QT_NO_EVDEV) && !defined(Q_OS_ANDROID) +#if QT_CONFIG(evdev) if (function == QEglFSFunctions::loadKeymapTypeIdentifier()) return QFunctionPointer(loadKeymapStatic); #else @@ -398,7 +398,7 @@ QFunctionPointer QEglFSIntegration::platformFunction(const QByteArray &function) void QEglFSIntegration::loadKeymapStatic(const QString &filename) { -#if !defined(QT_NO_EVDEV) && !defined(Q_OS_ANDROID) +#if QT_CONFIG(evdev) QEglFSIntegration *self = static_cast(QGuiApplicationPrivate::platformIntegration()); if (self->m_kbdMgr) self->m_kbdMgr->loadKeymap(filename); @@ -411,22 +411,22 @@ void QEglFSIntegration::loadKeymapStatic(const QString &filename) void QEglFSIntegration::createInputHandlers() { -#ifndef QT_NO_LIBINPUT +#if QT_CONFIG(libinput) if (!qEnvironmentVariableIntValue("QT_QPA_EGLFS_NO_LIBINPUT")) { new QLibInputHandler(QLatin1String("libinput"), QString()); return; } #endif -#if !defined(QT_NO_EVDEV) && !defined(Q_OS_ANDROID) +#if QT_CONFIG(evdev) m_kbdMgr = new QEvdevKeyboardManager(QLatin1String("EvdevKeyboard"), QString() /* spec */, this); new QEvdevMouseManager(QLatin1String("EvdevMouse"), QString() /* spec */, this); -#ifndef QT_NO_TSLIB +#if QT_CONFIG(tslib) const bool useTslib = qEnvironmentVariableIntValue("QT_QPA_EGLFS_TSLIB"); if (useTslib) new QTsLibMouseHandler(QLatin1String("TsLib"), QString() /* spec */); else -#endif // QT_NO_TSLIB +#endif new QEvdevTouchManager(QLatin1String("EvdevTouch"), QString() /* spec */, this); #endif } diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp index 685f231756..707301487d 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp +++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp @@ -52,17 +52,17 @@ #include #include -#ifndef QT_NO_LIBINPUT +#if QT_CONFIG(libinput) #include #endif -#if !defined(QT_NO_EVDEV) && !defined(Q_OS_ANDROID) +#if QT_CONFIG(evdev) && !defined(Q_OS_ANDROID) #include #include #include #endif -#if !defined(QT_NO_TSLIB) && !defined(Q_OS_ANDROID) +#if QT_CONFIG(tslib) && !defined(Q_OS_ANDROID) #include #endif @@ -140,22 +140,22 @@ QPlatformServices *QLinuxFbIntegration::services() const void QLinuxFbIntegration::createInputHandlers() { -#ifndef QT_NO_LIBINPUT +#if QT_CONFIG(libinput) if (!qEnvironmentVariableIntValue("QT_QPA_FB_NO_LIBINPUT")) { new QLibInputHandler(QLatin1String("libinput"), QString()); return; } #endif -#if !defined(QT_NO_EVDEV) && !defined(Q_OS_ANDROID) +#if QT_CONFIG(evdev) && !defined(Q_OS_ANDROID) new QEvdevKeyboardManager(QLatin1String("EvdevKeyboard"), QString(), this); new QEvdevMouseManager(QLatin1String("EvdevMouse"), QString(), this); -#ifndef QT_NO_TSLIB +#if QT_CONFIG(tslib) const bool useTslib = qEnvironmentVariableIntValue("QT_QPA_FB_TSLIB"); if (useTslib) new QTsLibMouseHandler(QLatin1String("TsLib"), QString()); else -#endif // QT_NO_TSLIB +#endif new QEvdevTouchManager(QLatin1String("EvdevTouch"), QString() /* spec */, this); #endif } diff --git a/src/plugins/platforms/vnc/qvncintegration.cpp b/src/plugins/platforms/vnc/qvncintegration.cpp index 810c5d2a90..3227478ebe 100644 --- a/src/plugins/platforms/vnc/qvncintegration.cpp +++ b/src/plugins/platforms/vnc/qvncintegration.cpp @@ -49,7 +49,7 @@ #include #include #include -#ifndef QT_NO_LIBINPUT +#if QT_CONFIG(libinput) #include #endif diff --git a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri index b60de79fa0..8d34e98940 100644 --- a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri +++ b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri @@ -30,6 +30,6 @@ contains(QT_CONFIG, xcb-qt) { LIBS += -L$$MODULE_BASE_OUTDIR/lib -lxcb-static$$qtPlatformTargetSuffix() QMAKE_USE += xcb } else { - !contains(DEFINES, QT_NO_XKB): QMAKE_USE += xcb_xkb + qtConfig(xkb): QMAKE_USE += xcb_xkb QMAKE_USE += xcb_syslibs } diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 7065bb0ffb..2d959688b3 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -599,7 +599,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra xcb_extension_t *extensions[] = { &xcb_shm_id, &xcb_xfixes_id, &xcb_randr_id, &xcb_shape_id, &xcb_sync_id, -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) &xcb_xkb_id, #endif #ifdef XCB_USE_RENDER @@ -1069,7 +1069,7 @@ Qt::MouseButton QXcbConnection::translateMouseButton(xcb_button_t s) } } -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) namespace { typedef union { /* All XKB events share these fields. */ @@ -1252,7 +1252,7 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event) s->handleScreenChange(change_event); } handled = true; -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) } else if (response_type == xkb_first_event) { // https://bugs.freedesktop.org/show_bug.cgi?id=51295 _xkb_event *xkb_event = reinterpret_cast<_xkb_event *>(event); if (xkb_event->any.deviceID == m_keyboard->coreDeviceId()) { @@ -2174,7 +2174,7 @@ void QXcbConnection::initializeXShape() void QXcbConnection::initializeXKB() { -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_connection, &xcb_xkb_id); if (!reply || !reply->present) { qWarning("Qt: XKEYBOARD extension not present on the X server."); diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 1336b3f5d3..59054fae2d 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -53,10 +53,11 @@ #include #include #include +#include // This is needed to make Qt compile together with XKB. xkb.h is using a variable // which is called 'explicit', this is a reserved keyword in c++ -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) #define explicit dont_use_cxx_explicit #include #undef explicit diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index 811ef4251a..07932ceeb8 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -711,7 +711,7 @@ void QXcbKeyboard::updateKeymap() xkb_keymap = 0; struct xkb_state *new_state = 0; -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) if (connection()->hasXKB()) { xkb_keymap = xkb_x11_keymap_new_from_device(xkb_context, xcb_connection(), core_device_id, (xkb_keymap_compile_flags)0); if (xkb_keymap) { @@ -754,7 +754,7 @@ void QXcbKeyboard::updateKeymap() checkForLatinLayout(); } -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) void QXcbKeyboard::updateXKBState(xcb_xkb_state_notify_event_t *state) { if (m_config && connection()->hasXKB()) { @@ -1140,7 +1140,7 @@ QXcbKeyboard::QXcbKeyboard(QXcbConnection *connection) , m_hasLatinLayout(false) { memset(&xkb_names, 0, sizeof(xkb_names)); -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) core_device_id = 0; if (connection->hasXKB()) { updateVModMapping(); @@ -1154,7 +1154,7 @@ QXcbKeyboard::QXcbKeyboard(QXcbConnection *connection) #endif m_key_symbols = xcb_key_symbols_alloc(xcb_connection()); updateModifiers(); -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) } #endif updateKeymap(); @@ -1173,7 +1173,7 @@ QXcbKeyboard::~QXcbKeyboard() void QXcbKeyboard::updateVModMapping() { -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) xcb_xkb_get_names_cookie_t names_cookie; xcb_xkb_get_names_reply_t *name_reply; xcb_xkb_get_names_value_list_t names_list; @@ -1242,7 +1242,7 @@ void QXcbKeyboard::updateVModMapping() void QXcbKeyboard::updateVModToRModMapping() { -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) xcb_xkb_get_map_cookie_t map_cookie; xcb_xkb_get_map_reply_t *map_reply; xcb_xkb_get_map_map_t map; diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.h b/src/plugins/platforms/xcb/qxcbkeyboard.h index 75e6d2ec82..817b57ff5b 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.h +++ b/src/plugins/platforms/xcb/qxcbkeyboard.h @@ -45,7 +45,7 @@ #include #include -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) #include #endif @@ -77,7 +77,7 @@ public: #ifdef XCB_USE_XINPUT22 void updateXKBStateFromXI(void *modInfo, void *groupInfo); #endif -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) // when XKEYBOARD is present on the X server int coreDeviceId() const { return core_device_id; } void updateXKBState(xcb_xkb_state_notify_event_t *state); @@ -136,7 +136,7 @@ private: xkb_mod_index_t mod5; }; _xkb_mods xkb_mods; -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) // when XKEYBOARD is present on the X server _mod_masks vmod_masks; int core_device_id; diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro index d2584ca291..326aa356df 100644 --- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro +++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro @@ -81,7 +81,7 @@ contains(QT_CONFIG, xcb-qt) { QMAKE_USE += xcb } else { LIBS += -lxcb-xinerama ### there is no configure test for this! - !contains(DEFINES, QT_NO_XKB): QMAKE_USE += xcb_xkb + qtConfig(xkb): QMAKE_USE += xcb_xkb QMAKE_USE += xcb_syslibs } -- cgit v1.2.3 From b786993f8da01c9432d2736f565d3c7e8f2ab122 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 16 Aug 2016 08:57:03 +0200 Subject: fix xcb-render nesting xcb-render is emitIf on xcb-syslibs, so it needs to move into the respective branches in the project files. Change-Id: Iaa6db9012287ae0e9c363ca5eeec48daad862320 Reviewed-by: Lars Knoll --- .../xcb/gl_integrations/gl_integrations_plugin_base.pri | 9 ++++----- src/plugins/platforms/xcb/xcb_qpa_lib.pro | 11 +++++------ 2 files changed, 9 insertions(+), 11 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri index 8d34e98940..e97f24e974 100644 --- a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri +++ b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri @@ -11,11 +11,6 @@ contains(QT_CONFIG, xcb-xlib) { } } -# to support custom cursors with depth > 1 -contains(QT_CONFIG, xcb-render) { - DEFINES += XCB_USE_RENDER -} - # build with session management support contains(QT_CONFIG, xcb-sm) { DEFINES += XCB_USE_SM @@ -31,5 +26,9 @@ contains(QT_CONFIG, xcb-qt) { QMAKE_USE += xcb } else { qtConfig(xkb): QMAKE_USE += xcb_xkb + # to support custom cursors with depth > 1 + contains(QT_CONFIG, xcb-render) { + DEFINES += XCB_USE_RENDER + } QMAKE_USE += xcb_syslibs } diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro index 326aa356df..c496fb7452 100644 --- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro +++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro @@ -51,12 +51,6 @@ contains(QT_CONFIG, xcb-xlib) { } } -# to support custom cursors with depth > 1 -contains(QT_CONFIG, xcb-render) { - DEFINES += XCB_USE_RENDER - QMAKE_USE += xcb_render -} - # build with session management support contains(QT_CONFIG, xcb-sm) { DEFINES += XCB_USE_SM @@ -82,6 +76,11 @@ contains(QT_CONFIG, xcb-qt) { } else { LIBS += -lxcb-xinerama ### there is no configure test for this! qtConfig(xkb): QMAKE_USE += xcb_xkb + # to support custom cursors with depth > 1 + contains(QT_CONFIG, xcb-render) { + DEFINES += XCB_USE_RENDER + QMAKE_USE += xcb_render + } QMAKE_USE += xcb_syslibs } -- cgit v1.2.3 From 792a99438707c78ed96a1b066489f9100c24a922 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 16 Aug 2016 10:17:23 +0200 Subject: Clean up xkbcommon.pri Don't set a variable in QT_CONFIG to build the right things. Instead have an xkbcommon-x11.pri in addition to xkbcommon.pri that also builds the x11 specific things. Change-Id: I16a5f0bcb39b7f4039583a676b6c14b0e073a37f Reviewed-by: Lars Knoll Reviewed-by: Oswald Buddenhagen --- src/plugins/platforminputcontexts/compose/compose.pro | 2 -- src/plugins/platforms/xcb/xcb_qpa_lib.pro | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforminputcontexts/compose/compose.pro b/src/plugins/platforminputcontexts/compose/compose.pro index df61873902..43ddf0d00b 100644 --- a/src/plugins/platforminputcontexts/compose/compose.pro +++ b/src/plugins/platforminputcontexts/compose/compose.pro @@ -13,8 +13,6 @@ HEADERS += $$PWD/qcomposeplatforminputcontext.h \ # libxkbcommon contains(QT_CONFIG, xkbcommon-qt): { - # dont't need x11 dependency for compose key plugin - QT_CONFIG -= use-xkbcommon-x11support include(../../../3rdparty/xkbcommon.pri) } else { QMAKE_USE += xkbcommon diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro index c496fb7452..f995249c0d 100644 --- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro +++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro @@ -86,8 +86,7 @@ contains(QT_CONFIG, xcb-qt) { # libxkbcommon contains(QT_CONFIG, xkbcommon-qt) { - QT_CONFIG += use-xkbcommon-x11support - include(../../../3rdparty/xkbcommon.pri) + include(../../../3rdparty/xkbcommon-x11.pri) } else { QMAKE_USE += xkbcommon } -- cgit v1.2.3 From 60985aa42b37217fb4c01ed85bbf6f14410c3491 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 5 Aug 2016 13:35:39 +0200 Subject: Use qtConfig throughout in qtbase Use the new qtConfig macro in all pro/pri files. This required adding some feature entries, and adding {private,public}Feature to every referenced already existing entry. Change-Id: I164214dad1154df6ad84e86d99ed14994ef97cf4 Reviewed-by: Lars Knoll Reviewed-by: Oswald Buddenhagen --- src/plugins/bearer/bearer.pro | 2 +- src/plugins/bearer/corewlan/corewlan.pro | 2 +- src/plugins/generic/generic.pro | 6 +++--- src/plugins/imageformats/imageformats.pro | 6 +++--- src/plugins/imageformats/jpeg/jpeg.pro | 2 +- .../platforminputcontexts/compose/compose.pro | 2 +- .../platforminputcontexts/platforminputcontexts.pro | 2 +- src/plugins/platforms/cocoa/cocoa.pro | 2 +- src/plugins/platforms/directfb/directfb.pro | 2 +- .../eglfs/deviceintegration/deviceintegration.pro | 14 +++++++------- src/plugins/platforms/offscreen/offscreen.pro | 2 +- src/plugins/platforms/platforms.pro | 16 ++++++++-------- src/plugins/platforms/qnx/qnx.pro | 2 +- src/plugins/platforms/windows/windows.pri | 20 ++++++++++---------- .../xcb/gl_integrations/gl_integrations.pro | 4 ++-- .../gl_integrations/gl_integrations_plugin_base.pri | 10 +++++----- .../xcb/gl_integrations/xcb_egl/xcb_egl.pro | 2 +- .../xcb/gl_integrations/xcb_glx/xcb_glx.pro | 2 +- src/plugins/platforms/xcb/xcb.pro | 2 +- src/plugins/platforms/xcb/xcb_qpa_lib.pro | 15 +++++++-------- src/plugins/platformthemes/platformthemes.pro | 2 +- src/plugins/printsupport/printsupport.pro | 6 ++---- 22 files changed, 60 insertions(+), 63 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro index 8028e65147..8078a5708c 100644 --- a/src/plugins/bearer/bearer.pro +++ b/src/plugins/bearer/bearer.pro @@ -8,7 +8,7 @@ TEMPLATE = subdirs #win32:SUBDIRS += nla win32:SUBDIRS += generic win32:!winrt: SUBDIRS += nativewifi -mac:contains(QT_CONFIG, corewlan):SUBDIRS += corewlan +darwin:qtConfig(corewlan): SUBDIRS += corewlan mac:SUBDIRS += generic android:SUBDIRS += android diff --git a/src/plugins/bearer/corewlan/corewlan.pro b/src/plugins/bearer/corewlan/corewlan.pro index ab0257aecd..1dc09ebdd6 100644 --- a/src/plugins/bearer/corewlan/corewlan.pro +++ b/src/plugins/bearer/corewlan/corewlan.pro @@ -3,7 +3,7 @@ TARGET = qcorewlanbearer QT = core-private network-private LIBS += -framework Foundation -framework SystemConfiguration -contains(QT_CONFIG, corewlan) { +qtConfig(corewlan) { LIBS += -framework CoreWLAN -framework Security } diff --git a/src/plugins/generic/generic.pro b/src/plugins/generic/generic.pro index 182a60fdb5..c0a81d4dc8 100644 --- a/src/plugins/generic/generic.pro +++ b/src/plugins/generic/generic.pro @@ -2,11 +2,11 @@ TEMPLATE = subdirs load(qfeatures) -contains(QT_CONFIG, evdev) { +qtConfig(evdev) { SUBDIRS += evdevmouse evdevtouch evdevkeyboard evdevtablet } -contains(QT_CONFIG, tslib) { +qtConfig(tslib) { SUBDIRS += tslib } @@ -14,7 +14,7 @@ contains(QT_CONFIG, tslib) { SUBDIRS += tuiotouch } -contains(QT_CONFIG, libinput) { +qtConfig(libinput) { SUBDIRS += libinput } diff --git a/src/plugins/imageformats/imageformats.pro b/src/plugins/imageformats/imageformats.pro index f3ed37b722..d2588c1b18 100644 --- a/src/plugins/imageformats/imageformats.pro +++ b/src/plugins/imageformats/imageformats.pro @@ -1,5 +1,5 @@ TEMPLATE = subdirs -contains(QT_CONFIG, ico): SUBDIRS += ico -contains(QT_CONFIG, jpeg): SUBDIRS += jpeg -contains(QT_CONFIG, gif): SUBDIRS += gif +qtConfig(ico): SUBDIRS += ico +qtConfig(jpeg): SUBDIRS += jpeg +qtConfig(gif): SUBDIRS += gif diff --git a/src/plugins/imageformats/jpeg/jpeg.pro b/src/plugins/imageformats/jpeg/jpeg.pro index 3cbf60ec8a..89476e62f5 100644 --- a/src/plugins/imageformats/jpeg/jpeg.pro +++ b/src/plugins/imageformats/jpeg/jpeg.pro @@ -5,7 +5,7 @@ QT += core-private gui-private SOURCES += main.cpp qjpeghandler.cpp HEADERS += main.h qjpeghandler_p.h -contains(QT_CONFIG, system-jpeg) { +qtConfig(system-jpeg) { QMAKE_USE += libjpeg } else { include($$PWD/../../../3rdparty/libjpeg.pri) diff --git a/src/plugins/platforminputcontexts/compose/compose.pro b/src/plugins/platforminputcontexts/compose/compose.pro index 43ddf0d00b..17284874f6 100644 --- a/src/plugins/platforminputcontexts/compose/compose.pro +++ b/src/plugins/platforminputcontexts/compose/compose.pro @@ -12,7 +12,7 @@ HEADERS += $$PWD/qcomposeplatforminputcontext.h \ $$PWD/generator/qtablegenerator.h \ # libxkbcommon -contains(QT_CONFIG, xkbcommon-qt): { +!qtConfig(xkbcommon-system) { include(../../../3rdparty/xkbcommon.pri) } else { QMAKE_USE += xkbcommon diff --git a/src/plugins/platforminputcontexts/platforminputcontexts.pro b/src/plugins/platforminputcontexts/platforminputcontexts.pro index faea54b874..f22b8b69db 100644 --- a/src/plugins/platforminputcontexts/platforminputcontexts.pro +++ b/src/plugins/platforminputcontexts/platforminputcontexts.pro @@ -4,6 +4,6 @@ qtHaveModule(dbus) { !mac:!win32:SUBDIRS += ibus } -contains(QT_CONFIG, xcb-plugin): SUBDIRS += compose +qtConfig(xcb): SUBDIRS += compose diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro index 02d8b16110..d9d3cb1627 100644 --- a/src/plugins/platforms/cocoa/cocoa.pro +++ b/src/plugins/platforms/cocoa/cocoa.pro @@ -71,7 +71,7 @@ HEADERS += qcocoaintegration.h \ messages.h \ qcocoamimetypes.h -contains(QT_CONFIG, opengl.*) { +qtConfig(opengl.*) { OBJECTIVE_SOURCES += qcocoaglcontext.mm HEADERS += qcocoaglcontext.h diff --git a/src/plugins/platforms/directfb/directfb.pro b/src/plugins/platforms/directfb/directfb.pro index d4977bf40f..de0344ff5c 100644 --- a/src/plugins/platforms/directfb/directfb.pro +++ b/src/plugins/platforms/directfb/directfb.pro @@ -24,7 +24,7 @@ HEADERS = qdirectfbintegration.h \ qdirectfbeglhooks.h # ### port the GL context -contains(QT_CONFIG, directfb_egl) { +qtConfig(directfb_egl) { HEADERS += qdirectfb_egl.h SOURCES += qdirectfb_egl.cpp DEFINES += DIRECTFB_GL_EGL diff --git a/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro b/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro index 769c248d0d..b46b04d149 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro @@ -1,12 +1,12 @@ TEMPLATE = subdirs -contains(QT_CONFIG, egl_x11): SUBDIRS += eglfs_x11 -contains(QT_CONFIG, eglfs_gbm): SUBDIRS += eglfs_kms_support eglfs_kms -contains(QT_CONFIG, eglfs_egldevice): SUBDIRS += eglfs_kms_support eglfs_kms_egldevice -contains(QT_CONFIG, eglfs_brcm): SUBDIRS += eglfs_brcm -contains(QT_CONFIG, eglfs_mali): SUBDIRS += eglfs_mali -contains(QT_CONFIG, eglfs_viv): SUBDIRS += eglfs_viv -contains(QT_CONFIG, eglfs_viv_wl): SUBDIRS += eglfs_viv_wl +qtConfig(egl_x11): SUBDIRS += eglfs_x11 +qtConfig(eglfs_gbm): SUBDIRS += eglfs_kms_support eglfs_kms +qtConfig(eglfs_egldevice): SUBDIRS += eglfs_kms_support eglfs_kms_egldevice +qtConfig(eglfs_brcm): SUBDIRS += eglfs_brcm +qtConfig(eglfs_mali): SUBDIRS += eglfs_mali +qtConfig(eglfs_viv): SUBDIRS += eglfs_viv +qtConfig(eglfs_viv_wl): SUBDIRS += eglfs_viv_wl eglfs_kms_egldevice.depends = eglfs_kms_support eglfs_kms.depends = eglfs_kms_support diff --git a/src/plugins/platforms/offscreen/offscreen.pro b/src/plugins/platforms/offscreen/offscreen.pro index 999550a7e1..cc65449b04 100644 --- a/src/plugins/platforms/offscreen/offscreen.pro +++ b/src/plugins/platforms/offscreen/offscreen.pro @@ -13,7 +13,7 @@ HEADERS = qoffscreenintegration.h \ OTHER_FILES += offscreen.json -contains(QT_CONFIG, xlib):contains(QT_CONFIG, opengl):!contains(QT_CONFIG, opengles2) { +qtConfig(xlib):qtConfig(opengl):!qtConfig(opengles2) { SOURCES += qoffscreenintegration_x11.cpp HEADERS += qoffscreenintegration_x11.h system(echo "Using X11 offscreen integration with GLX") diff --git a/src/plugins/platforms/platforms.pro b/src/plugins/platforms/platforms.pro index 4bed5312ec..8324520725 100644 --- a/src/plugins/platforms/platforms.pro +++ b/src/plugins/platforms/platforms.pro @@ -4,9 +4,9 @@ android: SUBDIRS += android !android: SUBDIRS += minimal -!android:if(!win32|contains(QT_CONFIG, freetype)): SUBDIRS += offscreen +!android:if(!win32|qtConfig(freetype)): SUBDIRS += offscreen -contains(QT_CONFIG, xcb) { +qtConfig(xcb) { SUBDIRS += xcb } @@ -16,7 +16,7 @@ osx: SUBDIRS += cocoa win32:!winrt: SUBDIRS += windows winrt: SUBDIRS += winrt -contains(QT_CONFIG, direct2d) { +qtConfig(direct2d) { SUBDIRS += direct2d } @@ -24,16 +24,16 @@ qnx { SUBDIRS += qnx } -contains(QT_CONFIG, eglfs) { +qtConfig(eglfs) { SUBDIRS += eglfs SUBDIRS += minimalegl } -contains(QT_CONFIG, directfb) { +qtConfig(directfb) { SUBDIRS += directfb } -contains(QT_CONFIG, linuxfb): SUBDIRS += linuxfb +qtConfig(linuxfb): SUBDIRS += linuxfb unix:!android:!darwin: SUBDIRS += vnc @@ -45,6 +45,6 @@ haiku { SUBDIRS += haiku } -contains(QT_CONFIG, mirclient): SUBDIRS += mirclient +qtConfig(mirclient): SUBDIRS += mirclient -contains(QT_CONFIG, integrityfb): SUBDIRS += integrity +qtConfig(integrityfb): SUBDIRS += integrity diff --git a/src/plugins/platforms/qnx/qnx.pro b/src/plugins/platforms/qnx/qnx.pro index 51ffa5624f..e47731476f 100644 --- a/src/plugins/platforms/qnx/qnx.pro +++ b/src/plugins/platforms/qnx/qnx.pro @@ -75,7 +75,7 @@ CONFIG(qqnx_screeneventthread) { LIBS += -lscreen -contains(QT_CONFIG, opengles2) { +qtConfig(opengles2) { SOURCES += qqnxglcontext.cpp \ qqnxeglwindow.cpp diff --git a/src/plugins/platforms/windows/windows.pri b/src/plugins/platforms/windows/windows.pri index 1cadcd1954..28d7d04db4 100644 --- a/src/plugins/platforms/windows/windows.pri +++ b/src/plugins/platforms/windows/windows.pri @@ -1,7 +1,7 @@ # Note: OpenGL32 must precede Gdi32 as it overwrites some functions. LIBS += -lole32 -luser32 -lwinspool -limm32 -lwinmm -loleaut32 -contains(QT_CONFIG, opengl):!contains(QT_CONFIG, opengles2):!contains(QT_CONFIG, dynamicgl): LIBS *= -lopengl32 +qtConfig(opengl):!qtConfig(opengles2):!qtConfig(dynamicgl): LIBS *= -lopengl32 mingw: LIBS *= -luuid # For the dialog helpers: @@ -9,8 +9,8 @@ LIBS += -lshlwapi -lshell32 -ladvapi32 DEFINES *= QT_NO_CAST_FROM_ASCII -contains(QT_CONFIG, directwrite) { - contains(QT_CONFIG, directwrite2): \ +qtConfig(directwrite) { + qtConfig(directwrite2): \ DEFINES *= QT_USE_DIRECTWRITE2 SOURCES += $$PWD/qwindowsfontenginedirectwrite.cpp @@ -65,18 +65,18 @@ HEADERS += \ INCLUDEPATH += $$PWD -contains(QT_CONFIG,opengl): HEADERS += $$PWD/qwindowsopenglcontext.h +qtConfig(opengl): HEADERS += $$PWD/qwindowsopenglcontext.h -contains(QT_CONFIG, opengles2) { +qtConfig(opengles2) { SOURCES += $$PWD/qwindowseglcontext.cpp HEADERS += $$PWD/qwindowseglcontext.h -} else: contains(QT_CONFIG,opengl) { +} else: qtConfig(opengl) { SOURCES += $$PWD/qwindowsglcontext.cpp HEADERS += $$PWD/qwindowsglcontext.h } # Dynamic GL needs both WGL and EGL -contains(QT_CONFIG,dynamicgl) { +qtConfig(dynamicgl) { SOURCES += $$PWD/qwindowseglcontext.cpp HEADERS += $$PWD/qwindowseglcontext.h } @@ -111,10 +111,10 @@ contains(QT_CONFIG,dynamicgl) { RESOURCES += $$PWD/openglblacklists.qrc -contains(QT_CONFIG, freetype) { +qtConfig(freetype) { HEADERS += $$PWD/qwindowsfontdatabase_ft.h SOURCES += $$PWD/qwindowsfontdatabase_ft.cpp - contains(QT_CONFIG, system-freetype) { + qtConfig(system-freetype) { include($$QT_SOURCE_TREE/src/platformsupport/fontdatabases/basic/basic.pri) } else { DEFINES *= QT_NO_FONTCONFIG @@ -122,7 +122,7 @@ contains(QT_CONFIG, freetype) { } } -contains(QT_CONFIG, accessibility):include($$PWD/accessible/accessible.pri) +qtConfig(accessibility): include($$PWD/accessible/accessible.pri) DEFINES *= LIBEGL_NAME=$${LIBEGL_NAME} DEFINES *= LIBGLESV2_NAME=$${LIBGLESV2_NAME} diff --git a/src/plugins/platforms/xcb/gl_integrations/gl_integrations.pro b/src/plugins/platforms/xcb/gl_integrations/gl_integrations.pro index 9de0476810..0cdee03f62 100644 --- a/src/plugins/platforms/xcb/gl_integrations/gl_integrations.pro +++ b/src/plugins/platforms/xcb/gl_integrations/gl_integrations.pro @@ -1,9 +1,9 @@ TEMPLATE = subdirs -contains(QT_CONFIG, egl): contains(QT_CONFIG, egl_x11): contains(QT_CONFIG, opengl) { +qtConfig(egl):qtConfig(egl_x11):qtConfig(opengl) { SUBDIRS += xcb_egl } -contains(QT_CONFIG, xcb-xlib): contains(QT_CONFIG, opengl): !contains(QT_CONFIG, opengles2) { +qtConfig(xcb-xlib):qtConfig(opengl):!qtConfig(opengles2) { SUBDIRS += xcb_glx } diff --git a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri index e97f24e974..57c8f27d9c 100644 --- a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri +++ b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri @@ -4,21 +4,21 @@ INCLUDEPATH += $$PWD INCLUDEPATH += $$PWD/../ # needed by Xcursor ... -contains(QT_CONFIG, xcb-xlib) { +qtConfig(xcb-xlib) { DEFINES += XCB_USE_XLIB - contains(QT_CONFIG, xinput2) { + qtConfig(xinput2) { DEFINES += XCB_USE_XINPUT2 } } # build with session management support -contains(QT_CONFIG, xcb-sm) { +qtConfig(xcb-sm) { DEFINES += XCB_USE_SM } CONFIG += qpa/genericunixfontdatabase -contains(QT_CONFIG, xcb-qt) { +!qtConfig(system-xcb) { DEFINES += XCB_USE_RENDER XCB_DIR = $$clean_path($$PWD/../../../../3rdparty/xcb) INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/include/xcb $$XCB_DIR/sysinclude @@ -27,7 +27,7 @@ contains(QT_CONFIG, xcb-qt) { } else { qtConfig(xkb): QMAKE_USE += xcb_xkb # to support custom cursors with depth > 1 - contains(QT_CONFIG, xcb-render) { + qtConfig(xcb-render) { DEFINES += XCB_USE_RENDER } QMAKE_USE += xcb_syslibs diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro index 6d52332bad..92e6c18fbe 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro @@ -4,7 +4,7 @@ include(../gl_integrations_plugin_base.pri) CONFIG += egl -contains(QT_CONFIG, xcb-xlib): DEFINES += XCB_USE_XLIB +qtConfig(xcb-xlib): DEFINES += XCB_USE_XLIB HEADERS += \ qxcbeglcontext.h \ diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro index adac4b2e22..88c4144fd9 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro @@ -5,7 +5,7 @@ include(../gl_integrations_plugin_base.pri) #should be removed from the sources DEFINES += XCB_USE_GLX XCB_USE_XLIB -contains(QT_CONFIG, xcb-glx) { +qtConfig(xcb-glx) { DEFINES += XCB_HAS_XCB_GLX QMAKE_USE += xcb_glx } diff --git a/src/plugins/platforms/xcb/xcb.pro b/src/plugins/platforms/xcb/xcb.pro index 5915a59c0b..7840a4583f 100644 --- a/src/plugins/platforms/xcb/xcb.pro +++ b/src/plugins/platforms/xcb/xcb.pro @@ -1,7 +1,7 @@ TEMPLATE = subdirs CONFIG += ordered -contains(QT_CONFIG, xcb-qt):SUBDIRS+=xcb-static +!qtConfig(system-xcb): SUBDIRS += xcb-static SUBDIRS += xcb_qpa_lib.pro SUBDIRS += xcb-plugin.pro diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro index f995249c0d..0d5f0ca001 100644 --- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro +++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro @@ -40,11 +40,11 @@ HEADERS = \ DEFINES += QT_BUILD_XCB_PLUGIN # needed by Xcursor ... -contains(QT_CONFIG, xcb-xlib) { +qtConfig(xcb-xlib) { DEFINES += XCB_USE_XLIB QMAKE_USE += xcb_xlib - contains(QT_CONFIG, xinput2) { + qtConfig(xinput2) { DEFINES += XCB_USE_XINPUT2 SOURCES += qxcbconnection_xi2.cpp QMAKE_USE += xinput2 @@ -52,7 +52,7 @@ contains(QT_CONFIG, xcb-xlib) { } # build with session management support -contains(QT_CONFIG, xcb-sm) { +qtConfig(xcb-sm) { DEFINES += XCB_USE_SM QMAKE_USE += x11sm SOURCES += qxcbsessionmanager.cpp @@ -63,11 +63,10 @@ include(gl_integrations/gl_integrations.pri) CONFIG += qpa/genericunixfontdatabase -contains(QT_CONFIG, dbus-linked) { +qtConfig(dbus-linked): \ QT += dbus -} -contains(QT_CONFIG, xcb-qt) { +!qtConfig(system-xcb) { DEFINES += XCB_USE_RENDER XCB_DIR = ../../../3rdparty/xcb INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/sysinclude @@ -77,7 +76,7 @@ contains(QT_CONFIG, xcb-qt) { LIBS += -lxcb-xinerama ### there is no configure test for this! qtConfig(xkb): QMAKE_USE += xcb_xkb # to support custom cursors with depth > 1 - contains(QT_CONFIG, xcb-render) { + qtConfig(xcb-render) { DEFINES += XCB_USE_RENDER QMAKE_USE += xcb_render } @@ -85,7 +84,7 @@ contains(QT_CONFIG, xcb-qt) { } # libxkbcommon -contains(QT_CONFIG, xkbcommon-qt) { +!qtConfig(xkbcommon-system) { include(../../../3rdparty/xkbcommon-x11.pri) } else { QMAKE_USE += xkbcommon diff --git a/src/plugins/platformthemes/platformthemes.pro b/src/plugins/platformthemes/platformthemes.pro index f5f54068a2..166b39ce8c 100644 --- a/src/plugins/platformthemes/platformthemes.pro +++ b/src/plugins/platformthemes/platformthemes.pro @@ -1,3 +1,3 @@ TEMPLATE = subdirs -contains(QT_CONFIG, gtk3): SUBDIRS += gtk3 +qtConfig(gtk3): SUBDIRS += gtk3 diff --git a/src/plugins/printsupport/printsupport.pro b/src/plugins/printsupport/printsupport.pro index bd6681f53c..55feaba40c 100644 --- a/src/plugins/printsupport/printsupport.pro +++ b/src/plugins/printsupport/printsupport.pro @@ -1,8 +1,6 @@ +QT += printsupport TEMPLATE = subdirs osx: SUBDIRS += cocoa win32: SUBDIRS += windows -unix:!mac:contains(QT_CONFIG, cups) { - load(qfeatures) - !contains(QT_DISABLED_FEATURES, cups): SUBDIRS += cups -} +unix:!darwin:qtConfig(cups): SUBDIRS += cups -- cgit v1.2.3 From fd89fb4566501b3b4a34e25fefa882e97498e3ff Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 10 Aug 2016 14:50:28 +0200 Subject: Cleanup QT_NO_FONTCONFIG usage Stop messing around with the define in pro files, and rely on the configuration system. Disable fontconfig on Mac, which in practice gives the same result as before. Change-Id: Iea3aec127af96f221f4ee8682fb20a624332b82f Reviewed-by: Lars Knoll Reviewed-by: Oswald Buddenhagen --- src/plugins/platforms/minimal/minimal.pro | 1 - src/plugins/platforms/minimal/qminimalintegration.cpp | 8 ++++---- src/plugins/platforms/windows/windows.pri | 1 - 3 files changed, 4 insertions(+), 6 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/minimal/minimal.pro b/src/plugins/platforms/minimal/minimal.pro index 3aca27b555..0d31d6605b 100644 --- a/src/plugins/platforms/minimal/minimal.pro +++ b/src/plugins/platforms/minimal/minimal.pro @@ -11,7 +11,6 @@ HEADERS = qminimalintegration.h \ OTHER_FILES += minimal.json CONFIG += qpa/genericunixfontdatabase -win32|darwin: DEFINES += QT_NO_FONTCONFIG PLUGIN_TYPE = platforms PLUGIN_CLASS_NAME = QMinimalIntegrationPlugin diff --git a/src/plugins/platforms/minimal/qminimalintegration.cpp b/src/plugins/platforms/minimal/qminimalintegration.cpp index 7224f4114c..984d4456a0 100644 --- a/src/plugins/platforms/minimal/qminimalintegration.cpp +++ b/src/plugins/platforms/minimal/qminimalintegration.cpp @@ -46,10 +46,10 @@ #if defined(Q_OS_WIN) #include -#elif defined(QT_NO_FONTCONFIG) -#include -#else +#elif QT_CONFIG(fontconfig) #include +#else +#include #endif #if !defined(Q_OS_WIN) @@ -118,7 +118,7 @@ public: QPlatformFontDatabase *QMinimalIntegration::fontDatabase() const { if (m_options & EnableFonts) { -#ifndef QT_NO_FONTCONFIG +#if QT_CONFIG(fontconfig) if (!m_fontDatabase) m_fontDatabase = new QGenericUnixFontDatabase; #else diff --git a/src/plugins/platforms/windows/windows.pri b/src/plugins/platforms/windows/windows.pri index 28d7d04db4..6929f7365f 100644 --- a/src/plugins/platforms/windows/windows.pri +++ b/src/plugins/platforms/windows/windows.pri @@ -117,7 +117,6 @@ qtConfig(freetype) { qtConfig(system-freetype) { include($$QT_SOURCE_TREE/src/platformsupport/fontdatabases/basic/basic.pri) } else { - DEFINES *= QT_NO_FONTCONFIG include($$QT_SOURCE_TREE/src/3rdparty/freetype_dependency.pri) } } -- cgit v1.2.3 From 57378a108ca488cbf5cfaa32590fc762dcbf3315 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Thu, 19 May 2016 23:01:59 -0700 Subject: Add support for Apple watchOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I3f9e00569458a463af2eaa5a3a16a6afd1e9c1ea Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/platforms.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/platforms.pro b/src/plugins/platforms/platforms.pro index 8324520725..fcfebf6e94 100644 --- a/src/plugins/platforms/platforms.pro +++ b/src/plugins/platforms/platforms.pro @@ -10,7 +10,7 @@ qtConfig(xcb) { SUBDIRS += xcb } -uikit: SUBDIRS += ios +uikit:!watchos: SUBDIRS += ios osx: SUBDIRS += cocoa win32:!winrt: SUBDIRS += windows -- cgit v1.2.3 From e0e9e196a72ffe5457034894eaaadc90ed0d34ef Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 4 Aug 2016 16:40:07 +0200 Subject: Android: Show the edit menu when things are selected Change-Id: I3647fa39469c87bcc08bb439546e5e61c535c71d Reviewed-by: BogDan Vatra --- src/plugins/platforms/android/androidjniinput.cpp | 4 ++++ src/plugins/platforms/android/androidjniinput.h | 1 + src/plugins/platforms/android/qandroidinputcontext.cpp | 18 +++++++++++++++++- src/plugins/platforms/android/qandroidinputcontext.h | 4 +++- 4 files changed, 25 insertions(+), 2 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/android/androidjniinput.cpp b/src/plugins/platforms/android/androidjniinput.cpp index 62140c9816..5f05ab395e 100644 --- a/src/plugins/platforms/android/androidjniinput.cpp +++ b/src/plugins/platforms/android/androidjniinput.cpp @@ -175,6 +175,10 @@ namespace QtAndroidInput static void longPress(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/, jint x, jint y) { + QAndroidInputContext *inputContext = QAndroidInputContext::androidInputContext(); + if (inputContext && qGuiApp) + QMetaObject::invokeMethod(inputContext, "longPress", Q_ARG(int, x), Q_ARG(int, y)); + //### TODO: add proper API for Qt 5.2 static bool rightMouseFromLongPress = qEnvironmentVariableIntValue("QT_NECESSITAS_COMPATIBILITY_LONG_PRESS"); if (!rightMouseFromLongPress) diff --git a/src/plugins/platforms/android/androidjniinput.h b/src/plugins/platforms/android/androidjniinput.h index f9d2f1a2a7..af18a96dc1 100644 --- a/src/plugins/platforms/android/androidjniinput.h +++ b/src/plugins/platforms/android/androidjniinput.h @@ -39,6 +39,7 @@ #ifndef ANDROIDJNIINPUT_H #define ANDROIDJNIINPUT_H + #include #include #include diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp index c64e80479c..06a9c8c488 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.cpp +++ b/src/plugins/platforms/android/qandroidinputcontext.cpp @@ -550,7 +550,9 @@ void QAndroidInputContext::updateSelectionHandles() auto curRect = im->cursorRectangle(); QPoint cursorPoint(curRect.center().x(), curRect.bottom()); - QtAndroidInput::updateHandles(m_cursorHandleShown, cursorPoint * pixelDensity); + QPoint editMenuPoint(curRect.center().x(), curRect.top()); + QtAndroidInput::updateHandles(m_cursorHandleShown, cursorPoint * pixelDensity, + editMenuPoint * pixelDensity); return; } @@ -562,6 +564,11 @@ void QAndroidInputContext::updateSelectionHandles() QPoint leftPoint(leftRect.bottomLeft().toPoint() * pixelDensity); QPoint righPoint(rightRect.bottomRight().toPoint() * pixelDensity); QtAndroidInput::updateHandles(CursorHandleShowSelection, leftPoint, righPoint); + + if (m_cursorHandleShown == CursorHandleShowPopup) { + // make sure the popup does not reappear when the selection menu closes + m_cursorHandleShown = QAndroidInputContext::CursorHandleNotShown; + } } /* @@ -612,6 +619,15 @@ void QAndroidInputContext::touchDown(int x, int y) } } +void QAndroidInputContext::longPress(int x, int y) +{ + if (m_focusObject && inputItemRectangle().contains(x, y)) { + // Show the paste menu if there is something to paste. + m_cursorHandleShown = QAndroidInputContext::CursorHandleShowPopup; + updateSelectionHandles(); + } +} + void QAndroidInputContext::keyDown() { if (m_cursorHandleShown) { diff --git a/src/plugins/platforms/android/qandroidinputcontext.h b/src/plugins/platforms/android/qandroidinputcontext.h index c7b2b907b7..8a33ff71cc 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.h +++ b/src/plugins/platforms/android/qandroidinputcontext.h @@ -122,6 +122,7 @@ public slots: void updateSelectionHandles(); void handleLocationChanged(int handleId, int x, int y); void touchDown(int x, int y); + void longPress(int x, int y); void keyDown(); private slots: @@ -147,7 +148,8 @@ private: enum CursorHandleShowMode { CursorHandleNotShown, CursorHandleShowNormal = 1, - CursorHandleShowSelection = 2 + CursorHandleShowSelection = 2, + CursorHandleShowPopup = 3 }; CursorHandleShowMode m_cursorHandleShown; int m_batchEditNestingLevel; -- cgit v1.2.3