From 03a40d3a46b078f6cf516e5a42ef2e11a5366a20 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 27 Jan 2015 16:58:53 +0100 Subject: Revert "Windows: Fix call of ToUnicode" This reverts commit dfe853bff90444edf92a993e391df853780c9e8d. When using cyrillic or other keyboard layouts, standard shortcuts like CTRL-C are still supposed to work as if the US keyboard layout were in effect. Task-number: QTBUG-44021 Task-number: QTBUG-35734 Change-Id: If6cd96a1e03e62900b293f8e304e523460e85810 Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowskeymapper.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp index d781cdbe9c..4b1d1112d5 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.cpp +++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp @@ -537,16 +537,15 @@ static inline int toKeyOrUnicode(int vk, int scancode, unsigned char *kbdBuffer, Q_ASSERT(vk > 0 && vk < 256); int code = 0; QChar unicodeBuffer[5]; - // While key combinations containing alt and ctrl might trigger the third assignment of a key - // (for example "alt+ctrl+q" causes '@' on a German layout), ToUnicode often does not return the - // wanted character if only the ctrl modifier is used. Thus we unset this modifier temporarily - // if it is not used together with alt. - const unsigned char controlState = kbdBuffer[VK_MENU] ? 0 : kbdBuffer[VK_CONTROL]; - if (controlState) - kbdBuffer[VK_CONTROL] = 0; int res = ToUnicode(vk, scancode, kbdBuffer, reinterpret_cast(unicodeBuffer), 5, 0); - if (controlState) + // When Ctrl modifier is used ToUnicode does not return correct values. In order to assign the + // right key the control modifier is removed for just that function if the previous call failed. + if (res == 0 && kbdBuffer[VK_CONTROL]) { + const unsigned char controlState = kbdBuffer[VK_CONTROL]; + kbdBuffer[VK_CONTROL] = 0; + res = ToUnicode(vk, scancode, kbdBuffer, reinterpret_cast(unicodeBuffer), 5, 0); kbdBuffer[VK_CONTROL] = controlState; + } if (res) code = unicodeBuffer[0].toUpper().unicode(); -- cgit v1.2.3 From 4b707d3bde53dd6dd4c01a51c12f096faefbc5b2 Mon Sep 17 00:00:00 2001 From: Andreas Holzammer Date: Fri, 23 Jan 2015 13:50:07 +0100 Subject: WINCE: Fix special case for toplevel It looks like that WindowFromPoint does not return same handle each time, hence he then is in a endless loop. We don't need to look for a child in a loop here for Windows Embedded Compact. Task-number: QTBUG-44073 Change-Id: Ic42d56616b29f293d187111588fde3947c15659c Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowscontext.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index ffa7f82d8e..99ba5463bf 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -675,6 +675,8 @@ static inline bool findPlatformWindowHelper(const POINT &screenPoint, unsigned c #ifndef Q_OS_WINCE const HWND child = ChildWindowFromPointEx(*hwnd, point, cwexFlags); #else +// Under Windows CE we don't use ChildWindowFromPointEx as it's not available +// and ChildWindowFromPoint does not work properly. Q_UNUSED(cwexFlags) const HWND child = WindowFromPoint(point); #endif @@ -683,7 +685,13 @@ static inline bool findPlatformWindowHelper(const POINT &screenPoint, unsigned c if (QWindowsWindow *window = context->findPlatformWindow(child)) { *result = window; *hwnd = child; +#ifndef Q_OS_WINCE return true; +#else +// WindowFromPoint does not return same handle in two sequential calls, which leads +// to an endless loop, but calling WindowFromPoint once is good enough. + return false; +#endif } #ifndef Q_OS_WINCE // Does not have WS_EX_TRANSPARENT . // QTBUG-40555: despite CWP_SKIPINVISIBLE, it is possible to hit on invisible -- cgit v1.2.3 From 8172fe46472614d4ecf6fce03ae5c5f706820cd7 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 22 Jan 2015 08:24:34 -0800 Subject: Correct the version of ICC that has the constexpr bug fixed 01fc82e3574614762d2ce061dd45ce4995c79e7f updated the code for ICC 15, but it needs to be 15.0.1 Change-Id: Iba8d819ab9174d9dac07ffff13bbc26b9be46d53 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/global/qcompilerdetection.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 3f813e163b..7be4ed8bef 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -557,7 +557,10 @@ # define Q_COMPILER_UNRESTRICTED_UNIONS # endif # if __INTEL_COMPILER >= 1500 -# define Q_COMPILER_CONSTEXPR +# if __INTEL_COMPILER * 100 + __INTEL_COMPILER_UPDATE >= 150001 +// the bug mentioned above is fixed in 15.0.1 +# define Q_COMPILER_CONSTEXPR +# endif # define Q_COMPILER_ALIGNAS # define Q_COMPILER_ALIGNOF # define Q_COMPILER_INHERITING_CONSTRUCTORS -- cgit v1.2.3 From b9ae324dc9c815c2326803da0a3d0414cf7a2903 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 22 Jan 2015 15:46:36 +0100 Subject: fix fallback architecture for MSVC Use x86 for a 32 bit build of qmake and x86_64 for 64 bit. This is needed for shells that do not set VCINSTALLDIR. Change-Id: I0843c1a590161669530b99f45ab59d523e6596c3 Reviewed-by: Friedemann Kleint Reviewed-by: Oswald Buddenhagen --- qmake/library/qmakeevaluator.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp index fe089c1059..9b5291a08e 100644 --- a/qmake/library/qmakeevaluator.cpp +++ b/qmake/library/qmakeevaluator.cpp @@ -962,7 +962,11 @@ static ProString msvcBinDirToQMakeArch(QString subdir) static ProString defaultMsvcArchitecture() { +#if defined(Q_OS_WIN64) + return ProString("x86_64"); +#else return ProString("x86"); +#endif } static ProString msvcArchitecture(const QString &vcInstallDir, const QString &pathVar) -- cgit v1.2.3 From 012a7ab91212db105fc43db9aa89b92d70052f1b Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Thu, 29 Jan 2015 13:33:30 +0100 Subject: WinRT: Fix access to style hint instead of theme hint You need to specify explicitly the styleHint enum instead of the theming one, which is where we want to forward to. This caused all clicks to be ignored in case there is a listener to pressAndHold as the hold period is reduced to 0 milliseconds. Task-number: QTBUG-44196 Change-Id: I30d1771b91b5fa358e896e8441ade965543d4613 Reviewed-by: Friedemann Kleint Reviewed-by: Andrew Knight --- src/plugins/platforms/winrt/qwinrttheme.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/winrt/qwinrttheme.cpp b/src/plugins/platforms/winrt/qwinrttheme.cpp index f64b47960a..e2857683f8 100644 --- a/src/plugins/platforms/winrt/qwinrttheme.cpp +++ b/src/plugins/platforms/winrt/qwinrttheme.cpp @@ -232,7 +232,7 @@ QVariant QWinRTTheme::styleHint(QPlatformIntegration::StyleHint hint) return false; case QPlatformIntegration::ShowIsMaximized: return false; - case MousePressAndHoldInterval: + case QPlatformIntegration::MousePressAndHoldInterval: return defaultThemeHint(MousePressAndHoldInterval); default: break; -- cgit v1.2.3 From 8e0f56280ab6fd869faf1650edd454883f4d035f Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 27 Jan 2015 16:36:10 +0100 Subject: Fix Qt over VNC with broken VisualInfo It appears some VNC servers reports incorrect masks in their visuals. This patch recognizes this unlikely set of masks and interprets it as RGB16 which VNC expects. Task-number: QTBUG-44147 Change-Id: Ia374edcd5f0a5ce0188157ac1d328f888cfa260c Reviewed-by: Shawn Rutledge Reviewed-by: Laszlo Agocs --- src/plugins/platforms/xcb/qxcbwindow.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 4fd71f1635..00942787d9 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -215,6 +215,18 @@ static inline QImage::Format imageFormatForVisual(int depth, quint32 red_mask, q break; } qWarning("Unsupported screen format: depth: %d, red_mask: %x, blue_mask: %x", depth, red_mask, blue_mask); + + switch (depth) { + case 24: + qWarning("Using RGB32 fallback, if this works your X11 server is reporting a bad screen format."); + return QImage::Format_RGB32; + case 16: + qWarning("Using RGB16 fallback, if this works your X11 server is reporting a bad screen format."); + return QImage::Format_RGB16; + default: + break; + } + return QImage::Format_Invalid; } -- cgit v1.2.3 From 5f6bbce4beb32bc6bc1e06f92cde56c48f946558 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 26 Jan 2015 15:21:12 +0100 Subject: Fix memory leak in qSetMessagePattern We were leaking memory in case setPattern was called multiple times Task-number: QTBUG-43893 Change-Id: Icd9c214edea064aeaeb6f92a9c62836238ccd344 Reviewed-by: Marc Mutz --- src/corelib/global/qlogging.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 50d35a6d84..86ba082398 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -866,7 +866,7 @@ QMessagePattern::QMessagePattern() QMessagePattern::~QMessagePattern() { - for (int i = 0; literals[i] != 0; ++i) + for (int i = 0; literals[i]; ++i) delete [] literals[i]; delete [] literals; literals = 0; @@ -876,8 +876,12 @@ QMessagePattern::~QMessagePattern() void QMessagePattern::setPattern(const QString &pattern) { + if (literals) { + for (int i = 0; literals[i]; ++i) + delete [] literals[i]; + delete [] literals; + } delete [] tokens; - delete [] literals; // scanner QList lexemes; -- cgit v1.2.3 From 8c3ae221e60ae9b15ed5b942c18a52c2c0f3014f Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Fri, 16 Jan 2015 11:29:54 +0100 Subject: WinRT: Gracefully exit an application While it is not recommended by Microsoft to manually exit an application, currently applications just hang when exiting main(). Instead when QCoreApplication::exit() is called use the CoreApplication to properly invoke native Exit() and let the application completely shut down. Add a warning to notify developer about this non-standard behavior, as usually the system is supposed to take care of suspending and closing. Certification still passes for Windows RT and Windows Phone. Task-number: QTBUG-43862 Change-Id: Ia34443ea75daaaeca0bee2a0c9fcc568c0659262 Reviewed-by: Friedemann Kleint --- src/corelib/kernel/qcoreapplication.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index ca3d92bad1..6b0ebf8b8b 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -81,6 +81,11 @@ #ifdef Q_OS_WIN # ifdef Q_OS_WINRT # include "qeventdispatcher_winrt_p.h" +# include "qfunctions_winrt.h" +# include +# include + using namespace ABI::Windows::ApplicationModel::Core; + using namespace Microsoft::WRL; # else # include "qeventdispatcher_win_p.h" # endif @@ -1221,6 +1226,19 @@ void QCoreApplication::exit(int returnCode) QEventLoop *eventLoop = data->eventLoops.at(i); eventLoop->exit(returnCode); } +#ifdef Q_OS_WINRT + qWarning("QCoreApplication::exit: It is not recommended to explicitly exit an application on Windows Store Apps"); + ComPtr app; + HRESULT hr = RoGetActivationFactory(Wrappers::HString::MakeReference(RuntimeClass_Windows_ApplicationModel_Core_CoreApplication).Get(), + IID_PPV_ARGS(&app)); + RETURN_VOID_IF_FAILED("Could not acquire ICoreApplication object"); + ComPtr appExit; + + hr = app.As(&appExit); + RETURN_VOID_IF_FAILED("Could not acquire ICoreApplicationExit object"); + hr = appExit->Exit(); + RETURN_VOID_IF_FAILED("Could not exit application"); +#endif // Q_OS_WINRT } /***************************************************************************** -- cgit v1.2.3 From 434868e9d3cab37b304d7511cd62616d7cd6e032 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 4 Feb 2015 13:54:07 +0100 Subject: REG: Fix misplaced outline drawn text with native rendering MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change c238d34137ffe80d30933733a12aa2893b9631c2 was a refactoring which slightly changed behavior. In the case of fetching the alpha map's bounding box, before we would call loadGlyph() even for the case of outline drawing, as the correct bounding rect is still needed for this case. In loadGlyphFor() however, 0 was always returned for this case, as it was only used for populating the cache. The simple fix for this is to add a bool to loadGlyphFor() which adapts the original behavior when set, similar to the fetchMetricsOnly bool in the loadGlyph() functions. Change-Id: I76296c8aaeddbdae9e4c27ed2b30b7d59ff0843b Task-number: QTBUG-44273 Reviewed-by: Konstantin Ritt Reviewed-by: Pasi Petäjäjärvi Reviewed-by: Simon Hausmann --- src/gui/text/qfontengine_ft.cpp | 7 ++++--- src/gui/text/qfontengine_ft_p.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 792bfadb5e..25156bf1e1 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -1727,7 +1727,7 @@ glyph_metrics_t QFontEngineFT::boundingBox(glyph_t glyph, const QTransform &matr glyph_metrics_t QFontEngineFT::alphaMapBoundingBox(glyph_t glyph, QFixed subPixelPosition, const QTransform &matrix, QFontEngine::GlyphFormat format) { - Glyph *g = loadGlyphFor(glyph, subPixelPosition, format, matrix); + Glyph *g = loadGlyphFor(glyph, subPixelPosition, format, matrix, true); glyph_metrics_t overall; if (g) { @@ -1870,7 +1870,8 @@ void QFontEngineFT::unlockAlphaMapForGlyph() QFontEngineFT::Glyph *QFontEngineFT::loadGlyphFor(glyph_t g, QFixed subPixelPosition, GlyphFormat format, - const QTransform &t) + const QTransform &t, + bool fetchBoundingBox) { FT_Face face = 0; QGlyphSet *glyphSet = 0; @@ -1883,7 +1884,7 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyphFor(glyph_t g, Q_ASSERT(glyphSet != 0); } - if (glyphSet != 0 && glyphSet->outline_drawing) + if (glyphSet != 0 && glyphSet->outline_drawing && !fetchBoundingBox) return 0; Glyph *glyph = glyphSet != 0 ? glyphSet->getGlyph(g, subPixelPosition) : 0; diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h index 383902c784..b40893c445 100644 --- a/src/gui/text/qfontengine_ft_p.h +++ b/src/gui/text/qfontengine_ft_p.h @@ -266,7 +266,7 @@ private: inline Glyph *loadGlyph(uint glyph, QFixed subPixelPosition, GlyphFormat format = Format_None, bool fetchMetricsOnly = false) const { return loadGlyph(cacheEnabled ? &defaultGlyphSet : 0, glyph, subPixelPosition, format, fetchMetricsOnly); } Glyph *loadGlyph(QGlyphSet *set, uint glyph, QFixed subPixelPosition, GlyphFormat = Format_None, bool fetchMetricsOnly = false) const; - Glyph *loadGlyphFor(glyph_t g, QFixed subPixelPosition, GlyphFormat format, const QTransform &t); + Glyph *loadGlyphFor(glyph_t g, QFixed subPixelPosition, GlyphFormat format, const QTransform &t, bool fetchBoundingBox = false); QGlyphSet *loadTransformedGlyphSet(const QTransform &matrix); -- cgit v1.2.3 From 447ff9a9f32826654f9df9020610c767cb8c9b15 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 14 Jan 2015 11:02:28 -0800 Subject: Fix compilation with Apple Clang 425 This version was based on Clang mainline between releases 3.1 and 3.2, which means it has part of 3.2 features but not all. One of the missing features is __builtin_bswap16. Cherry-picked from ec9bc843d8a5c18459f3669c6e22acac2077df67 on 5.4 Change-Id: Ic5d393bfd36e48a193fcffff13b95664c7f664de Reviewed-by: Thiago Macieira Reviewed-by: Shawn Rutledge --- src/corelib/global/qendian.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qendian.h b/src/corelib/global/qendian.h index 7c643f7592..0e383c18d2 100644 --- a/src/corelib/global/qendian.h +++ b/src/corelib/global/qendian.h @@ -272,9 +272,15 @@ template <> inline qint8 qFromBigEndian(const uchar *src) */ template T qbswap(T source); +#ifdef __has_builtin +# define QT_HAS_BUILTIN(x) __has_builtin(x) +#else +# define QT_HAS_BUILTIN(x) 0 +#endif + // GCC 4.3 implemented all the intrinsics, but the 16-bit one only got implemented in 4.8; // Clang 2.6 implemented the 32- and 64-bit but waited until 3.2 to implement the 16-bit one -#if (defined(Q_CC_GNU) && Q_CC_GNU >= 403) || (defined(Q_CC_CLANG) && Q_CC_CLANG >= 206) +#if (defined(Q_CC_GNU) && Q_CC_GNU >= 403) || QT_HAS_BUILTIN(__builtin_bswap32) template <> inline quint64 qbswap(quint64 source) { return __builtin_bswap64(source); @@ -306,7 +312,7 @@ template <> inline quint32 qbswap(quint32 source) | ((source & 0xff000000) >> 24); } #endif // GCC & Clang intrinsics -#if (defined(Q_CC_GNU) && Q_CC_GNU >= 408) || (defined(Q_CC_CLANG) && Q_CC_CLANG >= 302) +#if (defined(Q_CC_GNU) && Q_CC_GNU >= 408) || QT_HAS_BUILTIN(__builtin_bswap16) template <> inline quint16 qbswap(quint16 source) { return __builtin_bswap16(source); @@ -320,6 +326,8 @@ template <> inline quint16 qbswap(quint16 source) } #endif // GCC & Clang intrinsics +#undef QT_HAS_BUILTIN + // signed specializations template <> inline qint64 qbswap(qint64 source) { -- cgit v1.2.3 From e024eb55c6eb4582ce22aadec440ada3c9deaab9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 9 Feb 2015 12:37:12 -0800 Subject: Remove #define inline from Harfbuzz-NG This code is C++ only. There isn't a single C++ compiler that fails to understand the "inline" keyword, since it's required by C++98. Any compiler older than C++98 is likely to choke on the template usage further down, so this isn't necessary. Moreover, the C++ standard says you cannot define macros. [lib.macro.names] says "Nor shall such a translation unit define macros for names lexically identical to keywords." -- technically, it's a promise that the Standard Library headers won't do it, the wording means that the entire translation unit won't do it, which implies no source can do it. MSVC complains about it: fatal error C1189: #error : The C++ Standard Library forbids macroizing keywords. Enable warning C4005 to find the forbidden macro. Change-Id: Ic2a0a03a0af47386e34bb698454a2040ef3f6a9d Reviewed-by: Simon Hausmann Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/3rdparty/harfbuzz-ng/src/hb-private.hh | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/3rdparty/harfbuzz-ng/src/hb-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-private.hh index 3f70d74c26..3a4cf611f0 100644 --- a/src/3rdparty/harfbuzz-ng/src/hb-private.hh +++ b/src/3rdparty/harfbuzz-ng/src/hb-private.hh @@ -98,16 +98,6 @@ #define snprintf _snprintf #endif -#ifdef _MSC_VER -#undef inline -#define inline __inline -#endif - -#ifdef __STRICT_ANSI__ -#undef inline -#define inline __inline__ -#endif - #if __GNUC__ >= 3 #define HB_FUNC __PRETTY_FUNCTION__ #elif defined(_MSC_VER) -- cgit v1.2.3 From d6ce94ae6367337ade2c590f182b973e2bcfa98c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 1 Feb 2015 14:31:55 -0200 Subject: Force Harfbuzz-NG to use the Qt atomics when built inside Qt For most cases, the GCC/Intel atomics (__sync functions) are fine, but there are some systems for which libgcc is incorrectly built (QNX 6.5.0). Additionally, this will allow Harfbuzz-NG to be supported in exactly the same systems as Qt itself. Task-number: QTBUG-43850 Change-Id: Ib53f57f70d4ad46863c45e74d60b0eb45ba9bd02 Reviewed-by: Lars Knoll Reviewed-by: Marc Mutz --- src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro | 4 ++-- src/3rdparty/harfbuzz-ng/src/hb-atomic-private.hh | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro index 6b51d9679a..a8885d71df 100644 --- a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro +++ b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro @@ -7,14 +7,14 @@ CONFIG += \ load(qt_helper_lib) -DEFINES += HAVE_OT HB_NO_UNICODE_FUNCS HB_DISABLE_DEPRECATED +DEFINES += HAVE_OT HAVE_QT5_ATOMICS HB_NO_UNICODE_FUNCS HB_DISABLE_DEPRECATED # platform/compiler specific definitions DEFINES += HAVE_ATEXIT -gcc: DEFINES += HAVE_INTEL_ATOMIC_PRIMITIVES unix: DEFINES += HAVE_PTHREAD HAVE_SCHED_H HAVE_SCHED_YIELD INCLUDEPATH += $$PWD/include +INCLUDEPATH += $$OUT_PWD/../../../include SOURCES += \ $$PWD/src/hb-blob.cc \ diff --git a/src/3rdparty/harfbuzz-ng/src/hb-atomic-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-atomic-private.hh index 60cbcf91be..f15ef09799 100644 --- a/src/3rdparty/harfbuzz-ng/src/hb-atomic-private.hh +++ b/src/3rdparty/harfbuzz-ng/src/hb-atomic-private.hh @@ -41,6 +41,25 @@ #if 0 +#elif !defined(HB_NO_MT) && defined(HAVE_QT5_ATOMICS) +#include + +QT_USE_NAMESPACE + +namespace { +// We need to cast hb_atomic_int_t to QAtomicInt and pointers to +// QAtomicPointer instead of using QAtomicOps, otherwise we get a failed +// overload resolution of the template arguments for testAndSetOrdered. +template QAtomicPointer *makeAtomicPointer(T * const &ptr) +{ + return reinterpret_cast *>(const_cast(&ptr)); +} +} + +typedef int hb_atomic_int_t; +#define hb_atomic_int_add(AI, V) reinterpret_cast(AI).fetchAndAddOrdered(V) +#define hb_atomic_ptr_get(P) makeAtomicPointer(*P)->loadAcquire() +#define hb_atomic_ptr_cmpexch(P,O,N) makeAtomicPointer(*P)->testAndSetOrdered((O), (N)) #elif !defined(HB_NO_MT) && (defined(_WIN32) || defined(__CYGWIN__)) -- cgit v1.2.3