Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev

This commit is contained in:
Friedemann Kleint 2014-05-14 18:43:38 +02:00 committed by The Qt Project
commit 70cd276db0
57 changed files with 369 additions and 270 deletions

70
dist/changes-5.3.0 vendored
View File

@ -91,6 +91,10 @@ QtCore
- QLibraryInfo provides information on how Qt was built.
- Added class QMarginsF to support handling margins with floating-point
values.
- The setSharable() and isSharable() functions in Qt containers has
been deprecated and will be removed in Qt 6. New applications should
not use this feature, while old applications that may be using this
(undocumented) feature should port away from it.
- Atomic support:
* Added more operations to the atomic classes, including operator T(),
@ -222,6 +226,9 @@ QtGui
EGL
- [QTBUG-36993] Native (that is, not distance field based) text
rendering is now functional on OpenGL 3.2+ core profiles too.
- The function QOpenGLShaderProgram::create() has been added. It is can
be used to force immediate allocation of the program's id.
- QFont::setRawName() and QFont::rawName() were deprecated.
- Accessibility:
* [QTBUG-37204] Implemented text attributes to enable VoiceOver to read
@ -285,8 +292,6 @@ QtNetwork
QtPrintSupport
--------------
- [QTBUG-29663] Made the Qt buildsystem automatically include the
necessary plugins so that static applications can print.
- CUPS 1.4 is now required for print support on Linux and other *nix
platforms.
@ -309,19 +314,29 @@ QtPrintSupport
QtSql
-----
- QSqlQuery::isNull(field) now correctly returns true for "no such field".
- QSqlQuery::isNull(fieldname) is a new overload.
- [QTBUG-12186] Fixed the order of values with positional binding in a
QSqlQuery
- QSqlError:
* Now handles alphanumeric error codes. Used by QPSQL. Old numeric
code is deprecated.
- QSqlQuery:
* isNull(field) now correctly returns true for "no such field".
* isNull(fieldname) is a new overload.
* [QTBUG-12186] Fixed order of values with positional binding.
- QSqlTableModel:
* [QTBUG-38509] Fix failure to refresh in selectRow()
- QIBASE:
* [QTBUG-37508] Fix QByteArray memory corruption in QIBaseDriver::open().
* Support for prepared queries in numRowsAffected().
- QODBC:
* [QTBUG-37831] Fix access of tmpStorage in QODBCResult::exec().
- QSQLITE:
* Creating temporary databases is now possible
* Empty database name now opens in-memory database.
- QSqlError
* Now handles alphanumeric error codes. Used by QPSQL. Old numeric
code is deprecated.
QtTest
------
@ -430,8 +445,6 @@ QtWidgets
Android
-------
- [QTBUG-34781] Fixed regression in "make install" on library projects on
Android so they can be used inside subdirs projects again.
- [QTBUG-36074] Fixed crash on populating large combo boxes or menus.
- [QTBUG-36528] Fixed QDir::entryList() for assets scheme to no longer
skip the first file in the directory.
@ -513,3 +526,36 @@ qdbus
trying to display remote interfaces that had complex types without a
matching base Qt type.
configure & build system
------------------------
- Configure's -separate-debug-info option is now checked more strictly.
- Added configure [-no]-imf options for QNX.
- Added unsupported linux-libc++-clang and freebsd-clang mkspecs.
- Numerous configuration-specific build fixes.
qmake
-----
- QTPLUGIN will now be automatically populated with the plugins that are
typically needed by the used Qt modules.
- qmake will not create dependencies on system headers any more, provided it
detects the system include paths.
- Added DISTCLEAN_DEPS variable analogous to CLEAN_DEPS.
- Added function $$getenv() which is equivalent to using the $$() expansion,
but permits various qmake meta characters in the name.
- [MacOS] QMAKE_BUNDLEID_PREFIX is now recognized by the Makefile generator.
- [QTBUG-29939][MSVC2012+] Added Windows XP target support.
- [QTBUG-35570][VS2012+] Fixed bad ProgramDataBaseFileName.
- [QTBUG-38066][VS2010+] Fixed version suffix being appended to applications.
- [QTBUG-31185][VS] The PlatformToolset environment variable is now honored.
- [QTBUG-34781][Android] Fixed regression in "make install" on library projects
so they can be used inside subdirs projects again.
- [QTBUG-37113] Fixed creation of excessively long relative paths, which
would lead to errors with MSVC. Note that this does not fix all such cases.
qlalr
-----
- (Re-)added to Qt base. Added corresponding qmake feature file.
Caveat: the generated files are not scanned for dependencies.

View File

@ -39,15 +39,18 @@ manifestmeta.highlighted.names = "QtQuick/Qt Quick Demo - Same Game" \
"QtQuick/Qt Quick Demo - Tweet Search" \
"QtQuick/Qt Quick Demo - Maroon*" \
"QtQuick/Qt Quick Demo - Calqlatr" \
"QtQuick/Qt Quick Particles Examples - Emitters" \
"QtQuick/Qt Quick Demo - StocQt" \
"QtQuick/Qt Quick Demo - Clocks" \
"QtQuick/Qt Quick Examples - Shader Effects" \
"QtWebKitExamples/Fancy Browser" \
"QtWebKitExamples/Flickr View Example" \
"QtWebKitExamples/YouTube View Example" \
"QtQuick/Qt Quick Examples - Text" \
"QtQuick/Qt Quick Examples - Window and Screen" \
"QtQuickControls/Qt Quick Controls - Gallery" \
"QtQuickControls/Qt Quick Controls - Text Editor Example" \
"QtQuickControls/Qt Quick Controls - Table View Example" \
"QtWidgets/Application Example"
"QtQuickControls/Qt Quick Controls - Calendar Example" \
"QtQuickDialogs/Qt Quick System Dialog Examples" \
"QtWidgets/Application Example" \
"QtWinExtras/Quick Player"
manifestmeta.highlighted.attributes = isHighlighted:true

View File

@ -137,7 +137,8 @@ bootstrap { #Qt code
unix {
SOURCES += qfilesystemengine_unix.cpp qfilesystemiterator_unix.cpp qfsfileengine_unix.cpp
mac {
SOURCES += qcore_mac.cpp qsettings_mac.cpp qlocale_mac.mm
SOURCES += qcore_mac.cpp qsettings_mac.cpp
OBJECTIVE_SOURCES += qlocale_mac.mm
LIBS += -framework ApplicationServices
} else {
SOURCES += qlocale_unix.cpp

View File

@ -257,7 +257,7 @@ TextureStorage11_2D::TextureStorage11_2D(Renderer *renderer, int levels, GLenum
D3D11_TEXTURE2D_DESC desc;
desc.Width = width; // Compressed texture size constraints?
desc.Height = height;
desc.MipLevels = (levels > 0) ? levels + mLodOffset : 0;
desc.MipLevels = mRenderer->getFeatureLevel() >= D3D_FEATURE_LEVEL_10_0 ? ((levels > 0) ? levels + mLodOffset : 0) : 1;
desc.ArraySize = 1;
desc.Format = mTextureFormat;
desc.SampleDesc.Count = 1;

View File

@ -0,0 +1,31 @@
From 9632c57033b514bfb10a0dfa7ba51ec27a944616 Mon Sep 17 00:00:00 2001
From: Andrew Knight <andrew.knight@digia.com>
Date: Tue, 6 May 2014 13:35:14 +0300
Subject: [PATCH] ANGLE D3D11: Don't use mipmaps in level 9 textures
As the mipmaps levels aren't being generated on level 9, they shouldn't
be used. Fall back to multisampled textures instead (which is the
behavior for non-power-of-two textures anyway). This fixes an issue in
which textured polygons (e.g. QML Images) turn black when scaled down.
Change-Id: I648b8be473dc38f4e1b26724cbaff610e586fdbd
---
src/3rdparty/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp
index fdfbe52..0c981ac 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp
@@ -257,7 +257,7 @@ TextureStorage11_2D::TextureStorage11_2D(Renderer *renderer, int levels, GLenum
D3D11_TEXTURE2D_DESC desc;
desc.Width = width; // Compressed texture size constraints?
desc.Height = height;
- desc.MipLevels = (levels > 0) ? levels + mLodOffset : 0;
+ desc.MipLevels = mRenderer->getFeatureLevel() >= D3D_FEATURE_LEVEL_10_0 ? ((levels > 0) ? levels + mLodOffset : 0) : 1;
desc.ArraySize = 1;
desc.Format = mTextureFormat;
desc.SampleDesc.Count = 1;
--
1.9.0.msysgit.0

View File

@ -218,25 +218,25 @@ QTemporaryDir::QTemporaryDir()
}
/*!
Constructs a QTemporaryFile with a template name of \a templateName.
Constructs a QTemporaryDir with a template of \a templatePath.
If \a templateName is a relative path, the path will be relative to the
If \a templatePath is a relative path, the path will be relative to the
current working directory. You can use QDir::tempPath() to construct \a
templateName if you want use the system's temporary directory.
templatePath if you want use the system's temporary directory.
If the \a templateName ends with XXXXXX it will be used as the dynamic portion
If the \a templatePath ends with XXXXXX it will be used as the dynamic portion
of the directory name, otherwise it will be appended.
Unlike QTemporaryFile, XXXXXX in the middle of the template string is not supported.
\sa QDir::tempPath()
*/
QTemporaryDir::QTemporaryDir(const QString &templateName)
QTemporaryDir::QTemporaryDir(const QString &templatePath)
: d_ptr(new QTemporaryDirPrivate)
{
if (templateName.isEmpty())
if (templatePath.isEmpty())
d_ptr->create(defaultTemplateName());
else
d_ptr->create(templateName);
d_ptr->create(templatePath);
}
/*!

View File

@ -569,7 +569,9 @@ void QTextStreamPrivate::flushWriteBuffer()
#endif
// convert from unicode to raw data
QByteArray data = codec->fromUnicode(writeBuffer.data(), writeBuffer.size(), &writeConverterState);
// codec might be null if we're already inside global destructors (QTestCodec::codecForLocale returned null)
QByteArray data = Q_LIKELY(codec) ? codec->fromUnicode(writeBuffer.data(), writeBuffer.size(), &writeConverterState)
: writeBuffer.toLatin1();
#else
QByteArray data = writeBuffer.toLocal8Bit();
#endif

View File

@ -164,11 +164,17 @@ vxworks {
blackberry {
SOURCES += \
kernel/qeventdispatcher_blackberry.cpp \
kernel/qeventdispatcher_blackberry.cpp
HEADERS += \
kernel/qeventdispatcher_blackberry_p.h
}
qqnx_pps {
LIBS_PRIVATE += -lpps
SOURCES += \
kernel/qppsattribute.cpp \
kernel/qppsobject.cpp
HEADERS += \
kernel/qeventdispatcher_blackberry_p.h \
kernel/qppsattribute_p.h \
kernel/qppsattributeprivate_p.h \
kernel/qppsobject_p.h \

View File

@ -253,7 +253,7 @@ static QString toOffsetString(Qt::DateFormat format, int offset)
return result.arg(offset >= 0 ? QLatin1Char('+') : QLatin1Char('-'))
.arg(qAbs(offset) / SECS_PER_HOUR, 2, 10, QLatin1Char('0'))
.arg((offset / 60) % 60, 2, 10, QLatin1Char('0'));
.arg((qAbs(offset) / 60) % 60, 2, 10, QLatin1Char('0'));
}
// Parse offset in [+-]HH[:]MM format
@ -265,17 +265,24 @@ static int fromOffsetString(const QString &offsetString, bool *valid)
if (size < 2 || size > 6)
return 0;
// sign will be +1 for a positive and -1 for a negative offset
int sign;
// First char must be + or -
const QChar sign = offsetString.at(0);
if (sign != QLatin1Char('+') && sign != QLatin1Char('-'))
const QChar signChar = offsetString.at(0);
if (signChar == QLatin1Char('+'))
sign = 1;
else if (signChar == QLatin1Char('-'))
sign = -1;
else
return 0;
// Split the hour and minute parts
QStringList parts = offsetString.split(QLatin1Char(':'));
QStringList parts = offsetString.mid(1).split(QLatin1Char(':'));
if (parts.count() == 1) {
// [+-]HHMM format
parts.append(parts.at(0).mid(3));
parts[0] = parts.at(0).left(3);
parts.append(parts.at(0).mid(2));
parts[0] = parts.at(0).left(2);
}
bool ok = false;
@ -288,7 +295,7 @@ static int fromOffsetString(const QString &offsetString, bool *valid)
return 0;
*valid = true;
return ((hour * 60) + minute) * 60;
return sign * ((hour * 60) + minute) * 60;
}
/*****************************************************************************

View File

@ -466,7 +466,14 @@ static QWindowGeometrySpecification windowGeometrySpecification;
\section1 Supported Command Line Options
All Qt programs automatically support the following command line options:
All Qt programs automatically support a set of command-line options that
allow modifying the way Qt will interact with the windowing system. Some of
the options are also accessible via environment variables, which are the
preferred form if the application can launch GUI sub-processes or other
applications (environment variables will be inherited by child processes).
When in doubt, use the environment variables.
The options currently supported are the following:
\list
\li \c{-platform} \e {platformName[:options]}, specifies the
@ -489,19 +496,22 @@ static QWindowGeometrySpecification windowGeometrySpecification;
\li \c {-qwindowgeometry} \e geometry, specifies window geometry for
the main window using the X11-syntax. For example:
\c {-qwindowgeometry 100x100+50+50}
\li \c {-qwindowicon}, sets the default window icon
\li \c {-qwindowtitle}, sets the title of the first window
\li \c{-reverse}, sets the application's layout direction to
Qt::RightToLeft
Qt::RightToLeft. This option is intended to aid debugging and should
not be used in production. The default value is automatically detected
from the user's locale (see also QLocale::textDirection()).
\li \c{-session} \e session, restores the application from an earlier
\l{Session Management}{session}.
\li -qwindowgeometry, sets the geometry of the first window
\li -qwindowtitle, sets the title of the first window
\li -qwindowicon, sets the default window icon
\endlist
The following standard command line options are available for X11:
\list
\li \c {-display} \e {hostname:screen_number}, switches displays on X11.
Overrides the \c DISPLAY environment variable.
\li \c {-geometry} \e geometry, same as \c {-qwindowgeometry}.
\endlist

View File

@ -1405,7 +1405,8 @@ void QOpenGLSharedResourceGuard::freeResource(QOpenGLContext *context)
QOpenGLMultiGroupSharedResource instance.
*/
QOpenGLMultiGroupSharedResource::QOpenGLMultiGroupSharedResource()
: active(0)
: active(0),
m_mutex(QMutex::Recursive)
{
#ifdef QT_GL_CONTEXT_RESOURCE_DEBUG
qDebug("Creating context group resource object %p.", this);

View File

@ -171,7 +171,9 @@ public:
template <typename T>
T *value(QOpenGLContext *context) {
QOpenGLContextGroup *group = context->shareGroup();
QMutexLocker locker(&group->d_func()->m_mutex);
// Have to use our own mutex here, not the group's, since
// m_groups has to be protected too against any concurrent access.
QMutexLocker locker(&m_mutex);
T *resource = static_cast<T *>(group->d_func()->m_resources.value(this, 0));
if (!resource) {
resource = new T(context);
@ -183,6 +185,7 @@ public:
private:
QAtomicInt active;
QList<QOpenGLContextGroup *> m_groups;
QMutex m_mutex;
};
class QPaintEngineEx;

View File

@ -133,17 +133,19 @@ typedef GLfloat GLdouble;
# endif // Q_OS_MAC
#endif // QT_OPENGL_ES_2
// Desktops, apart from Mac OS X prior to 10.7 can support OpenGL 3
// and desktops apart from Mac can support OpenGL 4
// Desktops, apart from Mac OS X prior to 10.7 can support OpenGL 3.
// Desktops, apart from Mac OS X prior to 10.9 can support OpenGL 4.
#if !defined(QT_OPENGL_ES_2)
# if !defined(Q_OS_MAC) || (defined(Q_OS_MAC) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7)
# define QT_OPENGL_3
# define QT_OPENGL_3_2
# endif
#if !defined(Q_OS_MAC)
# if !defined(Q_OS_MAC) || (defined(Q_OS_MAC) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9)
# define QT_OPENGL_4
# endif
# if !defined(Q_OS_MAC)
# define QT_OPENGL_4_3
#endif
# endif
#endif
QT_BEGIN_NAMESPACE

View File

@ -408,41 +408,14 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed
#endif
funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, fmt, GL_UNSIGNED_BYTE, mask.bits());
} else {
// glTexSubImage2D() might cause some garbage to appear in the texture if the mask width is
// not a multiple of four bytes. The bug appeared on a computer with 32-bit Windows Vista
// and nVidia GeForce 8500GT. GL_UNPACK_ALIGNMENT is set to four bytes, 'mask' has a
// multiple of four bytes per line, and most of the glyph shows up correctly in the
// texture, which makes me think that this is a driver bug.
// One workaround is to make sure the mask width is a multiple of four bytes, for instance
// by converting it to a format with four bytes per pixel. Another is to copy one line at a
// time.
#if 0
if (!ctx->d_func()->workaround_brokenAlphaTexSubImage_init) {
// don't know which driver versions exhibit this bug, so be conservative for now
const QByteArray versionString(reinterpret_cast<const char*>(glGetString(GL_VERSION)));
glctx->d_func()->workaround_brokenAlphaTexSubImage = versionString.indexOf("NVIDIA") >= 0;
glctx->d_func()->workaround_brokenAlphaTexSubImage_init = true;
}
#endif
#if 0
if (ctx->d_func()->workaround_brokenAlphaTexSubImage) {
for (int i = 0; i < maskHeight; ++i)
funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y + i, maskWidth, 1, GL_ALPHA, GL_UNSIGNED_BYTE, mask.scanLine(i));
} else {
#endif
// The scanlines in mask are 32-bit aligned, even for mono or 8-bit formats. This
// is good because it matches the default of 4 bytes for GL_UNPACK_ALIGNMENT.
#if !defined(QT_OPENGL_ES_2)
const GLenum format = isCoreProfile() ? GL_RED : GL_ALPHA;
#else
const GLenum format = GL_ALPHA;
#endif
funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, format, GL_UNSIGNED_BYTE, mask.bits());
#if 0
}
#endif
}
}

View File

@ -2501,10 +2501,14 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp,
if (!engine) {
if (!request.family.isEmpty()) {
QFont::StyleHint styleHint = QFont::StyleHint(request.styleHint);
if (styleHint == QFont::AnyStyle && request.fixedPitch)
styleHint = QFont::TypeWriter;
QStringList fallbacks = request.fallBackFamilies
+ fallbackFamilies(request.family,
QFont::Style(request.style),
QFont::StyleHint(request.styleHint),
styleHint,
QChar::Script(script));
if (script > QChar::Script_Common)
fallbacks += QString(); // Find the first font matching the specified script.

View File

@ -2810,7 +2810,6 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const
break;
glyph_pos = gs;
edge = pos;
break;
}
pos -= glyphs.effectiveAdvance(gs);
++gs;

View File

@ -580,7 +580,7 @@ void QSpdyProtocolHandler::sendControlFrame(FrameType type,
{
// frame type and stream ID
char header[8];
header[0] = 0x80; // leftmost bit == 1 -> is a control frame
header[0] = 0x80u; // leftmost bit == 1 -> is a control frame
header[1] = 0x03; // 3 bit == version 3
header[2] = 0;
switch (type) {
@ -653,10 +653,10 @@ void QSpdyProtocolHandler::sendSYN_STREAM(HttpMessagePair messagePair,
prioAndSlot[0] = 0x00; // == prio 0 (highest)
break;
case QHttpNetworkRequest::NormalPriority:
prioAndSlot[0] = 0x80; // == prio 4
prioAndSlot[0] = 0x80u; // == prio 4
break;
case QHttpNetworkRequest::LowPriority:
prioAndSlot[0] = 0xe0; // == prio 7 (lowest)
prioAndSlot[0] = 0xe0u; // == prio 7 (lowest)
break;
}
prioAndSlot[1] = 0x00; // slot in client certificates (not supported currently)

View File

@ -214,22 +214,23 @@ init_context:
}
// Add all our CAs to this store.
QList<QSslCertificate> expiredCerts;
foreach (const QSslCertificate &caCertificate, sslContext->sslConfiguration.caCertificates()) {
// add expired certs later, so that the
// valid ones are used before the expired ones
if (caCertificate.expiryDate() < QDateTime::currentDateTime()) {
expiredCerts.append(caCertificate);
} else {
// From https://www.openssl.org/docs/ssl/SSL_CTX_load_verify_locations.html:
//
// If several CA certificates matching the name, key identifier, and
// serial number condition are available, only the first one will be
// examined. This may lead to unexpected results if the same CA
// certificate is available with different expiration dates. If a
// ``certificate expired'' verification error occurs, no other
// certificate will be searched. Make sure to not have expired
// certificates mixed with valid ones.
//
// See also: QSslSocketBackendPrivate::verify()
if (caCertificate.expiryDate() >= QDateTime::currentDateTime()) {
q_X509_STORE_add_cert(sslContext->ctx->cert_store, (X509 *)caCertificate.handle());
}
}
// now add the expired certs
foreach (const QSslCertificate &caCertificate, expiredCerts) {
q_X509_STORE_add_cert(sslContext->ctx->cert_store, reinterpret_cast<X509 *>(caCertificate.handle()));
}
if (QSslSocketPrivate::s_loadRootCertsOnDemand && allowRootCertOnDemandLoading) {
// tell OpenSSL the directories where to look up the root certs on demand
QList<QByteArray> unixDirs = QSslSocketPrivate::unixRootCertDirectories();

View File

@ -1633,23 +1633,23 @@ QList<QSslError> QSslSocketBackendPrivate::verify(QList<QSslCertificate> certifi
setDefaultCaCertificates(defaultCaCertificates() + systemCaCertificates());
}
QList<QSslCertificate> expiredCerts;
foreach (const QSslCertificate &caCertificate, QSslSocket::defaultCaCertificates()) {
// add expired certs later, so that the
// valid ones are used before the expired ones
if (caCertificate.expiryDate() < QDateTime::currentDateTime()) {
expiredCerts.append(caCertificate);
} else {
// From https://www.openssl.org/docs/ssl/SSL_CTX_load_verify_locations.html:
//
// If several CA certificates matching the name, key identifier, and
// serial number condition are available, only the first one will be
// examined. This may lead to unexpected results if the same CA
// certificate is available with different expiration dates. If a
// ``certificate expired'' verification error occurs, no other
// certificate will be searched. Make sure to not have expired
// certificates mixed with valid ones.
//
// See also: QSslContext::fromConfiguration()
if (caCertificate.expiryDate() >= QDateTime::currentDateTime()) {
q_X509_STORE_add_cert(certStore, reinterpret_cast<X509 *>(caCertificate.handle()));
}
}
// now add the expired certs
foreach (const QSslCertificate &caCertificate, expiredCerts) {
q_X509_STORE_add_cert(certStore, reinterpret_cast<X509 *>(caCertificate.handle()));
}
QMutexLocker sslErrorListMutexLocker(&_q_sslErrorList()->mutex);
// Register a custom callback to get all verification errors.

View File

@ -100,9 +100,8 @@ void QEGLPlatformBackingStore::updateTexture()
glBindTexture(GL_TEXTURE_2D, m_bsTexture);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
// QOpenGLTextureBlitter requires GL_REPEAT for the time being
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_image.width(), m_image.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
} else {
glBindTexture(GL_TEXTURE_2D, m_bsTexture);

View File

@ -196,13 +196,20 @@ void QCoreTextFontDatabase::populateFontDatabase()
QCFType<CFArrayRef> familyNames = availableFamilyNames();
const int numberOfFamilies = CFArrayGetCount(familyNames);
for (int i = 0; i < numberOfFamilies; ++i) {
QString familyName = QCFString::toQString((CFStringRef) CFArrayGetValueAtIndex(familyNames, i));
CFStringRef familyNameRef = (CFStringRef) CFArrayGetValueAtIndex(familyNames, i);
QString familyName = QCFString::toQString(familyNameRef);
// Don't populate internal fonts
if (familyName.startsWith(QLatin1Char('.')) || familyName == QStringLiteral("LastResort"))
continue;
QPlatformFontDatabase::registerFontFamily(familyName);
#if defined(Q_OS_OSX)
QString localizedFamilyName = QString::fromNSString([[NSFontManager sharedFontManager] localizedNameForFamily:(NSString*)familyNameRef face:nil]);
if (familyName != localizedFamilyName)
QPlatformFontDatabase::registerAliasToFontFamily(familyName, localizedFamilyName);
#endif
}
}

View File

@ -559,6 +559,9 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition
QImage im(br.width.ceil().toInt(), br.height.ceil().toInt(), imageFormat);
im.fill(0);
if (!im.width() || !im.height())
return im;
#ifndef Q_OS_IOS
CGColorSpaceRef colorspace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
#else
@ -568,9 +571,11 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition
#ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version
cgflags |= kCGBitmapByteOrder32Host;
#endif
CGContextRef ctx = CGBitmapContextCreate(im.bits(), im.width(), im.height(),
8, im.bytesPerLine(), colorspace,
cgflags);
Q_ASSERT(ctx);
CGContextSetFontSize(ctx, fontDef.pixelSize);
CGContextSetShouldAntialias(ctx, (aa || fontDef.pointSize > antialiasingThreshold)
&& !(fontDef.styleStrategy & QFont::NoAntialias));

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.
@ -90,7 +90,7 @@ public:
return false;
}
ComPtr<IDXGIDevice> dxgiDevice;
ComPtr<IDXGIDevice1> dxgiDevice;
ComPtr<IDXGIAdapter> dxgiAdapter;
hr = d3dDevice.As(&dxgiDevice);
@ -99,6 +99,9 @@ public:
return false;
}
// Ensure that DXGI doesn't queue more than one frame at a time.
dxgiDevice->SetMaximumFrameLatency(1);
hr = dxgiDevice->GetAdapter(&dxgiAdapter);
if (FAILED(hr)) {
qWarning("%s: Failed to probe DXGI Device for parent DXGI Adapter: %#x", __FUNCTION__, hr);

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.

View File

@ -382,8 +382,7 @@ public:
inline D2D1_INTERPOLATION_MODE interpolationMode() const
{
Q_Q(const QWindowsDirect2DPaintEngine);
// XXX are we choosing the right d2d interpolation modes?
return (q->state()->renderHints & QPainter::SmoothPixmapTransform) ? D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC
return (q->state()->renderHints & QPainter::SmoothPixmapTransform) ? D2D1_INTERPOLATION_MODE_LINEAR
: D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR;
}

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.

View File

@ -121,18 +121,22 @@ CONFIG(blackberry-playbook) {
CONFIG(qqnx_pps) {
DEFINES += QQNX_PPS
SOURCES += qqnxnavigatorpps.cpp \
qqnxnavigatoreventnotifier.cpp \
qqnxvirtualkeyboardpps.cpp \
qqnxclipboard.cpp \
SOURCES += qqnxclipboard.cpp \
qqnxbuttoneventnotifier.cpp
HEADERS += qqnxnavigatorpps.h \
qqnxnavigatoreventnotifier.h \
qqnxvirtualkeyboardpps.h \
qqnxclipboard.h \
HEADERS += qqnxclipboard.h \
qqnxbuttoneventnotifier.h
!blackberry {
SOURCES += qqnxnavigatorpps.cpp \
qqnxnavigatoreventnotifier.cpp \
qqnxvirtualkeyboardpps.cpp
HEADERS += qqnxnavigatorpps.h \
qqnxnavigatoreventnotifier.h \
qqnxvirtualkeyboardpps.h
}
LIBS += -lpps
!contains(DEFINES, QT_NO_CLIPBOARD): LIBS += -lclipboard

View File

@ -90,7 +90,9 @@ void QQnxButtonEventNotifier::start()
errno = 0;
m_fd = qt_safe_open(ppsPath, O_RDONLY);
if (m_fd == -1) {
#if defined(Q_OS_BLACKBERRY) || defined (QQNXBUTTON_DEBUG)
qWarning("QQNX: failed to open buttons pps, errno=%d", errno);
#endif
return;
}

View File

@ -67,12 +67,12 @@
#include "qqnxvirtualkeyboardbps.h"
#elif defined(QQNX_PPS)
#include "qqnxnavigatorpps.h"
#include "qqnxnavigatoreventnotifier.h"
#include "qqnxvirtualkeyboardpps.h"
#endif
#if defined(QQNX_PPS)
# include "qqnxbuttoneventnotifier.h"
# include "qqnxnavigatoreventnotifier.h"
# include "qqnxclipboard.h"
# if defined(QQNX_IMF)
@ -284,7 +284,7 @@ QQnxIntegration::~QQnxIntegration()
#endif
// Stop/destroy navigator event notifier
#if defined(QQNX_PPS)
#if !defined(Q_OS_BLACKBERRY) && defined(QQNX_PPS)
delete m_navigatorEventNotifier;
#endif
delete m_navigatorEventHandler;

View File

@ -93,7 +93,8 @@ void QQnxNavigatorEventNotifier::start()
errno = 0;
m_fd = open(navigatorControlPath, O_RDWR);
if (m_fd == -1) {
qWarning("QQNX: failed to open navigator pps, errno=%d", errno);
qNavigatorEventNotifierDebug() << Q_FUNC_INFO << ": failed to open navigator pps:"
<< strerror(errno);
return;
}

View File

@ -41,6 +41,8 @@
#include "qqnxrasterbackingstore.h"
#include "qqnxrasterwindow.h"
#include "qqnxscreen.h"
#include "qqnxglobal.h"
#include <QtCore/QDebug>
@ -167,6 +169,25 @@ void QQnxRasterBackingStore::beginPaint(const QRegion &region)
m_hasUnflushedPaintOperations = true;
platformWindow()->adjustBufferSize();
if (window()->requestedFormat().alphaBufferSize() != 0) {
foreach (const QRect &r, region.rects()) {
// Clear transparent regions
const int bg[] = {
SCREEN_BLIT_COLOR, 0x00000000,
SCREEN_BLIT_DESTINATION_X, r.x(),
SCREEN_BLIT_DESTINATION_Y, r.y(),
SCREEN_BLIT_DESTINATION_WIDTH, r.width(),
SCREEN_BLIT_DESTINATION_HEIGHT, r.height(),
SCREEN_BLIT_END
};
Q_SCREEN_CHECKERROR(screen_fill(platformWindow()->screen()->nativeContext(),
platformWindow()->renderBuffer().nativeBuffer(), bg),
"failed to clear transparent regions");
}
Q_SCREEN_CHECKERROR(screen_flush_blits(platformWindow()->screen()->nativeContext(), 0),
"failed to flush blits");
}
}
void QQnxRasterBackingStore::endPaint()

View File

@ -128,15 +128,16 @@ bool QQnxVirtualKeyboardPps::connect()
m_fd = ::open(ms_PPSPath, O_RDWR);
if (m_fd == -1)
{
qCritical("QQnxVirtualKeyboard: Unable to open \"%s\" for keyboard: %s (%d).",
ms_PPSPath, strerror(errno), errno);
qVirtualKeyboardDebug() << Q_FUNC_INFO << ": Unable to open" << ms_PPSPath
<< ":" << strerror(errno);
close();
return false;
}
m_buffer = new char[ms_bufferSize];
if (!m_buffer) {
qCritical("QQnxVirtualKeyboard: Unable to allocate buffer of %d bytes. Size is unavailable.", ms_bufferSize);
qCritical("QQnxVirtualKeyboard: Unable to allocate buffer of %d bytes. "
"Size is unavailable.", ms_bufferSize);
return false;
}
@ -156,7 +157,7 @@ bool QQnxVirtualKeyboardPps::queryPPSInfo()
// Request info, requires id to regenerate res message.
pps_encoder_add_string(m_encoder, "msg", "info");
pps_encoder_add_string(m_encoder, "id", "libWebView");
pps_encoder_add_string(m_encoder, "id", "1");
return writeCurrentPPSEncoder();
}
@ -220,7 +221,6 @@ void QQnxVirtualKeyboardPps::ppsDataReady()
void QQnxVirtualKeyboardPps::handleKeyboardInfoMessage()
{
int newHeight = 0;
const char *value;
if (pps_decoder_push(m_decoder, "dat") != PPS_DECODER_OK) {
qCritical("QQnxVirtualKeyboard: Keyboard PPS dat object not found");
@ -230,27 +230,9 @@ void QQnxVirtualKeyboardPps::handleKeyboardInfoMessage()
qCritical("QQnxVirtualKeyboard: Keyboard PPS size field not found");
return;
}
if (pps_decoder_push(m_decoder, "locale") != PPS_DECODER_OK) {
qCritical("QQnxVirtualKeyboard: Keyboard PPS locale object not found");
return;
}
if (pps_decoder_get_string(m_decoder, "languageId", &value) != PPS_DECODER_OK) {
qCritical("QQnxVirtualKeyboard: Keyboard PPS languageId field not found");
return;
}
const QString languageId = QString::fromLatin1(value);
if (pps_decoder_get_string(m_decoder, "countryId", &value) != PPS_DECODER_OK) {
qCritical("QQnxVirtualKeyboard: Keyboard PPS size countryId not found");
return;
}
const QString countryId = QString::fromLatin1(value);
setHeight(newHeight);
const QLocale locale = QLocale(languageId + QLatin1Char('_') + countryId);
setLocale(locale);
qVirtualKeyboardDebug() << Q_FUNC_INFO << "size=" << newHeight << "locale=" << locale;
qVirtualKeyboardDebug() << Q_FUNC_INFO << "size=" << newHeight;
}
bool QQnxVirtualKeyboardPps::showKeyboard()

View File

@ -364,7 +364,7 @@ bool QWindowsMouseHandler::translateMouseWheelEvent(QWindow *window, HWND,
delta = (int) msg.wParam;
Qt::Orientation orientation = (msg.message == WM_MOUSEHWHEEL
|| (buttons & Qt::AltModifier)) ?
|| (mods & Qt::AltModifier)) ?
Qt::Horizontal : Qt::Vertical;
// according to the MSDN documentation on WM_MOUSEHWHEEL:

View File

@ -425,17 +425,8 @@ QWinRTScreen::QWinRTScreen(ICoreWindow *window)
#endif
, m_cursor(new QWinRTCursor(window))
, m_orientation(Qt::PrimaryOrientation)
, m_touchDevice(Q_NULLPTR)
{
#ifdef Q_OS_WINPHONE // On phone, there can be only one touch device
QTouchDevice *touchDevice = new QTouchDevice;
touchDevice->setCapabilities(QTouchDevice::Position | QTouchDevice::Area | QTouchDevice::Pressure);
touchDevice->setType(QTouchDevice::TouchScreen);
touchDevice->setName(QStringLiteral("WinPhoneTouchScreen"));
Pointer pointer = { Pointer::TouchScreen, touchDevice };
m_pointers.insert(0, pointer);
QWindowSystemInterface::registerTouchDevice(touchDevice);
#endif
Rect rect;
window->get_Bounds(&rect);
m_geometry = QRect(0, 0, rect.Width, rect.Height);
@ -763,47 +754,25 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *window, IPointerEventArgs *a
if (FAILED(pointerPoint->get_Properties(&properties)))
return E_INVALIDARG;
#ifdef Q_OS_WINPHONE
quint32 pointerId = 0;
Pointer pointer = m_pointers.value(pointerId);
PointerDeviceType pointerDeviceType;
#if defined(Q_OS_WINPHONE) && _MSC_VER <= 1700
pointerDeviceType = PointerDeviceType_Touch;
#else
Pointer pointer = { Pointer::Unknown, 0 };
quint32 pointerId;
pointerPoint->get_PointerId(&pointerId);
if (m_pointers.contains(pointerId)) {
pointer = m_pointers.value(pointerId);
} else { // We have not yet enumerated this device. Do so now...
IPointerDevice *device;
if (SUCCEEDED(pointerPoint->get_PointerDevice(&device))) {
PointerDeviceType type;
device->get_PointerDeviceType(&type);
switch (type) {
case PointerDeviceType_Touch:
pointer.type = Pointer::TouchScreen;
pointer.device = new QTouchDevice;
pointer.device->setName(QStringLiteral("WinRT TouchScreen ") + QString::number(pointerId));
// TODO: We may want to probe the device usage flags for more accurate values for these next two
pointer.device->setType(QTouchDevice::TouchScreen);
pointer.device->setCapabilities(QTouchDevice::Position | QTouchDevice::Area | QTouchDevice::Pressure);
QWindowSystemInterface::registerTouchDevice(pointer.device);
break;
ComPtr<IPointerDevice> pointerDevice;
HRESULT hr = pointerPoint->get_PointerDevice(&pointerDevice);
if (FAILED(hr)) {
qErrnoWarning(hr, "Failed to get pointer device.");
return S_OK;
}
case PointerDeviceType_Pen:
pointer.type = Pointer::Tablet;
break;
case PointerDeviceType_Mouse:
pointer.type = Pointer::Mouse;
break;
}
m_pointers.insert(pointerId, pointer);
device->Release();
}
hr = pointerDevice->get_PointerDeviceType(&pointerDeviceType);
if (FAILED(hr)) {
qErrnoWarning(hr, "Failed to get pointer device type.");
return S_OK;
}
#endif
switch (pointer.type) {
case Pointer::Mouse: {
switch (pointerDeviceType) {
case PointerDeviceType_Mouse: {
qint32 delta;
properties->get_MouseWheelDelta(&delta);
if (delta) {
@ -840,7 +809,15 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *window, IPointerEventArgs *a
break;
}
case Pointer::TouchScreen: {
case PointerDeviceType_Touch: {
if (!m_touchDevice) {
m_touchDevice = new QTouchDevice;
m_touchDevice->setName(QStringLiteral("WinRTTouchScreen"));
m_touchDevice->setType(QTouchDevice::TouchScreen);
m_touchDevice->setCapabilities(QTouchDevice::Position | QTouchDevice::Area | QTouchDevice::Pressure | QTouchDevice::NormalizedPosition);
QWindowSystemInterface::registerTouchDevice(m_touchDevice);
}
quint32 id;
pointerPoint->get_PointerId(&id);
@ -868,7 +845,7 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *window, IPointerEventArgs *a
it.value().normalPosition = QPointF(pos.x()/m_geometry.width(), pos.y()/m_geometry.height());
it.value().pressure = pressure;
QWindowSystemInterface::handleTouchEvent(topWindow(), pointer.device, m_touchPoints.values(), mods);
QWindowSystemInterface::handleTouchEvent(topWindow(), m_touchDevice, m_touchPoints.values(), mods);
// Remove released points, station others
for (QHash<quint32, QWindowSystemInterface::TouchPoint>::iterator i = m_touchPoints.begin(); i != m_touchPoints.end();) {
@ -880,7 +857,7 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *window, IPointerEventArgs *a
break;
}
case Pointer::Tablet: {
case PointerDeviceType_Pen: {
quint32 id;
pointerPoint->get_PointerId(&id);
@ -903,7 +880,7 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *window, IPointerEventArgs *a
float rotation;
properties->get_Twist(&rotation);
QWindowSystemInterface::handleTabletEvent(topWindow(), isPressed, pos, pos, pointerId,
QWindowSystemInterface::handleTabletEvent(topWindow(), isPressed, pos, pos, 0,
pointerType, pressure, xTilt, yTilt,
0, rotation, 0, id, mods);

View File

@ -101,12 +101,6 @@ class QWinRTPageFlipper;
class QWinRTCursor;
class QWinRTInputContext;
struct Pointer {
enum Type { Unknown, Mouse, TouchScreen, Tablet };
Type type;
QTouchDevice *device;
};
class QWinRTScreen : public QPlatformScreen
{
public:
@ -165,6 +159,7 @@ private:
ABI::Windows::UI::Core::ICoreWindow *m_coreWindow;
ABI::Windows::UI::ViewManagement::IApplicationViewStatics *m_applicationView;
ABI::Windows::ApplicationModel::Core::ICoreApplication *m_application;
QRect m_geometry;
QImage::Format m_format;
QSurfaceFormat m_surfaceFormat;
@ -183,7 +178,7 @@ private:
#ifndef Q_OS_WINPHONE
QHash<quint32, QPair<Qt::Key, QString> > m_activeKeys;
#endif
QHash<quint32, Pointer> m_pointers;
QTouchDevice *m_touchDevice;
QHash<quint32, QWindowSystemInterface::TouchPoint> m_touchPoints;
};

View File

@ -1791,19 +1791,6 @@ bool QXcbConnection::xi2GetValuatorValueIfSet(void *event, int valuatorNum, doub
return true;
}
bool QXcbConnection::xi2GetButtonState(void *event, int buttonNum)
{
xXIDeviceEvent *xideviceevent = static_cast<xXIDeviceEvent *>(event);
unsigned char *buttonsMaskAddr = (unsigned char*)&xideviceevent[1];
for (int i = 0; i < (xideviceevent->buttons_len * 4); i++) {
if (buttonNum < 8)
return (buttonsMaskAddr[i] & (1 << buttonNum));
buttonNum -= 8;
}
return false;
}
// Starting from the xcb version 1.9.3 struct xcb_ge_event_t has changed:
// - "pad0" became "extension"
// - "pad1" and "pad" became "pad0"

View File

@ -533,7 +533,6 @@ private:
#if defined(XCB_USE_XINPUT2) || defined(XCB_USE_XINPUT2_MAEMO)
static bool xi2GetValuatorValueIfSet(void *event, int valuatorNum, double *value);
static bool xi2PrepareXIGenericDeviceEvent(xcb_ge_event_t *event, int opCode);
static bool xi2GetButtonState(void *event, int buttonNum);
#endif
xcb_connection_t *m_connection;

View File

@ -575,7 +575,7 @@ void QXcbConnection::xi2HandleScrollEvent(void *event, ScrollingDevice &scrollin
#ifdef XCB_USE_XINPUT21
xXIGenericDeviceEvent *xiEvent = reinterpret_cast<xXIGenericDeviceEvent *>(event);
if (xiEvent->evtype == XI_Motion) {
if (xiEvent->evtype == XI_Motion && scrollingDevice.orientations) {
xXIDeviceEvent* xiDeviceEvent = reinterpret_cast<xXIDeviceEvent *>(event);
if (QXcbWindow *platformWindow = platformWindowFromId(xiDeviceEvent->event)) {
QPoint rawDelta;
@ -612,20 +612,20 @@ void QXcbConnection::xi2HandleScrollEvent(void *event, ScrollingDevice &scrollin
QWindowSystemInterface::handleWheelEvent(platformWindow->window(), xiEvent->time, local, global, rawDelta, angleDelta, modifiers);
}
}
} else if (xiEvent->evtype == XI_ButtonRelease) {
} else if (xiEvent->evtype == XI_ButtonRelease && scrollingDevice.legacyOrientations) {
xXIDeviceEvent* xiDeviceEvent = reinterpret_cast<xXIDeviceEvent *>(event);
if (QXcbWindow *platformWindow = platformWindowFromId(xiDeviceEvent->event)) {
QPoint angleDelta;
if (scrollingDevice.legacyOrientations & Qt::Vertical) {
if (xi2GetButtonState(xiDeviceEvent, 4))
if (xiDeviceEvent->detail == 4)
angleDelta.setY(120);
else if (xi2GetButtonState(xiDeviceEvent, 5))
else if (xiDeviceEvent->detail == 5)
angleDelta.setY(-120);
}
if (scrollingDevice.legacyOrientations & Qt::Horizontal) {
if (xi2GetButtonState(xiDeviceEvent, 6))
if (xiDeviceEvent->detail == 6)
angleDelta.setX(120);
if (xi2GetButtonState(xiDeviceEvent, 7))
else if (xiDeviceEvent->detail == 7)
angleDelta.setX(-120);
}
if (!angleDelta.isNull()) {

View File

@ -2143,18 +2143,26 @@ char *toHexRepresentation(const char *ba, int length)
char *toPrettyUnicode(const ushort *p, int length)
{
// keep it simple for the vast majority of cases
QScopedArrayPointer<char> buffer(new char[length * 6 + 3]);
bool trimmed = false;
QScopedArrayPointer<char> buffer(new char[256]);
const ushort *end = p + length;
char *dst = buffer.data();
*dst++ = '"';
for ( ; p != end; ++p) {
if (dst - buffer.data() > 245) {
// plus the the quote, the three dots and NUL, it's 250, 251 or 255
trimmed = true;
break;
}
if (*p < 0x7f && *p >= 0x20 && *p != '\\') {
*dst++ = *p;
continue;
}
// write as an escape sequence
// this means we may advance dst to buffer.data() + 246 or 250
*dst++ = '\\';
switch (*p) {
case 0x22:
@ -2186,6 +2194,11 @@ char *toPrettyUnicode(const ushort *p, int length)
}
*dst++ = '"';
if (trimmed) {
*dst++ = '.';
*dst++ = '.';
*dst++ = '.';
}
*dst++ = '\0';
return buffer.take();
}

View File

@ -2177,6 +2177,7 @@ QAction *QMenu::exec()
QAction *QMenu::exec(const QPoint &p, QAction *action)
{
Q_D(QMenu);
ensurePolished();
createWinId();
QEventLoop eventLoop;
d->eventLoop = &eventLoop;

View File

@ -247,6 +247,13 @@ private:
QString testFileName;
};
void runOnExit()
{
QByteArray buffer;
QTextStream(&buffer) << "This will try to use QTextCodec::codecForLocale" << endl;
}
Q_DESTRUCTOR_FUNCTION(runOnExit)
tst_QTextStream::tst_QTextStream()
: tempDir(QDir::tempPath() + "/tst_qtextstream.XXXXXX")
{

View File

@ -715,6 +715,10 @@ void tst_QDateTime::toString_isoDate_data()
QTest::newRow("negative OffsetFromUTC")
<< dt
<< QString("1978-11-09T13:28:34-02:00");
dt.setUtcOffset(-900);
QTest::newRow("negative non-integral OffsetFromUTC")
<< dt
<< QString("1978-11-09T13:28:34-00:15");
QTest::newRow("invalid")
<< QDateTime(QDate(-1, 11, 9), QTime(13, 28, 34), Qt::UTC)
<< QString();
@ -1895,8 +1899,12 @@ void tst_QDateTime::fromStringDateFormat_data()
// Test Qt::ISODate format.
QTest::newRow("ISO +01:00") << QString::fromLatin1("1987-02-13T13:24:51+01:00")
<< Qt::ISODate << QDateTime(QDate(1987, 2, 13), QTime(12, 24, 51), Qt::UTC);
QTest::newRow("ISO +00:01") << QString::fromLatin1("1987-02-13T13:24:51+00:01")
<< Qt::ISODate << QDateTime(QDate(1987, 2, 13), QTime(13, 23, 51), Qt::UTC);
QTest::newRow("ISO -01:00") << QString::fromLatin1("1987-02-13T13:24:51-01:00")
<< Qt::ISODate << QDateTime(QDate(1987, 2, 13), QTime(14, 24, 51), Qt::UTC);
QTest::newRow("ISO -00:01") << QString::fromLatin1("1987-02-13T13:24:51-00:01")
<< Qt::ISODate << QDateTime(QDate(1987, 2, 13), QTime(13, 25, 51), Qt::UTC);
QTest::newRow("ISO +0000") << QString::fromLatin1("1970-01-01T00:12:34+0000")
<< Qt::ISODate << QDateTime(QDate(1970, 1, 1), QTime(0, 12, 34), Qt::UTC);
QTest::newRow("ISO +00:00") << QString::fromLatin1("1970-01-01T00:12:34+00:00")

View File

@ -367,11 +367,11 @@ void emitSignalPeer(const QString &interface, const QString &name, const QVarian
QTest::qWait(1000);
}
const char* slotSpyPeer()
QString slotSpyPeer()
{
QDBusMessage req = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "slotSpyServer");
QDBusMessage reply = QDBusConnection::sessionBus().call(req);
return reply.arguments().at(0).toString().toLatin1().data();
return reply.arguments().at(0).toString();
}
QString valueSpyPeer()
@ -1108,7 +1108,7 @@ void tst_QDBusAbstractAdaptor::methodCallsPeer()
// simple call: one such method exists
QCOMPARE(if2.call(QDBus::BlockWithGui, "method").type(), QDBusMessage::ReplyMessage);
QCOMPARE(slotSpyPeer(), "void Interface2::method()");
QCOMPARE(slotSpyPeer(), QStringLiteral("void Interface2::method()"));
if (!nInterfaces--)
return;
@ -1121,24 +1121,24 @@ void tst_QDBusAbstractAdaptor::methodCallsPeer()
QCOMPARE(if2.call(QDBus::BlockWithGui, "methodString").type(), QDBusMessage::ErrorMessage);
QCOMPARE(if3.call(QDBus::BlockWithGui, "methodVoid").type(), QDBusMessage::ReplyMessage);
QCOMPARE(slotSpyPeer(), "void Interface3::methodVoid()");
QCOMPARE(slotSpyPeer(), QStringLiteral("void Interface3::methodVoid()"));
QCOMPARE(if3.call(QDBus::BlockWithGui, "methodInt", 42).type(), QDBusMessage::ReplyMessage);
QCOMPARE(slotSpyPeer(), "void Interface3::methodInt(int)");
QCOMPARE(slotSpyPeer(), QStringLiteral("void Interface3::methodInt(int)"));
QCOMPARE(if3.call(QDBus::BlockWithGui, "methodString", QString("")).type(), QDBusMessage::ReplyMessage);
QCOMPARE(slotSpyPeer(), "void Interface3::methodString(QString)");
QCOMPARE(slotSpyPeer(), QStringLiteral("void Interface3::methodString(QString)"));
if (!nInterfaces--)
return;
// method overloading: different interfaces
QCOMPARE(if4.call(QDBus::BlockWithGui, "method").type(), QDBusMessage::ReplyMessage);
QCOMPARE(slotSpyPeer(), "void Interface4::method()");
QCOMPARE(slotSpyPeer(), QStringLiteral("void Interface4::method()"));
// method overloading: different parameters
QCOMPARE(if4.call(QDBus::BlockWithGui, "method.i", 42).type(), QDBusMessage::ReplyMessage);
QCOMPARE(slotSpyPeer(), "void Interface4::method(int)");
QCOMPARE(slotSpyPeer(), QStringLiteral("void Interface4::method(int)"));
QCOMPARE(if4.call(QDBus::BlockWithGui, "method.s", QString()).type(), QDBusMessage::ReplyMessage);
QCOMPARE(slotSpyPeer(), "void Interface4::method(QString)");
QCOMPARE(slotSpyPeer(), QStringLiteral("void Interface4::method(QString)"));
}
void tst_QDBusAbstractAdaptor::methodCallScriptablePeer()
@ -1152,7 +1152,7 @@ void tst_QDBusAbstractAdaptor::methodCallScriptablePeer()
QDBusInterface if2(QString(), "/", "local.Interface2", con);
QCOMPARE(if2.call(QDBus::BlockWithGui,"scriptableMethod").type(), QDBusMessage::ReplyMessage);
QCOMPARE(slotSpyPeer(), "void Interface2::scriptableMethod()");
QCOMPARE(slotSpyPeer(), QStringLiteral("void Interface2::scriptableMethod()"));
}
void tst_QDBusAbstractAdaptor::signalEmissionsPeer_data()

View File

@ -1,5 +1,7 @@
SOURCES = qpinger.cpp ../interface.cpp
HEADERS = ../interface.h
TARGET = qpinger
CONFIG -= app_bundle
CONFIG += console
QT = core dbus
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0

View File

@ -1,5 +1,7 @@
SOURCES = qpong.cpp
TARGET = qpong
QT = core dbus
CONFIG -= app_bundle
CONFIG += console
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0

View File

@ -4631,32 +4631,28 @@ void tst_QWidget::windowMoveResize()
QTest::qWait(10);
QTRY_COMPARE(widget.pos(), rect.topLeft());
if (m_platform == QStringLiteral("windows")) {
QEXPECT_FAIL("130,100 0x200, flags 0", "QTBUG-26424", Continue);
QEXPECT_FAIL("130,50 0x0, flags 0", "QTBUG-26424", Continue);
}
QTRY_COMPARE(widget.size(), rect.size());
// Windows: Minimum size of decorated windows.
const bool expectResizeFail = (!windowFlags && (rect.width() < 160 || rect.height() < 40))
&& m_platform == QStringLiteral("windows");
if (!expectResizeFail)
QTRY_COMPARE(widget.size(), rect.size());
// move() while shown
foreach (const QRect &r, rects) {
if (m_platform == QStringLiteral("xcb")
&& ((widget.width() == 0 || widget.height() == 0) && r.width() != 0 && r.height() != 0)) {
QEXPECT_FAIL("130,100 0x200, flags 0",
"First resize after show of zero-sized gets wrong win_gravity.",
Continue);
QEXPECT_FAIL("100,50 200x0, flags 0",
"First resize after show of zero-sized gets wrong win_gravity.",
Continue);
QEXPECT_FAIL("130,50 0x0, flags 0",
"First resize after show of zero-sized gets wrong win_gravity.",
Continue);
}
// XCB: First resize after show of zero-sized gets wrong win_gravity.
const bool expectMoveFail = !windowFlags
&& ((widget.width() == 0 || widget.height() == 0) && r.width() != 0 && r.height() != 0)
&& m_platform == QStringLiteral("xcb")
&& (rect == QRect(QPoint(130, 100), QSize(0, 200))
|| rect == QRect(QPoint(100, 50), QSize(200, 0))
|| rect == QRect(QPoint(130, 50), QSize(0, 0)));
widget.move(r.topLeft());
widget.resize(r.size());
QApplication::processEvents();
QTRY_COMPARE(widget.pos(), r.topLeft());
QTRY_COMPARE(widget.size(), r.size());
if (!expectMoveFail) {
QTRY_COMPARE(widget.pos(), r.topLeft());
QTRY_COMPARE(widget.size(), r.size());
}
}
widget.move(rect.topLeft());
widget.resize(rect.size());