Merge remote-tracking branch 'origin/5.4.1' into 5.4

Change-Id: I9d668a655b548feab43e9d4b03e2437bdff76437
This commit is contained in:
Frederik Gladhorn 2015-02-10 09:54:23 +01:00
commit 51ce5b4829
13 changed files with 86 additions and 28 deletions

View File

@ -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)

View File

@ -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 \

View File

@ -41,6 +41,25 @@
#if 0
#elif !defined(HB_NO_MT) && defined(HAVE_QT5_ATOMICS)
#include <QtCore/qatomic.h>
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 <typename T> QAtomicPointer<T> *makeAtomicPointer(T * const &ptr)
{
return reinterpret_cast<QAtomicPointer<T> *>(const_cast<T **>(&ptr));
}
}
typedef int hb_atomic_int_t;
#define hb_atomic_int_add(AI, V) reinterpret_cast<QAtomicInt &>(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__))

View File

@ -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)

View File

@ -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

View File

@ -873,7 +873,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;
@ -883,8 +883,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<QString> lexemes;

View File

@ -81,6 +81,11 @@
#ifdef Q_OS_WIN
# ifdef Q_OS_WINRT
# include "qeventdispatcher_winrt_p.h"
# include "qfunctions_winrt.h"
# include <wrl.h>
# include <Windows.ApplicationModel.core.h>
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<ICoreApplication> 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<ICoreApplicationExit> 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
}
/*****************************************************************************

View File

@ -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;

View File

@ -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);

View File

@ -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

View File

@ -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<LPWSTR>(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<LPWSTR>(unicodeBuffer), 5, 0);
kbdBuffer[VK_CONTROL] = controlState;
}
if (res)
code = unicodeBuffer[0].toUpper().unicode();

View File

@ -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;

View File

@ -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;
}