From 23e605cc5b71f68d6c9e6168053226d027ea46d4 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Tue, 30 Jul 2019 16:42:44 +0200 Subject: Plug a memory leak introduced in e24a4976bebd7ca90deac2b40c08900625773 While it is correct not to call the functor when the context object has been destroyed, we still need ot clean up the slotObj. It's a low- probability memory leak: the context object has to disappear while waiting for a host resolution, and for repeated requests for the same host the cache takes over anyway. Task-number: QTBUG-76276 Change-Id: Id9daf391353b8252443f3186a7d504d70c553b24 Reviewed-by: Timur Pocheptsov --- src/network/kernel/qhostinfo_p.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/network/kernel/qhostinfo_p.h b/src/network/kernel/qhostinfo_p.h index bbf4cc36d1..fa6529bdfd 100644 --- a/src/network/kernel/qhostinfo_p.h +++ b/src/network/kernel/qhostinfo_p.h @@ -105,12 +105,12 @@ public Q_SLOTS: inline void emitResultsReady(const QHostInfo &info) { if (slotObj) { - // we used to have a context object, but it's already destroyed - if (withContextObject && !receiver) - return; - QHostInfo copy = info; - void *args[2] = { 0, reinterpret_cast(©) }; - slotObj->call(const_cast(receiver.data()), args); + // we either didn't have a context object, or it's still alive + if (!withContextObject || receiver) { + QHostInfo copy = info; + void *args[2] = { 0, reinterpret_cast(©) }; + slotObj->call(const_cast(receiver.data()), args); + } slotObj->destroyIfLastRef(); } else { emit resultsReady(info); -- cgit v1.2.3 From 3d7bd7ad19254bb1c4794349e71501e58c91891e Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Tue, 30 Jul 2019 11:27:49 +0200 Subject: Fix hit testing in non-client area of fixed-size windows, don't show resize cursors The m_windowState member is never updated regarding active state; isActive is instead reimplemented to query the window manager, so use that. To extend the area where the user can move the window over the entire titlebar of fixed-height windows, just test whether the mouse position is within the titlebar. Change-Id: I6b87aacd0bdab511cfd4959df1114af5c6013852 Fixes: QTBUG-77220 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowswindow.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index eb521dac52..7d511bf0d7 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -2621,7 +2621,8 @@ bool QWindowsWindow::handleNonClientHitTest(const QPoint &globalPos, LRESULT *re // QTBUG-32663, suppress resize cursor for fixed size windows. const QWindow *w = window(); if (!w->isTopLevel() // Task 105852, minimized windows need to respond to user input. - || !(m_windowState & ~Qt::WindowActive) + || (m_windowState != Qt::WindowNoState) + || !isActive() || (m_data.flags & Qt::FramelessWindowHint)) { return false; } @@ -2641,12 +2642,10 @@ bool QWindowsWindow::handleNonClientHitTest(const QPoint &globalPos, LRESULT *re return true; } if (localPos.y() < 0) { - const QMargins margins = frameMargins(); - const int topResizeBarPos = margins.left() - margins.top(); - if (localPos.y() < topResizeBarPos) { + const int topResizeBarPos = -frameMargins().top(); + if (localPos.y() >= topResizeBarPos) *result = HTCAPTION; // Extend caption over top resize bar, let's user move the window. - return true; - } + return true; } } if (fixedWidth && (localPos.x() < 0 || localPos.x() >= size.width())) { -- cgit v1.2.3 From 174061f9f32ac76c6b8a6d155d772e37708d8cfc Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 31 Jul 2019 10:23:39 +0200 Subject: QHighDPI: Fix broken scaling of QPoint(F) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For some reason, the overload resolution of the High DPI scale() functions introduced by b6ded193ee64ffe67df6d22e7a23aa1ea9e02ec7 chose the wrong overloads for QPointF and/or QPoint; it fell back to the generic template intended for qreal, QSize, etc, ignoring the origin. Remove the template and spell out all overloads. Fixes: QTBUG-77255 Change-Id: I5661f16f7326f65156f646f430f5a0c71d5302d2 Reviewed-by: Tor Arne Vestbø --- src/gui/kernel/qhighdpiscaling_p.h | 20 +++++- tests/auto/gui/kernel/kernel.pro | 3 + .../gui/kernel/qhighdpiscaling/qhighdpiscaling.pro | 6 ++ .../kernel/qhighdpiscaling/tst_qhighdpiscaling.cpp | 77 ++++++++++++++++++++++ 4 files changed, 103 insertions(+), 3 deletions(-) create mode 100644 tests/auto/gui/kernel/qhighdpiscaling/qhighdpiscaling.pro create mode 100644 tests/auto/gui/kernel/qhighdpiscaling/tst_qhighdpiscaling.cpp diff --git a/src/gui/kernel/qhighdpiscaling_p.h b/src/gui/kernel/qhighdpiscaling_p.h index 3410c1d345..c43641b8c9 100644 --- a/src/gui/kernel/qhighdpiscaling_p.h +++ b/src/gui/kernel/qhighdpiscaling_p.h @@ -59,6 +59,7 @@ #include #include #include +#include #include QT_BEGIN_NAMESPACE @@ -117,13 +118,26 @@ private: namespace QHighDpi { -template -inline T scale(const T &value, qreal scaleFactor, QPoint origin = QPoint(0, 0)) +inline qreal scale(qreal value, qreal scaleFactor, QPointF /* origin */ = QPointF(0, 0)) { - Q_UNUSED(origin) return value * scaleFactor; } +inline QSize scale(const QSize &value, qreal scaleFactor, QPointF /* origin */ = QPointF(0, 0)) +{ + return value * scaleFactor; +} + +inline QSizeF scale(const QSizeF &value, qreal scaleFactor, QPointF /* origin */ = QPointF(0, 0)) +{ + return value * scaleFactor; +} + +inline QVector2D scale(const QVector2D &value, qreal scaleFactor, QPointF /* origin */ = QPointF(0, 0)) +{ + return value * float(scaleFactor); +} + inline QPointF scale(const QPointF &pos, qreal scaleFactor, QPointF origin = QPointF(0, 0)) { return (pos - origin) * scaleFactor + origin; diff --git a/tests/auto/gui/kernel/kernel.pro b/tests/auto/gui/kernel/kernel.pro index fbd3b1b371..42135dae24 100644 --- a/tests/auto/gui/kernel/kernel.pro +++ b/tests/auto/gui/kernel/kernel.pro @@ -11,6 +11,7 @@ SUBDIRS=\ qguimetatype \ qguitimer \ qguivariant \ + qhighdpiscaling \ qinputmethod \ qkeyevent \ qkeysequence \ @@ -35,6 +36,8 @@ win32:!winrt:qtHaveModule(network): SUBDIRS += noqteventloop !qtHaveModule(network): SUBDIRS -= \ qguieventloop +!qtConfig(highdpiscaling): SUBDIRS -= qhighdpiscaling + !qtConfig(opengl): SUBDIRS -= qopenglwindow android|uikit: SUBDIRS -= qclipboard diff --git a/tests/auto/gui/kernel/qhighdpiscaling/qhighdpiscaling.pro b/tests/auto/gui/kernel/qhighdpiscaling/qhighdpiscaling.pro new file mode 100644 index 0000000000..6cd7bb01f5 --- /dev/null +++ b/tests/auto/gui/kernel/qhighdpiscaling/qhighdpiscaling.pro @@ -0,0 +1,6 @@ +CONFIG += testcase +TARGET = tst_qhighdpiscaling + +QT += core-private gui-private testlib + +SOURCES += tst_qhighdpiscaling.cpp diff --git a/tests/auto/gui/kernel/qhighdpiscaling/tst_qhighdpiscaling.cpp b/tests/auto/gui/kernel/qhighdpiscaling/tst_qhighdpiscaling.cpp new file mode 100644 index 0000000000..969b2351ec --- /dev/null +++ b/tests/auto/gui/kernel/qhighdpiscaling/tst_qhighdpiscaling.cpp @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +#include + +class tst_QHighDpiScaling: public QObject +{ + Q_OBJECT + +private slots: + void scale(); +}; + +// Emulate the case of a High DPI secondary screen +class MyPlatformScreen : public QPlatformScreen +{ +public: + QRect geometry() const override { return QRect(3840, 0, 3840, 1920); } + QRect availableGeometry() const override { return geometry(); } + + int depth() const override { return 32; } + QImage::Format format() const override { return QImage::Format_ARGB32_Premultiplied; } +}; + +// QTBUG-77255: Test some scaling overloads +void tst_QHighDpiScaling::scale() +{ + QHighDpiScaling::setGlobalFactor(2); + QScopedPointer screen(new MyPlatformScreen); + + qreal nativeValue = 10; + const qreal value = QHighDpi::fromNativePixels(nativeValue, screen.data()); + QCOMPARE(value, qreal(5)); + QCOMPARE(QHighDpi::toNativePixels(value, screen.data()), nativeValue); + + // 10, 10 within screen should translate to 5,5 with origin preserved + const QPoint nativePoint = screen->geometry().topLeft() + QPoint(10, 10); + const QPoint point = QHighDpi::fromNativePixels(nativePoint, screen.data()); + QCOMPARE(point, QPoint(3845, 5)); + QCOMPARE(QHighDpi::toNativePixels(point, screen.data()), nativePoint); + + const QPointF nativePointF(nativePoint); + const QPointF pointF = QHighDpi::fromNativePixels(nativePointF, screen.data()); + QCOMPARE(pointF, QPointF(3845, 5)); + QCOMPARE(QHighDpi::toNativePixels(pointF, screen.data()), nativePointF); +} + +#include "tst_qhighdpiscaling.moc" +QTEST_MAIN(tst_QHighDpiScaling); -- cgit v1.2.3 From 9ad8debe38332a9d61a79e1b0017c19c442f4e49 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 30 Jul 2019 20:46:55 +0300 Subject: qlalr: fix compilation with C++20 std::not1 is deprecated in C++17, removed in C++20. Use its replacement, std::not_fn. Change-Id: I37d4929c81c2a5befeb44f954ae77b23960d2ff0 Reviewed-by: Ville Voutilainen --- src/tools/qlalr/lalr.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/tools/qlalr/lalr.cpp b/src/tools/qlalr/lalr.cpp index ec960925aa..541523d49c 100644 --- a/src/tools/qlalr/lalr.cpp +++ b/src/tools/qlalr/lalr.cpp @@ -295,6 +295,12 @@ void Automaton::build () buildDefaultReduceActions (); } +#if defined(__cpp_lib_not_fn) && __cpp_lib_not_fn >= 201603 +# define Q_NOT_FN std::not_fn +#else +# define Q_NOT_FN std::not1 +#endif + void Automaton::buildNullables () { bool changed = true; @@ -305,7 +311,7 @@ void Automaton::buildNullables () for (RulePointer rule = _M_grammar->rules.begin (); rule != _M_grammar->rules.end (); ++rule) { - NameList::iterator nn = std::find_if (rule->rhs.begin (), rule->rhs.end (), std::not1 (Nullable (this))); + NameList::iterator nn = std::find_if(rule->rhs.begin(), rule->rhs.end(), Q_NOT_FN(Nullable(this))); if (nn == rule->rhs.end ()) changed |= nullables.insert (rule->lhs).second; @@ -646,7 +652,7 @@ void Automaton::buildIncludesDigraph () if (! _M_grammar->isNonTerminal (*A)) continue; - NameList::iterator first_not_nullable = std::find_if (dot, rule->rhs.end (), std::not1 (Nullable (this))); + NameList::iterator first_not_nullable = std::find_if(dot, rule->rhs.end(), Q_NOT_FN(Nullable(this))); if (first_not_nullable != rule->rhs.end ()) continue; -- cgit v1.2.3 From bd8ef7fe24f80b193a3c47cc77795d766d35d25e Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Thu, 1 Aug 2019 13:58:48 +0200 Subject: Blacklist tst_http2::connectToHost MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test if flakey. Change-Id: I1f956f47ab4cf0602f3631e4f7908df35f5ce83f Reviewed-by: Tor Arne Vestbø --- tests/auto/network/access/http2/BLACKLIST | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 tests/auto/network/access/http2/BLACKLIST diff --git a/tests/auto/network/access/http2/BLACKLIST b/tests/auto/network/access/http2/BLACKLIST new file mode 100644 index 0000000000..8f26c5b89e --- /dev/null +++ b/tests/auto/network/access/http2/BLACKLIST @@ -0,0 +1,3 @@ + See qtbase/src/testlib/qtestblacklist.cpp for format +[connectToHost] +* -- cgit v1.2.3 From a34b0855f160add13d08c21715dd6853094c23e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 30 Jul 2019 15:41:57 +0200 Subject: macOS: Don't assume NSWindows will be created on the screen we request The user may have assigned the application to start up on a specific display, in which case the window's screen is nil after creation, and the resulting screen will be delivered as a normal screen change once the window is ordered on screen. Fixes: QTBUG-77154 Change-Id: Idade6d833e31654db239243f2430166b5d86eca2 Reviewed-by: Volker Hilsheimer --- src/plugins/platforms/cocoa/qcocoawindow.mm | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index b609fb3995..ab20c7abe9 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -1569,8 +1569,8 @@ QCocoaNSWindow *QCocoaWindow::createNSWindow(bool shouldBePanel) } rect.translate(-targetScreen->geometry().topLeft()); - QCocoaScreen *cocoaScreen = static_cast(targetScreen->handle()); - NSRect frame = QCocoaScreen::mapToNative(rect, cocoaScreen); + auto *targetCocoaScreen = static_cast(targetScreen->handle()); + NSRect frame = QCocoaScreen::mapToNative(rect, targetCocoaScreen); // Create NSWindow Class windowClass = shouldBePanel ? [QNSPanel class] : [QNSWindow class]; @@ -1579,15 +1579,22 @@ QCocoaNSWindow *QCocoaWindow::createNSWindow(bool shouldBePanel) // Deferring window creation breaks OpenGL (the GL context is // set up before the window is shown and needs a proper window) backing:NSBackingStoreBuffered defer:NO - screen:cocoaScreen->nativeScreen() + screen:targetCocoaScreen->nativeScreen() platformWindow:this]; - Q_ASSERT_X(nsWindow.screen == cocoaScreen->nativeScreen(), "QCocoaWindow", - "Resulting NSScreen should match the requested NSScreen"); + // The resulting screen can be different from the screen requested if + // for example the application has been assigned to a specific display. + auto resultingScreen = QCocoaIntegration::instance()->screenForNSScreen(nsWindow.screen); - if (targetScreen != window()->screen()) { + // But may not always be resolved at this point, in which case we fall back + // to the target screen. The real screen will be delivered as a screen change + // when resolved as part of ordering the window on screen. + if (!resultingScreen) + resultingScreen = targetCocoaScreen; + + if (resultingScreen->screen() != window()->screen()) { QWindowSystemInterface::handleWindowScreenChanged< - QWindowSystemInterface::SynchronousDelivery>(window(), targetScreen); + QWindowSystemInterface::SynchronousDelivery>(window(), resultingScreen->screen()); } static QSharedPointer sharedDelegate([[QNSWindowDelegate alloc] init], -- cgit v1.2.3 From 89e97e99378f90cd70e4b9f0462b8baece471d01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 31 Jul 2019 16:01:22 +0200 Subject: Pass qmake arguments when creating Xcode project from Makefile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I0020273b200465f44a135848b4fd505793e85c30 Reviewed-by: Jörg Bornemann --- mkspecs/features/mac/default_post.prf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/mac/default_post.prf b/mkspecs/features/mac/default_post.prf index c46222debd..f34b305d08 100644 --- a/mkspecs/features/mac/default_post.prf +++ b/mkspecs/features/mac/default_post.prf @@ -261,7 +261,7 @@ xcode_product_bundle_identifier_setting.value = "$${xcode_product_bundle_identif QMAKE_MAC_XCODE_SETTINGS += xcode_product_bundle_identifier_setting !macx-xcode { - generate_xcode_project.commands = @$(QMAKE) -spec macx-xcode $(EXPORT__PRO_FILE_) + generate_xcode_project.commands = @$(QMAKE) -spec macx-xcode $(EXPORT__PRO_FILE_) $$QMAKE_ARGS generate_xcode_project.target = xcodeproj QMAKE_EXTRA_VARIABLES += _PRO_FILE_ QMAKE_EXTRA_TARGETS += generate_xcode_project -- cgit v1.2.3 From 360000342ab095a936d8f09951e2b19c04c2678a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 30 Jul 2019 16:09:11 +0200 Subject: macOS: Improve screen positioning during window creation Allow AppKit to resolve screen for NSWindow lazily in the case where the position is outside any known screen. And explicitly set the style mask if detecting the corner case of positioning a window in the unavailable space on a rotated screen. In testing the effect of creating the window with a borderless style mask and then updating the mask did not seem to have any visual consequences, but we try to limit this mode just in case by only enabling it in the corner cases we detect. Change-Id: I4b7fcc6755a1ad5ff2683bec79d80a78226edae0 Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/cocoa/qcocoawindow.mm | 33 ++++++++++++++++++----------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index ab20c7abe9..d6f88b4f23 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -1543,12 +1543,6 @@ QCocoaNSWindow *QCocoaWindow::createNSWindow(bool shouldBePanel) Qt::WindowType type = window()->type(); Qt::WindowFlags flags = window()->flags(); - // Note: The macOS window manager has a bug, where if a screen is rotated, it will not allow - // a window to be created within the area of the screen that has a Y coordinate (I quadrant) - // higher than the height of the screen in its non-rotated state, unless the window is - // created with the NSWindowStyleMaskBorderless style mask. - NSWindowStyleMask styleMask = windowStyleMask(flags); - QRect rect = geometry(); QScreen *targetScreen = nullptr; @@ -1559,22 +1553,37 @@ QCocoaNSWindow *QCocoaWindow::createNSWindow(bool shouldBePanel) } } + NSWindowStyleMask styleMask = windowStyleMask(flags); + if (!targetScreen) { qCWarning(lcQpaWindow) << "Window position" << rect << "outside any known screen, using primary screen"; targetScreen = QGuiApplication::primaryScreen(); - // AppKit will only reposition a window that's outside the target screen area if - // the window has a title bar. If left out, the window ends up with no screen. - // The style mask will be corrected to the original style mask in setWindowFlags. - styleMask |= NSWindowStyleMaskTitled; + // Unless the window is created as borderless AppKit won't find a position and + // screen that's close to the requested invalid position, and will always place + // the window on the primary screen. + styleMask = NSWindowStyleMaskBorderless; } rect.translate(-targetScreen->geometry().topLeft()); auto *targetCocoaScreen = static_cast(targetScreen->handle()); - NSRect frame = QCocoaScreen::mapToNative(rect, targetCocoaScreen); + NSRect contentRect = QCocoaScreen::mapToNative(rect, targetCocoaScreen); + + if (targetScreen->primaryOrientation() == Qt::PortraitOrientation) { + // The macOS window manager has a bug, where if a screen is rotated, it will not allow + // a window to be created within the area of the screen that has a Y coordinate (I quadrant) + // higher than the height of the screen in its non-rotated state (including a magic padding + // of 24 points), unless the window is created with the NSWindowStyleMaskBorderless style mask. + if (styleMask && (contentRect.origin.y + 24 > targetScreen->geometry().width())) { + qCDebug(lcQpaWindow) << "Window positioned on portrait screen." + << "Adjusting style mask during creation"; + styleMask = NSWindowStyleMaskBorderless; + } + } // Create NSWindow Class windowClass = shouldBePanel ? [QNSPanel class] : [QNSWindow class]; - QCocoaNSWindow *nsWindow = [[windowClass alloc] initWithContentRect:frame + QCocoaNSWindow *nsWindow = [[windowClass alloc] initWithContentRect:contentRect + // Mask will be updated in setWindowFlags if not the final mask styleMask:styleMask // Deferring window creation breaks OpenGL (the GL context is // set up before the window is shown and needs a proper window) -- cgit v1.2.3 From 662798d785c309a343c13648cb018c7f556757a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 29 Jul 2019 16:40:08 +0200 Subject: macOS: Add system detection and version defines for macOS Catalina (10.15) Change-Id: I127efe752ebb70825f1b31f0d64c4293d1c71820 Reviewed-by: Simon Hausmann Reviewed-by: Volker Hilsheimer --- src/corelib/global/qoperatingsystemversion.cpp | 8 ++++++++ src/corelib/global/qoperatingsystemversion.h | 1 + src/corelib/global/qsystemdetection.h | 14 ++++++++++---- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/corelib/global/qoperatingsystemversion.cpp b/src/corelib/global/qoperatingsystemversion.cpp index 94dc261b41..bc6adb54dc 100644 --- a/src/corelib/global/qoperatingsystemversion.cpp +++ b/src/corelib/global/qoperatingsystemversion.cpp @@ -437,6 +437,14 @@ const QOperatingSystemVersion QOperatingSystemVersion::MacOSHighSierra = const QOperatingSystemVersion QOperatingSystemVersion::MacOSMojave = QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 14); +/*! + \variable QOperatingSystemVersion::MacOSCatalina + \brief a version corresponding to macOS Catalina (version 10.15). + \since 5.12.5 + */ +const QOperatingSystemVersion QOperatingSystemVersion::MacOSCatalina = + QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 15); + /*! \variable QOperatingSystemVersion::AndroidJellyBean \brief a version corresponding to Android Jelly Bean (version 4.1, API level 16). diff --git a/src/corelib/global/qoperatingsystemversion.h b/src/corelib/global/qoperatingsystemversion.h index df01e5438a..89c60c4960 100644 --- a/src/corelib/global/qoperatingsystemversion.h +++ b/src/corelib/global/qoperatingsystemversion.h @@ -71,6 +71,7 @@ public: static const QOperatingSystemVersion MacOSSierra; static const QOperatingSystemVersion MacOSHighSierra; static const QOperatingSystemVersion MacOSMojave; + static const QOperatingSystemVersion MacOSCatalina; static const QOperatingSystemVersion AndroidJellyBean; static const QOperatingSystemVersion AndroidJellyBean_MR1; diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h index a2e51fa330..3e38e6790b 100644 --- a/src/corelib/global/qsystemdetection.h +++ b/src/corelib/global/qsystemdetection.h @@ -231,17 +231,23 @@ # if !defined(__MAC_10_14) # define __MAC_10_14 101400 # endif +# if !defined(__MAC_10_15) +# define __MAC_10_15 101500 +# endif # if !defined(MAC_OS_X_VERSION_10_11) -# define MAC_OS_X_VERSION_10_11 101100 +# define MAC_OS_X_VERSION_10_11 __MAC_10_11 # endif # if !defined(MAC_OS_X_VERSION_10_12) -# define MAC_OS_X_VERSION_10_12 101200 +# define MAC_OS_X_VERSION_10_12 __MAC_10_12 # endif # if !defined(MAC_OS_X_VERSION_10_13) -# define MAC_OS_X_VERSION_10_13 101300 +# define MAC_OS_X_VERSION_10_13 __MAC_10_13 # endif # if !defined(MAC_OS_X_VERSION_10_14) -# define MAC_OS_X_VERSION_10_14 101400 +# define MAC_OS_X_VERSION_10_14 __MAC_10_14 +# endif +# if !defined(MAC_OS_X_VERSION_10_15) +# define MAC_OS_X_VERSION_10_15 __MAC_10_15 # endif # # if !defined(__IPHONE_10_0) -- cgit v1.2.3 From ec62033bc25ed60a6bb9286d07e4f4485800b068 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Thu, 1 Aug 2019 15:01:27 +0200 Subject: tst_http2::connectToHost - add a fix for SecureTransport backend One of the tests above was unsetting a variable that enforces the use of a temporary keychain. We have to set it back, otherwise the test is failing. What surprises me though - why I had this problem only locally and not on CI? Apparently, SecureTransport is not covered by our configurations ... Change-Id: I0ff1e3e304632869391ed61213c245b949d8c778 Reviewed-by: Volker Hilsheimer --- tests/auto/network/access/http2/tst_http2.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/auto/network/access/http2/tst_http2.cpp b/tests/auto/network/access/http2/tst_http2.cpp index ce685a1b1c..10dad25337 100644 --- a/tests/auto/network/access/http2/tst_http2.cpp +++ b/tests/auto/network/access/http2/tst_http2.cpp @@ -591,6 +591,19 @@ void tst_Http2::connectToHost() #if QT_CONFIG(ssl) Q_ASSERT(!clearTextHTTP2 || connectionType != H2Type::h2Alpn); + +#if QT_CONFIG(securetransport) + // Normally on macOS we use plain text only for SecureTransport + // does not support ALPN on the server side. With 'direct encrytped' + // we have to use TLS sockets (== private key) and thus suppress a + // keychain UI asking for permission to use a private key. + // Our CI has this, but somebody testing locally - will have a problem. + qputenv("QT_SSL_USE_TEMPORARY_KEYCHAIN", QByteArray("1")); + auto envRollback = qScopeGuard([](){ + qunsetenv("QT_SSL_USE_TEMPORARY_KEYCHAIN"); + }); +#endif // QT_CONFIG(securetransport) + #else Q_ASSERT(connectionType == H2Type::h2c || connectionType == H2Type::h2cDirect); Q_ASSERT(targetServer->isClearText()); -- cgit v1.2.3 From a22bb694ce27b16b3ad672b09700937362b9a320 Mon Sep 17 00:00:00 2001 From: Pavel Artsishevsky Date: Tue, 30 Jul 2019 04:04:45 +0300 Subject: Fix QPainter's ColorDodge and ColorBurn composition modes Added checking corner cases (more specific formulas) in color_dodge_op()/color_dodge_op_rgb64() and color_burn_op()/color_burn_op_rgb64() to produce correct results for any input. Task-number: QTBUG-77231 Change-Id: I274f80b356bd4236a9176a84a95604c2eb01787a Reviewed-by: Konstantin Tokarev Reviewed-by: Allan Sandfeld Jensen --- src/gui/painting/qcompositionfunctions.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/gui/painting/qcompositionfunctions.cpp b/src/gui/painting/qcompositionfunctions.cpp index 027bf23115..9308710c0b 100644 --- a/src/gui/painting/qcompositionfunctions.cpp +++ b/src/gui/painting/qcompositionfunctions.cpp @@ -1763,8 +1763,10 @@ void QT_FASTCALL comp_func_Lighten_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const QR } /* - if Sca.Da + Dca.Sa >= Sa.Da + if Sca.Da + Dca.Sa > Sa.Da Dca' = Sa.Da + Sca.(1 - Da) + Dca.(1 - Sa) + else if Sca == Sa + Dca' = Dca.Sa + Sca.(1 - Da) + Dca.(1 - Sa) otherwise Dca' = Dca.Sa/(1-Sca/Sa) + Sca.(1 - Da) + Dca.(1 - Sa) */ @@ -1775,8 +1777,10 @@ static inline int color_dodge_op(int dst, int src, int da, int sa) const int src_da = src * da; const int temp = src * (255 - da) + dst * (255 - sa); - if (src_da + dst_sa >= sa_da) + if (src_da + dst_sa > sa_da) return qt_div_255(sa_da + temp); + else if (src == sa || sa == 0) + return qt_div_255(temp); else return qt_div_255(255 * dst_sa / (255 - 255 * src / sa) + temp); } @@ -1788,8 +1792,10 @@ static inline uint color_dodge_op_rgb64(qint64 dst, qint64 src, qint64 da, qint6 const qint64 src_da = src * da; const qint64 temp = src * (65535 - da) + dst * (65535 - sa); - if (src_da + dst_sa >= sa_da) + if (src_da + dst_sa > sa_da) return qt_div_65535(sa_da + temp); + else if (src == sa || sa == 0) + return qt_div_65535(temp); else return qt_div_65535(65535 * dst_sa / (65535 - 65535 * src / sa) + temp); } @@ -1915,8 +1921,10 @@ void QT_FASTCALL comp_func_ColorDodge_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const } /* - if Sca.Da + Dca.Sa <= Sa.Da + if Sca.Da + Dca.Sa < Sa.Da Dca' = Sca.(1 - Da) + Dca.(1 - Sa) + else if Sca == 0 + Dca' = Dca.Sa + Sca.(1 - Da) + Dca.(1 - Sa) otherwise Dca' = Sa.(Sca.Da + Dca.Sa - Sa.Da)/Sca + Sca.(1 - Da) + Dca.(1 - Sa) */ @@ -1928,8 +1936,10 @@ static inline int color_burn_op(int dst, int src, int da, int sa) const int temp = src * (255 - da) + dst * (255 - sa); - if (src == 0 || src_da + dst_sa <= sa_da) + if (src_da + dst_sa < sa_da) return qt_div_255(temp); + else if (src == 0) + return qt_div_255(dst_sa + temp); return qt_div_255(sa * (src_da + dst_sa - sa_da) / src + temp); } @@ -1941,8 +1951,10 @@ static inline uint color_burn_op_rgb64(qint64 dst, qint64 src, qint64 da, qint64 const qint64 temp = src * (65535 - da) + dst * (65535 - sa); - if (src == 0 || src_da + dst_sa <= sa_da) + if (src_da + dst_sa < sa_da) return qt_div_65535(temp); + else if (src == 0) + return qt_div_65535(dst_sa + temp); return qt_div_65535(sa * (src_da + dst_sa - sa_da) / src + temp); } -- cgit v1.2.3 From 455963ce4996055e1f9a9a3c8d0d6a1abf64cd89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 31 Jul 2019 14:48:49 +0200 Subject: macOS: Don't require setting all three color buffer sizes in QSurfaceFormat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Iaa6eb4d64f549a31aa5c53145e8b37facec4ea78 Reviewed-by: Andy Nichols Reviewed-by: Tor Arne Vestbø --- src/gui/kernel/qsurfaceformat.cpp | 12 ------------ src/plugins/platforms/cocoa/qcocoaglcontext.mm | 11 +++++++++-- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/gui/kernel/qsurfaceformat.cpp b/src/gui/kernel/qsurfaceformat.cpp index 1a814ec21f..4e2bcad50f 100644 --- a/src/gui/kernel/qsurfaceformat.cpp +++ b/src/gui/kernel/qsurfaceformat.cpp @@ -554,10 +554,6 @@ int QSurfaceFormat::alphaBufferSize() const /*! Set the desired \a size in bits of the red channel of the color buffer. - - \note On Mac OSX, be sure to set the buffer size of all color channels, - otherwise this setting will have no effect. If one of the buffer sizes is not set, - the current bit-depth of the screen is used. */ void QSurfaceFormat::setRedBufferSize(int size) { @@ -569,10 +565,6 @@ void QSurfaceFormat::setRedBufferSize(int size) /*! Set the desired \a size in bits of the green channel of the color buffer. - - \note On Mac OSX, be sure to set the buffer size of all color channels, - otherwise this setting will have no effect. If one of the buffer sizes is not set, - the current bit-depth of the screen is used. */ void QSurfaceFormat::setGreenBufferSize(int size) { @@ -584,10 +576,6 @@ void QSurfaceFormat::setGreenBufferSize(int size) /*! Set the desired \a size in bits of the blue channel of the color buffer. - - \note On Mac OSX, be sure to set the buffer size of all color channels, - otherwise this setting will have no effect. If one of the buffer sizes is not set, - the current bit-depth of the screen is used. */ void QSurfaceFormat::setBlueBufferSize(int size) { diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm index e45ea7efd3..d91b2cabaf 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm @@ -197,8 +197,15 @@ NSOpenGLPixelFormat *QCocoaGLContext::pixelFormatForSurfaceFormat(const QSurface attrs << NSOpenGLPFAStencilSize << format.stencilBufferSize(); if (format.alphaBufferSize() > 0) attrs << NSOpenGLPFAAlphaSize << format.alphaBufferSize(); - if (format.redBufferSize() > 0 && format.greenBufferSize() > 0 && format.blueBufferSize() > 0) { - const int colorSize = format.redBufferSize() + format.greenBufferSize() + format.blueBufferSize(); + + auto rbz = format.redBufferSize(); + auto gbz = format.greenBufferSize(); + auto bbz = format.blueBufferSize(); + if (rbz > 0 || gbz > 0 || bbz > 0) { + auto fallbackSize = qMax(rbz, qMax(gbz, bbz)); + auto colorSize = (rbz > 0 ? rbz : fallbackSize) + + (gbz > 0 ? gbz : fallbackSize) + + (bbz > 0 ? bbz : fallbackSize); attrs << NSOpenGLPFAColorSize << colorSize << NSOpenGLPFAMinimumPolicy; } -- cgit v1.2.3 From 8c0787cfa1a906ebe25907515d86050303b127e7 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 31 Jul 2019 10:55:14 +0200 Subject: Fix dependency_libs entry of .la files Libtool cannot cope with absolute paths in the dependency_libs entry. We split absolute paths into -L and -l here. Change-Id: I30bf11e490d1993d2a4d88c114e07bbae12def6d Fixes: QTBUG-76625 Reviewed-by: Kai Koehne --- qmake/generators/unix/unixmake2.cpp | 38 ++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index d9bcccf2e2..abc37149a9 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -1450,7 +1450,36 @@ UnixMakefileGenerator::libtoolFileName(bool fixify) void UnixMakefileGenerator::writeLibtoolFile() { + auto fixDependencyLibs + = [this](const ProStringList &libs) + { + ProStringList result; + for (auto lib : libs) { + auto fi = fileInfo(lib.toQString()); + if (fi.isAbsolute()) { + const QString libDirArg = "-L" + fi.path(); + if (!result.contains(libDirArg)) + result += libDirArg; + QString namespec = fi.fileName(); + int dotPos = namespec.lastIndexOf('.'); + if (dotPos != -1 && namespec.startsWith("lib")) { + namespec.truncate(dotPos); + namespec.remove(0, 3); + } else { + debug_msg(1, "Ignoring dependency library %s", + lib.toLatin1().constData()); + continue; + } + result += "-l" + namespec; + } else { + result += lib; + } + } + return result; + }; + QString fname = libtoolFileName(), lname = fname; + debug_msg(1, "Writing libtool file %s", fname.toLatin1().constData()); mkdir(fileInfo(fname).path()); int slsh = lname.lastIndexOf(Option::dir_sep); if(slsh != -1) @@ -1488,12 +1517,11 @@ UnixMakefileGenerator::writeLibtoolFile() << ".a'\n\n"; t << "# Libraries that this one depends upon.\n"; + static const ProKey libVars[] = { "LIBS", "QMAKE_LIBS" }; ProStringList libs; - libs << "LIBS" << "QMAKE_LIBS"; - t << "dependency_libs='"; - for (ProStringList::ConstIterator it = libs.begin(); it != libs.end(); ++it) - t << fixLibFlags((*it).toKey()).join(' ') << ' '; - t << "'\n\n"; + for (auto var : libVars) + libs += fixLibFlags(var); + t << "dependency_libs='" << fixDependencyLibs(libs).join(' ') << "'\n\n"; t << "# Version information for " << lname << "\n"; int maj = project->first("VER_MAJ").toInt(); -- cgit v1.2.3