From 827b7afba7b16cb25e276dc5e7bd74cd69c3acf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Fri, 26 Apr 2019 14:57:01 +0300 Subject: ANGLE: Backport fix for compilation on mingw/64bit with clang This backports the following upstream fix from angle: https://github.com/google/angle/commit/63cc351fbad06c6241d1c7372fe76f74e1d09a10 Change-Id: Id80dba62c69f3505eb836f758367b4bf054b1fd5 Reviewed-by: Oliver Wolff --- .../common/third_party/smhasher/src/PMurHash.cpp | 3 +- ...ort-fix-for-compilation-on-mingw-64bit-wi.patch | 35 ++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 src/angle/patches/0014-ANGLE-Backport-fix-for-compilation-on-mingw-64bit-wi.patch (limited to 'src') diff --git a/src/3rdparty/angle/src/common/third_party/smhasher/src/PMurHash.cpp b/src/3rdparty/angle/src/common/third_party/smhasher/src/PMurHash.cpp index 071bc31539..93b48713cd 100644 --- a/src/3rdparty/angle/src/common/third_party/smhasher/src/PMurHash.cpp +++ b/src/3rdparty/angle/src/common/third_party/smhasher/src/PMurHash.cpp @@ -49,6 +49,7 @@ on big endian machines, or a byte-by-byte read if the endianess is unknown. #include "PMurHash.h" +#include /* I used ugly type names in the header to avoid potential conflicts with * application or system typedefs & defines. Since I'm not including any more @@ -208,7 +209,7 @@ void PMurHash32_Process(uint32_t *ph1, uint32_t *pcarry, const void *key, int le /* This CPU does not handle unaligned word access */ /* Consume enough so that the next data byte is word aligned */ - int i = -(long)ptr & 3; + int i = -(intptr_t)ptr & 3; if(i && i <= len) { DOBYTES(i, h1, c, n, ptr, len); } diff --git a/src/angle/patches/0014-ANGLE-Backport-fix-for-compilation-on-mingw-64bit-wi.patch b/src/angle/patches/0014-ANGLE-Backport-fix-for-compilation-on-mingw-64bit-wi.patch new file mode 100644 index 0000000000..a32f25d2c0 --- /dev/null +++ b/src/angle/patches/0014-ANGLE-Backport-fix-for-compilation-on-mingw-64bit-wi.patch @@ -0,0 +1,35 @@ +From e7ff4aa4ef2221aa02d39bdead7f35008016994e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Martin=20Storsj=C3=B6?= +Date: Fri, 26 Apr 2019 14:57:01 +0300 +Subject: [PATCH] ANGLE: Backport fix for compilation on mingw/64bit with clang + +This backports the following upstream fix from angle: +https://github.com/google/angle/commit/63cc351fbad06c6241d1c7372fe76f74e1d09a10 +--- + .../angle/src/common/third_party/smhasher/src/PMurHash.cpp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/3rdparty/angle/src/common/third_party/smhasher/src/PMurHash.cpp b/src/3rdparty/angle/src/common/third_party/smhasher/src/PMurHash.cpp +index 071bc31539..93b48713cd 100644 +--- a/src/3rdparty/angle/src/common/third_party/smhasher/src/PMurHash.cpp ++++ b/src/3rdparty/angle/src/common/third_party/smhasher/src/PMurHash.cpp +@@ -49,6 +49,7 @@ on big endian machines, or a byte-by-byte read if the endianess is unknown. + + + #include "PMurHash.h" ++#include + + /* I used ugly type names in the header to avoid potential conflicts with + * application or system typedefs & defines. Since I'm not including any more +@@ -208,7 +209,7 @@ void PMurHash32_Process(uint32_t *ph1, uint32_t *pcarry, const void *key, int le + /* This CPU does not handle unaligned word access */ + + /* Consume enough so that the next data byte is word aligned */ +- int i = -(long)ptr & 3; ++ int i = -(intptr_t)ptr & 3; + if(i && i <= len) { + DOBYTES(i, h1, c, n, ptr, len); + } +-- +2.20.1 (Apple Git-117) + -- cgit v1.2.3 From fa890c4686f3971b30e78147853db6bd0a8a3512 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 7 May 2019 12:22:27 +0200 Subject: Windows QPA: Improve debug messages Include screen and MINMAXINFO values in the message about not being able to set the geometry. Suppress output of some window finding functions unless verbose. Change-Id: Iaaae59ecb302438b3444735067d018c77d2af162 Reviewed-by: Oliver Wolff --- src/plugins/platforms/windows/qwindowscontext.cpp | 2 + src/plugins/platforms/windows/qwindowsscreen.cpp | 6 +- src/plugins/platforms/windows/qwindowswindow.cpp | 75 ++++++++++++++++++----- 3 files changed, 66 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 80517ffe69..6c1f5c8f93 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -1325,6 +1325,8 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, return false; platformWindow->setFlag(QWindowsWindow::WithinDpiChanged); const RECT *prcNewWindow = reinterpret_cast(lParam); + qCDebug(lcQpaWindows) << __FUNCTION__ << "WM_DPICHANGED" + << platformWindow->window() << *prcNewWindow; SetWindowPos(hwnd, nullptr, prcNewWindow->left, prcNewWindow->top, prcNewWindow->right - prcNewWindow->left, prcNewWindow->bottom - prcNewWindow->top, SWP_NOZORDER | SWP_NOACTIVATE); diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp index 0520f88935..94608bfd82 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.cpp +++ b/src/plugins/platforms/windows/qwindowsscreen.cpp @@ -240,7 +240,8 @@ QWindow *QWindowsScreen::topLevelAt(const QPoint &point) const QWindow *result = nullptr; if (QWindow *child = QWindowsScreen::windowAt(point, CWP_SKIPINVISIBLE)) result = QWindowsWindow::topLevelOf(child); - qCDebug(lcQpaWindows) <<__FUNCTION__ << point << result; + if (QWindowsContext::verbose > 1) + qCDebug(lcQpaWindows) <<__FUNCTION__ << point << result; return result; } @@ -250,7 +251,8 @@ QWindow *QWindowsScreen::windowAt(const QPoint &screenPoint, unsigned flags) if (QPlatformWindow *bw = QWindowsContext::instance()-> findPlatformWindowAt(GetDesktopWindow(), screenPoint, flags)) result = bw->window(); - qCDebug(lcQpaWindows) <<__FUNCTION__ << screenPoint << " returns " << result; + if (QWindowsContext::verbose > 1) + qCDebug(lcQpaWindows) <<__FUNCTION__ << screenPoint << " returns " << result; return result; } diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index dc9aa0da23..f538b6bad7 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -184,6 +184,7 @@ static inline RECT RECTfromQRect(const QRect &rect) return result; } + #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug d, const RECT &r) { @@ -262,6 +263,16 @@ QDebug operator<<(QDebug d, const GUID &guid) } #endif // !QT_NO_DEBUG_STREAM +static void formatBriefRectangle(QDebug &d, const QRect &r) +{ + d << r.width() << 'x' << r.height() << forcesign << r.x() << r.y() << noforcesign; +} + +static void formatBriefMargins(QDebug &d, const QMargins &m) +{ + d << m.left() << ", " << m.top() << ", " << m.right() << ", " << m.bottom(); +} + // QTBUG-43872, for windows that do not have WS_EX_TOOLWINDOW set, WINDOWPLACEMENT // is in workspace/available area coordinates. static QPoint windowPlacementOffset(HWND hwnd, const QPoint &point) @@ -1675,6 +1686,51 @@ QRect QWindowsWindow::normalGeometry() const return frame.isValid() ? frame.marginsRemoved(margins) : frame; } +static QString msgUnableToSetGeometry(const QWindowsWindow *platformWindow, + const QRect &requestedRect, + const QRect &obtainedRect, + const QMargins &fullMargins, + const QMargins &customMargins) +{ + QString result; + QDebug debug(&result); + debug.nospace(); + debug.noquote(); + const auto window = platformWindow->window(); + debug << "Unable to set geometry "; + formatBriefRectangle(debug, requestedRect); + debug << " (frame: "; + formatBriefRectangle(debug, requestedRect + fullMargins); + debug << ") on " << window->metaObject()->className() << "/\"" + << window->objectName() << "\" on \"" << window->screen()->name() + << "\". Resulting geometry: "; + formatBriefRectangle(debug, obtainedRect); + debug << " (frame: "; + formatBriefRectangle(debug, obtainedRect + fullMargins); + debug << ") margins: "; + formatBriefMargins(debug, fullMargins); + if (!customMargins.isNull()) { + debug << " custom margin: "; + formatBriefMargins(debug, customMargins); + } + const auto minimumSize = window->minimumSize(); + const bool hasMinimumSize = !minimumSize.isEmpty(); + if (hasMinimumSize) + debug << " minimum size: " << minimumSize.width() << 'x' << minimumSize.height(); + const auto maximumSize = window->maximumSize(); + const bool hasMaximumSize = maximumSize.width() != QWINDOWSIZE_MAX || maximumSize.height() != QWINDOWSIZE_MAX; + if (hasMaximumSize) + debug << " maximum size: " << maximumSize.width() << 'x' << maximumSize.height(); + if (hasMinimumSize || hasMaximumSize) { + MINMAXINFO minmaxInfo; + memset(&minmaxInfo, 0, sizeof(minmaxInfo)); + platformWindow->getSizeHints(&minmaxInfo); + debug << ' ' << minmaxInfo; + } + debug << ')'; + return result; +} + void QWindowsWindow::setGeometry(const QRect &rectIn) { QRect rect = rectIn; @@ -1694,21 +1750,10 @@ void QWindowsWindow::setGeometry(const QRect &rectIn) setGeometry_sys(rect); clearFlag(WithinSetGeometry); if (m_data.geometry != rect && (isVisible() || QLibraryInfo::isDebugBuild())) { - qWarning("%s: Unable to set geometry %dx%d+%d+%d on %s/'%s'." - " Resulting geometry: %dx%d+%d+%d " - "(frame: %d, %d, %d, %d, custom margin: %d, %d, %d, %d" - ", minimum size: %dx%d, maximum size: %dx%d).", - __FUNCTION__, - rect.width(), rect.height(), rect.x(), rect.y(), - window()->metaObject()->className(), qPrintable(window()->objectName()), - m_data.geometry.width(), m_data.geometry.height(), - m_data.geometry.x(), m_data.geometry.y(), - m_data.fullFrameMargins.left(), m_data.fullFrameMargins.top(), - m_data.fullFrameMargins.right(), m_data.fullFrameMargins.bottom(), - m_data.customMargins.left(), m_data.customMargins.top(), - m_data.customMargins.right(), m_data.customMargins.bottom(), - window()->minimumWidth(), window()->minimumHeight(), - window()->maximumWidth(), window()->maximumHeight()); + const auto warning = + msgUnableToSetGeometry(this, rectIn, m_data.geometry, + m_data.fullFrameMargins, m_data.customMargins); + qWarning("%s: %s", __FUNCTION__, qPrintable(warning)); } } else { QPlatformWindow::setGeometry(rect); -- cgit v1.2.3 From 17c44479aa848341d46800cf9a95ab04814cb903 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 8 May 2019 14:21:31 +0200 Subject: Update CLDR version in attribution This is a follow-up to 43abe86e. Change-Id: I2442304c9c79bcb1932fb173b8d993a242d79f4b Reviewed-by: Konstantin Ritt --- src/corelib/tools/qt_attribution.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/tools/qt_attribution.json b/src/corelib/tools/qt_attribution.json index a842d9467b..912da3f22c 100644 --- a/src/corelib/tools/qt_attribution.json +++ b/src/corelib/tools/qt_attribution.json @@ -29,7 +29,7 @@ world's languages, with the largest and most extensive standard repository of locale data available.", "Homepage": "http://cldr.unicode.org/", - "Version": "v34", + "Version": "v35.1", "License": "// as specified in https://spdx.org/licenses/Unicode-DFS-2016.html", "License": "Unicode License Agreement - Data Files and Software (2016)", "LicenseId": "Unicode-DFS-2016", -- cgit v1.2.3 From 64a2dc3962eabd7e59fb408a0b1604891302df72 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 9 May 2019 13:25:48 +0200 Subject: Add missing backslash to kmsconvenience.pro Change-Id: I3519447af657bdbb7304aca272de416104dca0f9 Fixes: QTBUG-75730 Reviewed-by: Johan Helsing --- src/platformsupport/kmsconvenience/kmsconvenience.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/platformsupport/kmsconvenience/kmsconvenience.pro b/src/platformsupport/kmsconvenience/kmsconvenience.pro index 5ea2e3f208..0c5a20a239 100644 --- a/src/platformsupport/kmsconvenience/kmsconvenience.pro +++ b/src/platformsupport/kmsconvenience/kmsconvenience.pro @@ -6,7 +6,7 @@ CONFIG += static internal_module DEFINES += QT_NO_CAST_FROM_ASCII -HEADERS += +HEADERS += \ qkmsdevice_p.h SOURCES += \ -- cgit v1.2.3 From 3159845c9c6c72c3e4492c2359c8a020fdb6ce5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 9 May 2019 14:08:23 +0200 Subject: macOS: Implement QCALayerBackingStore::toImage() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's not part of the QBackingStore API, but clients such as the Qt Quick software renderer access it through the platform backingstore, to grab the window. Change-Id: I203484ce13a5f8fb6815d27ab07f874fa9d16b8c Fixes: QTBUG-75467 Reviewed-by: Eirik Aavitsland Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/cocoa/qcocoabackingstore.h | 1 + src/plugins/platforms/cocoa/qcocoabackingstore.mm | 15 +++++++++++++++ 2 files changed, 16 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.h b/src/plugins/platforms/cocoa/qcocoabackingstore.h index 470da63e3d..acddc3ecc8 100644 --- a/src/plugins/platforms/cocoa/qcocoabackingstore.h +++ b/src/plugins/platforms/cocoa/qcocoabackingstore.h @@ -81,6 +81,7 @@ public: QPlatformTextureList *textures, bool translucentBackground) override; #endif + QImage toImage() const override; QPlatformGraphicsBuffer *graphicsBuffer() const override; private: diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm index e786ecb5a5..cff1f96615 100644 --- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm +++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm @@ -534,6 +534,21 @@ void QCALayerBackingStore::composeAndFlush(QWindow *window, const QRegion ®io } #endif +QImage QCALayerBackingStore::toImage() const +{ + if (!const_cast(this)->prepareForFlush()) + return QImage(); + + // We need to make a copy here, as the returned image could be used just + // for reading, in which case it won't detach, and then the underlying + // image data might change under the feet of the client when we re-use + // the buffer at a later point. + m_buffers.back()->lock(QPlatformGraphicsBuffer::SWReadAccess); + QImage imageCopy = m_buffers.back()->asImage()->copy(); + m_buffers.back()->unlock(); + return imageCopy; +} + QPlatformGraphicsBuffer *QCALayerBackingStore::graphicsBuffer() const { return m_buffers.back().get(); -- cgit v1.2.3 From b7edc811ec00b6e0687cb96fda64c7e608af56c6 Mon Sep 17 00:00:00 2001 From: Keith Kyzivat Date: Fri, 15 Mar 2019 12:07:42 -0400 Subject: Work around VS2015/17 bitset + qfloat16.h compiler bug [ChangeLog][QtCore][Global] Added the QT_NO_FLOAT16_OPERATORS macro in order to work around a Microsoft <= VS2017 compiler bug that is exposed when using std::bitset along with any Qt header that includes . This is fixed in MSVC 2019[1], but the workaround is needed for earlier versions. In this case, cl.exe fails with C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.10.25017\include\bitset(270): error C2666: 'operator /': 10 overloads have similar conversions C:\Qt\5.12.0\msvc2017_64\include\QtCore/qsize.h(364): note: could be 'const QSizeF operator /(const QSizeF &,qreal)' C:\Qt\5.12.0\msvc2017_64\include\QtCore/qsize.h(194): note: or 'const QSize operator /(const QSize &,qreal)' c:\qt\5.12.0\msvc2017_64\include\qtcore\qmargins.h(427): note: or 'QMarginsF operator /(const QMarginsF &,qreal)' c:\qt\5.12.0\msvc2017_64\include\qtcore\qmargins.h(213): note: or 'QMargins operator /(const QMargins &,qreal)' c:\qt\5.12.0\msvc2017_64\include\qtcore\qmargins.h(207): note: or 'QMargins operator /(const QMargins &,int)' C:\Qt\5.12.0\msvc2017_64\include\QtCore/qfloat16.h(205): note: or 'double operator /(int,qfloat16) noexcept' C:\Qt\5.12.0\msvc2017_64\include\QtCore/qfloat16.h(205): note: or 'double operator /(qfloat16,int) noexcept' C:\Qt\5.12.0\msvc2017_64\include\QtCore/qfloat16.h(195): note: or 'float operator /(float,qfloat16) noexcept' C:\Qt\5.12.0\msvc2017_64\include\QtCore/qfloat16.h(195): note: or 'float operator /(qfloat16,float) noexcept' C:\Qt\5.12.0\msvc2017_64\include\QtCore/qfloat16.h(194): note: or 'double operator /(double,qfloat16) noexcept' C:\Qt\5.12.0\msvc2017_64\include\QtCore/qfloat16.h(194): note: or 'double operator /(qfloat16,double) noexcept' C:\Qt\5.12.0\msvc2017_64\include\QtCore/qfloat16.h(193): note: or 'long double operator /(long double,qfloat16) noexcept' C:\Qt\5.12.0\msvc2017_64\include\QtCore/qfloat16.h(193): note: or 'long double operator /(qfloat16,long double) noexcept' C:\Qt\5.12.0\msvc2017_64\include\QtCore/qfloat16.h(176): note: or 'qfloat16 operator /(qfloat16,qfloat16) noexcept' C:\Qt\5.12.0\msvc2017_64\include\QtCore/qpoint.h(402): note: or 'const QPointF operator /(const QPointF &,qreal)' C:\Qt\5.12.0\msvc2017_64\include\QtCore/qpoint.h(206): note: or 'const QPoint operator /(const QPoint &,qreal)' C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.10.25017\include\bitset(270): note: or 'built-in C++ operator/(::size_t, )' C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.10.25017\include\bitset(270): note: while trying to match the argument list '(::size_t, )' C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.10.25017\include\bitset(266): note: while compiling class template member function 'std::bitset<8> &std::bitset<8>::set(::size_t,bool)' C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.10.25017\include\bitset(39): note: see reference to function template instantiation 'std::bitset<8> &std::bitset<8>::set(::size_t,bool)' being compiled ..\Qt5.12.0-C2666\main.cpp(7): note: see reference to class template instantiation 'std::bitset<8>' being compiled Invoke this workaround by defining the macro QT_NO_FLOAT16_OPERATORS in user code prior to the inclusion of Qt includes in a translation unit. Arithmetic operators from qfloat16 will then not be present in that compilation unit. [1] https://developercommunity.visualstudio.com/content/problem/406329/compiler-error-c2666-when-using-stdbitset-and-cust.html Task-number: QTBUG-72073 Change-Id: I58f8400bf933ad781d4213731695e20e0c482166 Reviewed-by: Thiago Macieira Reviewed-by: Edward Welbourne --- src/corelib/global/qfloat16.cpp | 13 +++++++++++++ src/corelib/global/qfloat16.h | 4 ++++ 2 files changed, 17 insertions(+) (limited to 'src') diff --git a/src/corelib/global/qfloat16.cpp b/src/corelib/global/qfloat16.cpp index fd608efe55..87ff796368 100644 --- a/src/corelib/global/qfloat16.cpp +++ b/src/corelib/global/qfloat16.cpp @@ -64,6 +64,19 @@ QT_BEGIN_NAMESPACE \since 5.9 */ +/*! + \macro QT_NO_FLOAT16_OPERATORS + \relates + \since 5.12.4 + + Defining this macro disables the arithmetic operators for qfloat16. + + This is only necessary on Visual Studio 2017 (and earlier) when including + \c {} and \c{} in the same translation unit, which would + otherwise cause a compilation error due to a toolchain bug (see + [QTBUG-72073]). +*/ + /*! Returns true if the \c qfloat16 \a {f} is equivalent to infinity. \relates diff --git a/src/corelib/global/qfloat16.h b/src/corelib/global/qfloat16.h index 3e50ad8467..b76d2b9616 100644 --- a/src/corelib/global/qfloat16.h +++ b/src/corelib/global/qfloat16.h @@ -83,7 +83,9 @@ private: Q_CORE_EXPORT static const quint32 shifttable[]; friend bool qIsNull(qfloat16 f) Q_DECL_NOTHROW; +#if !defined(QT_NO_FLOAT16_OPERATORS) friend qfloat16 operator-(qfloat16 a) Q_DECL_NOTHROW; +#endif }; Q_DECLARE_TYPEINFO(qfloat16, Q_PRIMITIVE_TYPE); @@ -165,6 +167,7 @@ inline qfloat16::operator float() const Q_DECL_NOTHROW } #endif +#if !defined(QT_NO_FLOAT16_OPERATORS) inline qfloat16 operator-(qfloat16 a) Q_DECL_NOTHROW { qfloat16 f; @@ -246,6 +249,7 @@ QF16_MAKE_BOOL_OP_INT(!=) #undef QF16_MAKE_BOOL_OP_INT QT_WARNING_POP +#endif // QT_NO_FLOAT16_OPERATORS /*! \internal -- cgit v1.2.3 From 123053bba8dc2241041c31a262420edd3583b1c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 9 May 2019 20:43:30 +0200 Subject: macOS: Don't clip menu item drawing to bounding rect when using CoreText MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The bounding rect was computed based on the font metrics HarfBuzz gave us, but those may not be 1:1 with what CoreText ends up using. When that happens, drawInRect: will line-break the last word, which makes it fall completely outside of the single line bounding rect. This is not a good failure mode, so we prefer to draw the text at a point instead, allowing the resulting text to draw slightly outside of the bounding rect. This is preferable to adding a random padding to the width and hoping it will be enough to solve the problem. Change-Id: Ifa58a33bd9fad689ed4ee947327b7079f3c1b61d Fixes: QTBUG-74565 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Tor Arne Vestbø --- src/plugins/styles/mac/qmacstyle_mac.mm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index 2a6f212569..81835b7c63 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -4290,12 +4290,15 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter alpha:pc.alphaF()]; s = qt_mac_removeMnemonics(s); - const auto textRect = CGRectMake(xpos, yPos, mi->rect.width() - xm - tabwidth + 1, mi->rect.height()); QMacCGContext cgCtx(p); d->setupNSGraphicsContext(cgCtx, YES); - [s.toNSString() drawInRect:textRect + // Draw at point instead of in rect, as the rect we've computed for the menu item + // is based on the font metrics we got from HarfBuzz, so we may risk having CoreText + // line-break the string if it doesn't fit the given rect. It's better to draw outside + // the rect and possibly overlap something than to have part of the text disappear. + [s.toNSString() drawAtPoint:CGPointMake(xpos, yPos) withAttributes:@{ NSFontAttributeName:f, NSForegroundColorAttributeName:c, NSObliquenessAttributeName: [NSNumber numberWithDouble: myFont.italic() ? 0.3 : 0.0]}]; -- cgit v1.2.3 From c99678fb19e579466f2a9e4df626de3cdb51f272 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 9 May 2019 15:07:22 +0200 Subject: macOS: Deliver geometry changes when content view changes frame MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was disabled in 9f22ac0aa0254f20f9b26aec7b124d74141fdfcd under the assumption that the windowDidResize callback was sufficient, but in the situation when macOS native tabs are enabled, AppKit will report the wrong geometry for the first windowDidResize callback when a new tab is created. We could potentially remove the geometry change in windowDidResize, as the viewDidChangeFrame callback should be enough for content views, but this is something that needs more investigation. Change-Id: I85045507da1a01b4a906e6f88301f3321c660943 Fixes: QTBUG-75482 Reviewed-by: Morten Johan Sørvig Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/cocoa/qcocoawindow.mm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index f992248275..d0ad1791c3 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -1085,9 +1085,11 @@ void QCocoaWindow::setEmbeddedInForeignView() void QCocoaWindow::viewDidChangeFrame() { - if (isContentView()) - return; // Handled below - + // Note: When the view is the content view, it would seem redundant + // to deliver geometry changes both from windowDidResize and this + // callback, but in some cases such as when macOS native tabbed + // windows are enabled we may end up with the wrong geometry in + // the initial windowDidResize callback when a new tab is created. handleGeometryChange(); } -- cgit v1.2.3 From 2a1651cc164b270dac81f4caa1fb8ded4fab6e4b Mon Sep 17 00:00:00 2001 From: Ville Voutilainen Date: Fri, 10 May 2019 16:45:56 +0300 Subject: Make moc grok binary literals with digit separators Task-number: QTBUG-75656 Change-Id: I6011ef2fb07497cc2a055d6828a1b6356927c281 Reviewed-by: Lars Knoll --- src/tools/moc/preprocessor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp index e83125925d..d135bddb4c 100644 --- a/src/tools/moc/preprocessor.cpp +++ b/src/tools/moc/preprocessor.cpp @@ -241,7 +241,8 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso if (!*data || *data != '.') { token = INTEGER_LITERAL; if (data - lexem == 1 && - (*data == 'x' || *data == 'X') + (*data == 'x' || *data == 'X' + || *data == 'b' || *data == 'B') && *lexem == '0') { ++data; while (is_hex_char(*data) || *data == '\'') -- cgit v1.2.3 From 4d2ee7f358a5cea64e7093aa0ab54e6422f8915e Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 6 May 2019 12:35:05 +0200 Subject: Add unvectorized fallback in case FP exceptions are not masked If an application enables FP exceptions our FP-based unpremul will raise the INVALID exception. Since disabling them locally might be slow just take a slow path when detected. Fixes: QTBUG-75592 Change-Id: Ie22a032a4f62229f68ad21ede359c62291adc9bf Reviewed-by: Thiago Macieira --- src/gui/painting/qdrawhelper_sse4.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src') diff --git a/src/gui/painting/qdrawhelper_sse4.cpp b/src/gui/painting/qdrawhelper_sse4.cpp index f6c2f11eaf..9daaaecc98 100644 --- a/src/gui/painting/qdrawhelper_sse4.cpp +++ b/src/gui/painting/qdrawhelper_sse4.cpp @@ -107,6 +107,17 @@ template static inline void convertARGBFromARGB32PM_sse4(uint *buffer, const uint *src, int count) { int i = 0; + if ((_MM_GET_EXCEPTION_MASK() & _MM_MASK_INVALID) == 0) { + for (; i < count; ++i) { + uint v = qUnpremultiply(src[i]); + if (RGBx) + v = 0xff000000 | v; + if (RGBA) + v = ARGB2RGBA(v); + buffer[i] = v; + } + return; + } const __m128i alphaMask = _mm_set1_epi32(0xff000000); const __m128i rgbaMask = _mm_setr_epi8(2, 1, 0, 3, 6, 5, 4, 7, 10, 9, 8, 11, 14, 13, 12, 15); const __m128i zero = _mm_setzero_si128(); @@ -174,6 +185,13 @@ template static inline void convertARGBFromRGBA64PM_sse4(uint *buffer, const QRgba64 *src, int count) { int i = 0; + if ((_MM_GET_EXCEPTION_MASK() & _MM_MASK_INVALID) == 0) { + for (; i < count; ++i) { + const QRgba64 v = src[i].unpremultiplied(); + buffer[i] = RGBA ? toRgba8888(v) : toArgb32(v); + } + return; + } const __m128i alphaMask = _mm_set1_epi64x(qint64(Q_UINT64_C(0xffff) << 48)); const __m128i alphaMask32 = _mm_set1_epi32(0xff000000); const __m128i rgbaMask = _mm_setr_epi8(2, 1, 0, 3, 6, 5, 4, 7, 10, 9, 8, 11, 14, 13, 12, 15); -- cgit v1.2.3 From c905ff4392ee0f71b5b003ee3ed4fa42f4e3f8f1 Mon Sep 17 00:00:00 2001 From: Vova Mshanetskiy Date: Mon, 6 May 2019 19:20:11 +0300 Subject: QAndroidInputContext: Fix start value of Cursor attribute in longPress() The value of start for a QInputMethodEvent::Cursor attribute must be specified relative to the start of preedit string, but longPress() was specifying it relative to start of surrounding text. This was causing QQuickTextInput to return wrong values of cursor and anchor rectangles. And this was causing invalid positioning of cursor selection handles after a long press. Change-Id: Ief67e86dd90b09ebf2ba191a2b0311ff803afdd9 Reviewed-by: BogDan Vatra --- src/plugins/platforms/android/qandroidinputcontext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp index 00ab3409d3..07a6b52dbe 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.cpp +++ b/src/plugins/platforms/android/qandroidinputcontext.cpp @@ -791,7 +791,7 @@ void QAndroidInputContext::longPress(int x, int y) return; } QList imAttributes; - imAttributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, cursor, 0, QVariant())); + imAttributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, 0, 0, QVariant())); imAttributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Selection, anchor, cursor - anchor, QVariant())); QInputMethodEvent event(QString(), imAttributes); QGuiApplication::sendEvent(m_focusObject, &event); -- cgit v1.2.3 From 341c9106881810962f253c1502d2c4f6da90e149 Mon Sep 17 00:00:00 2001 From: Vova Mshanetskiy Date: Tue, 7 May 2019 15:26:32 +0300 Subject: Android: Fix wrong height of text editor context menu in some locales Combined width of all four buttons (cut, copy, paste, select all) is greater than width of the screen in some locales and/or on some devices. This was causing width of the last button to be set to zero and height of the whole popup to grow too much due to word wrapping in the last button. The context menu used to look something like this then: Cut Copy Paste S e l e c t a l l This commit disables word wrapping and enables text ellipsizing for button labels. This fixes height of the popup. In the long term though Qt will probably have to implement an overflow button like in Android's built context menu. The linked bug report contains before and after screenshots. Fixes: QTBUG-72933 Change-Id: I8e270dbf8ca66f99748cdc531a77e11a5ab11c2b Reviewed-by: BogDan Vatra --- src/android/jar/src/org/qtproject/qt5/android/EditContextView.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/android/jar/src/org/qtproject/qt5/android/EditContextView.java b/src/android/jar/src/org/qtproject/qt5/android/EditContextView.java index 6d9987ca2a..104132934d 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/EditContextView.java +++ b/src/android/jar/src/org/qtproject/qt5/android/EditContextView.java @@ -41,6 +41,7 @@ package org.qtproject.qt5.android; import android.content.Context; +import android.text.TextUtils; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; @@ -73,7 +74,7 @@ public class EditContextView extends LinearLayout implements View.OnClickListene m_buttonId = stringId; setText(stringId); setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, - ViewGroup.LayoutParams.WRAP_CONTENT)); + ViewGroup.LayoutParams.WRAP_CONTENT, 1)); setGravity(Gravity.CENTER); setTextColor(getResources().getColor(R.color.widget_edittext_dark)); EditContextView.this.setBackground(getResources().getDrawable(R.drawable.editbox_background_normal)); @@ -81,6 +82,8 @@ public class EditContextView extends LinearLayout implements View.OnClickListene int hPadding = (int)(16 * scale + 0.5f); int vPadding = (int)(8 * scale + 0.5f); setPadding(hPadding, vPadding, hPadding, vPadding); + setSingleLine(); + setEllipsize(TextUtils.TruncateAt.END); setOnClickListener(EditContextView.this); } } -- cgit v1.2.3 From 41aa78856e054ee0d770e375f127dbc18317fbeb Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Fri, 10 May 2019 20:47:33 +0200 Subject: QSharedPointer: fix threadsafety docs Try and explain better the situation around QSharedPointer: it's reentrant, not thread safe. Change-Id: Ief9d28be8ea3fbaa6014cb6b999626db1bab52ca Reviewed-by: Martin Smith Reviewed-by: Thiago Macieira --- src/corelib/tools/qsharedpointer.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp index 95b584e914..b755941b73 100644 --- a/src/corelib/tools/qsharedpointer.cpp +++ b/src/corelib/tools/qsharedpointer.cpp @@ -65,14 +65,19 @@ \section1 Thread-Safety - QSharedPointer and QWeakPointer are thread-safe and operate - atomically on the pointer value. Different threads can also access - the QSharedPointer or QWeakPointer pointing to the same object at - the same time without need for locking mechanisms. - - It should be noted that, while the pointer value can be accessed - in this manner, QSharedPointer and QWeakPointer provide no - guarantee about the object being pointed to. Thread-safety and + QSharedPointer and QWeakPointer are reentrant classes. This means that, in + general, a given QSharedPointer or QWeakPointer object \b{cannot} be + accessed by multiple threads at the same time without synchronization. + + Different QSharedPointer and QWeakPointer objects can safely be accessed + by multiple threads at the same time. This includes the case where they + hold pointers to the same object; the reference counting mechanism + is atomic, and no manual synchronization is required. + + It should be noted that, while the pointer value can be accessed in this + manner (that is, by multiple threads at the same time, without + synchronization), QSharedPointer and QWeakPointer provide no guarantee + about the object being pointed to. The specific thread-safety and reentrancy rules for that object still apply. \section1 Other Pointer Classes -- cgit v1.2.3 From a9246c7132a2c8864d3ae6cebd260bb9ee711fcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 9 May 2019 18:20:16 +0200 Subject: Reset QWidget's winId when backing window surface is destroyed We already reset it though e.g. QWidget::destroy, but if the backing window is destroyed spontaneously or via another API we need to catch that and send a WinIdChange event so clients who pulled out the original winId will not think the pointer is still valid Change-Id: I8556940ee871e81a51f73daeb2064f95bf41371c Fixes: QTBUG-69289 Reviewed-by: Richard Moe Gustavsen --- src/widgets/kernel/qwidget.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 2c84ff7161..53d87c6113 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -9365,6 +9365,12 @@ bool QWidget::event(QEvent *event) d->renderToTextureReallyDirty = 1; #endif break; + case QEvent::PlatformSurface: { + auto surfaceEvent = static_cast(event); + if (surfaceEvent->surfaceEventType() == QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed) + d->setWinId(0); + break; + } #ifndef QT_NO_PROPERTIES case QEvent::DynamicPropertyChange: { const QByteArray &propName = static_cast(event)->propertyName(); -- cgit v1.2.3