summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-09-24 09:49:07 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-09-24 12:04:52 +0200
commitc96426f19f8c244c0f5748f0009016f576db9616 (patch)
treef6365344e8a24415e7a67694af2f0c043bb0dae6 /src/plugins
parent2137cb7dc5c902ce71855901c83c4c9d87b1ce2d (diff)
parentc5a3e5edd9e63b18abf1838c86a27a662224b02c (diff)
Merge "Merge remote-tracking branch 'origin/5.3' into 5.4" into refs/staging/5.4
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/bearer/connman/connman.pro1
-rw-r--r--src/plugins/bearer/connman/qconnmanengine.cpp60
-rw-r--r--src/plugins/bearer/connman/qconnmanengine.h5
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.mm3
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine_10_6.mm3
-rw-r--r--src/plugins/bearer/generic/qgenericengine.cpp1
-rw-r--r--src/plugins/platforms/android/androidjniinput.cpp19
-rw-r--r--src/plugins/platforms/android/androidjnimain.cpp8
-rw-r--r--src/plugins/platforms/android/qandroidplatformintegration.cpp2
-rw-r--r--src/plugins/platforms/android/qandroidplatformopenglcontext.cpp25
-rw-r--r--src/plugins/platforms/android/qandroidplatformopenglcontext.h2
-rw-r--r--src/plugins/platforms/cocoa/messages.cpp26
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplication.mm10
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm3
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm8
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenu.mm5
-rw-r--r--src/plugins/platforms/cocoa/qnsview.h7
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm12
-rw-r--r--src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp66
-rw-r--r--src/plugins/platforms/qnx/qqnxrasterbackingstore.h12
-rw-r--r--src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp8
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase.cpp8
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp2
-rw-r--r--src/plugins/platforms/xcb/qglxintegration.cpp61
-rw-r--r--src/plugins/platforms/xcb/qglxintegration.h1
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp5
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_xi2.cpp5
-rw-r--r--src/plugins/platforms/xcb/qxcbkeyboard.cpp27
-rw-r--r--src/plugins/platforms/xcb/qxcbkeyboard.h6
-rw-r--r--src/plugins/platforms/xcb/xcb-plugin.pro1
-rw-r--r--src/plugins/platforms/xcb/xcb-static/xcb-static.pro3
-rw-r--r--src/plugins/printsupport/cups/qcupsprintersupport_p.h11
32 files changed, 204 insertions, 212 deletions
diff --git a/src/plugins/bearer/connman/connman.pro b/src/plugins/bearer/connman/connman.pro
index 0da2dfacf6..bc4efe8b62 100644
--- a/src/plugins/bearer/connman/connman.pro
+++ b/src/plugins/bearer/connman/connman.pro
@@ -6,7 +6,6 @@ load(qt_plugin)
QT = core network-private dbus
CONFIG += link_pkgconfig
-packagesExist(connectionagent) { DEFINES += QT_HAS_CONNECTIONAGENT }
HEADERS += qconnmanservice_linux_p.h \
qofonoservice_linux_p.h \
diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp
index adefb7504e..3d7daedeb0 100644
--- a/src/plugins/bearer/connman/qconnmanengine.cpp
+++ b/src/plugins/bearer/connman/qconnmanengine.cpp
@@ -54,11 +54,6 @@
#include <QtDBus/QDBusInterface>
#include <QtDBus/QDBusMessage>
#include <QtDBus/QDBusReply>
-#ifdef QT_HAS_CONNECTIONAGENT
-#include <sys/inotify.h>
-#include <fcntl.h>
-#include <qcore_unix_p.h>
-#endif
#ifndef QT_NO_BEARERMANAGEMENT
#ifndef QT_NO_DBUS
@@ -78,9 +73,6 @@ QConnmanEngine::QConnmanEngine(QObject *parent)
QConnmanEngine::~QConnmanEngine()
{
-#ifdef QT_HAS_CONNECTIONAGENT
- qt_safe_close(inotifyFileDescriptor);
-#endif
}
bool QConnmanEngine::connmanAvailable() const
@@ -108,16 +100,6 @@ void QConnmanEngine::initialize()
addServiceConfiguration(servPath);
}
Q_EMIT updateCompleted();
-#ifdef QT_HAS_CONNECTIONAGENT
- QSettings confFile(QStringLiteral("nemomobile"),QStringLiteral("connectionagent"));
-
- inotifyFileDescriptor = ::inotify_init();
- inotifyWatcher = ::inotify_add_watch(inotifyFileDescriptor, QFile::encodeName(confFile.fileName()), IN_MODIFY);
- if (inotifyWatcher > 0) {
- QSocketNotifier *notifier = new QSocketNotifier(inotifyFileDescriptor, QSocketNotifier::Read, this);
- connect(notifier, SIGNAL(activated(int)), this, SLOT(inotifyActivated()));
- }
-#endif
}
void QConnmanEngine::changedModem()
@@ -195,10 +177,6 @@ void QConnmanEngine::connectToId(const QString &id)
emit connectionError(id, QBearerEngineImpl::OperationNotSupported);
return;
}
- if (isAlwaysAskRoaming()) {
- emit connectionError(id, QBearerEngineImpl::OperationNotSupported);
- return;
- }
}
}
if (serv->autoConnect())
@@ -272,12 +250,11 @@ QNetworkSession::State QConnmanEngine::sessionStateForId(const QString &id)
return QNetworkSession::Disconnected;
}
- if (servState == QLatin1String("association") || servState == QLatin1String("configuration")
- || servState == QLatin1String("ready")) {
+ if (servState == QLatin1String("association") || servState == QLatin1String("configuration")) {
return QNetworkSession::Connecting;
}
- if (servState == QLatin1String("online")) {
+ if (servState == QLatin1String("online") || servState == QLatin1String("ready")) {
return QNetworkSession::Connected;
}
@@ -421,9 +398,8 @@ QNetworkConfiguration::StateFlags QConnmanEngine::getStateForService(const QStri
if (serv->type() == QLatin1String("cellular")) {
- if (!serv->autoConnect()
- || (serv->roaming()
- && (isAlwaysAskRoaming() || !isRoamingAllowed(serv->path())))) {
+ if (!serv->autoConnect()|| (serv->roaming()
+ && !isRoamingAllowed(serv->path()))) {
flag = (flag | QNetworkConfiguration::Defined);
} else {
flag = (flag | QNetworkConfiguration::Discovered);
@@ -437,7 +413,7 @@ QNetworkConfiguration::StateFlags QConnmanEngine::getStateForService(const QStri
flag = QNetworkConfiguration::Undefined;
}
}
- if (state == QLatin1String("online")) {
+ if (state == QLatin1String("online") || state == QLatin1String("ready")) {
flag = (flag | QNetworkConfiguration::Active);
}
@@ -576,17 +552,6 @@ bool QConnmanEngine::requiresPolling() const
return false;
}
-bool QConnmanEngine::isAlwaysAskRoaming()
-{
-#ifdef QT_HAS_CONNECTIONAGENT
- QSettings confFile(QStringLiteral("nemomobile"),QStringLiteral("connectionagent"));
- confFile.beginGroup(QStringLiteral("Connectionagent"));
- return confFile.value(QStringLiteral("askForRoaming")).toBool();
-#else
- return false;
-#endif
-}
-
void QConnmanEngine::reEvaluateCellular()
{
Q_FOREACH (const QString &servicePath, connmanManager->getServices()) {
@@ -596,21 +561,6 @@ void QConnmanEngine::reEvaluateCellular()
}
}
-void QConnmanEngine::inotifyActivated()
-{
-#ifdef QT_HAS_CONNECTIONAGENT
-
- char buffer[1024];
- int len = qt_safe_read(inotifyFileDescriptor, (void *)buffer, sizeof(buffer));
- if (len > 0) {
- struct inotify_event *event = (struct inotify_event *)buffer;
- if (event->wd == inotifyWatcher && (event->mask & IN_MODIFY) == 0) {
- QTimer::singleShot(1000, this, SLOT(reEvaluateCellular())); //give this time to finish write
- }
- }
-#endif
-}
-
QT_END_NAMESPACE
#endif // QT_NO_DBUS
diff --git a/src/plugins/bearer/connman/qconnmanengine.h b/src/plugins/bearer/connman/qconnmanengine.h
index 4a4e91659b..4d5495ae86 100644
--- a/src/plugins/bearer/connman/qconnmanengine.h
+++ b/src/plugins/bearer/connman/qconnmanengine.h
@@ -108,7 +108,6 @@ private Q_SLOTS:
void serviceStateChanged(const QString &state);
void configurationChange(QConnmanServiceInterface * service);
void reEvaluateCellular();
- void inotifyActivated();
private:
QConnmanManagerInterface *connmanManager;
@@ -134,12 +133,8 @@ private:
QNetworkConfiguration::BearerType ofonoTechToBearerType(const QString &type);
bool isRoamingAllowed(const QString &context);
- bool isAlwaysAskRoaming();
QMap <QString,QConnmanServiceInterface *> connmanServiceInterfaces;
- int inotifyWatcher;
- int inotifyFileDescriptor;
-
protected:
bool requiresPolling() const;
};
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm
index 554ad26e51..65e70876f2 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.mm
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm
@@ -419,7 +419,8 @@ QCoreWlanEngine::QCoreWlanEngine(QObject *parent)
QCoreWlanEngine::~QCoreWlanEngine()
{
- scanThread->wait(5000);
+ scanThread->terminate();
+ scanThread->wait();
while (!foundConfigurations.isEmpty())
delete foundConfigurations.takeFirst();
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine_10_6.mm b/src/plugins/bearer/corewlan/qcorewlanengine_10_6.mm
index ba1cf33258..6cf614cb30 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine_10_6.mm
+++ b/src/plugins/bearer/corewlan/qcorewlanengine_10_6.mm
@@ -404,7 +404,8 @@ QCoreWlanEngine::QCoreWlanEngine(QObject *parent)
QCoreWlanEngine::~QCoreWlanEngine()
{
- scanThread->wait(5000);
+ scanThread->terminate();
+ scanThread->wait();
while (!foundConfigurations.isEmpty())
delete foundConfigurations.takeFirst();
diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp
index d2579372c7..d687539d84 100644
--- a/src/plugins/bearer/generic/qgenericengine.cpp
+++ b/src/plugins/bearer/generic/qgenericengine.cpp
@@ -165,6 +165,7 @@ static QNetworkConfiguration::BearerType qGetInterfaceType(const QString &interf
ifreq request;
strncpy(request.ifr_name, interface.toLocal8Bit().data(), sizeof(request.ifr_name));
+ request.ifr_name[sizeof(request.ifr_name) - 1] = '\0';
int result = ioctl(sock, SIOCGIFHWADDR, &request);
close(sock);
diff --git a/src/plugins/platforms/android/androidjniinput.cpp b/src/plugins/platforms/android/androidjniinput.cpp
index defc59abf0..2c4b664487 100644
--- a/src/plugins/platforms/android/androidjniinput.cpp
+++ b/src/plugins/platforms/android/androidjniinput.cpp
@@ -47,6 +47,7 @@
#include <QTouchEvent>
#include <QPointer>
+#include <QGuiApplication>
#include <QDebug>
QT_BEGIN_NAMESPACE
@@ -58,10 +59,10 @@ namespace QtAndroidInput
static jmethodID m_showSoftwareKeyboardMethodID = 0;
static jmethodID m_resetSoftwareKeyboardMethodID = 0;
static jmethodID m_hideSoftwareKeyboardMethodID = 0;
- static jmethodID m_isSoftwareKeyboardVisibleMethodID = 0;
static jmethodID m_updateSelectionMethodID = 0;
static bool m_ignoreMouseEvents = false;
+ static bool m_softwareKeyboardVisible = false;
static QList<QWindowSystemInterface::TouchPoint> m_touchPoints;
@@ -124,15 +125,7 @@ namespace QtAndroidInput
bool isSoftwareKeyboardVisible()
{
- AttachedJNIEnv env;
- if (!env.jniEnv)
- return false;
-
- bool visibility = env.jniEnv->CallStaticBooleanMethod(applicationClass(), m_isSoftwareKeyboardVisibleMethodID);
-#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
- qDebug() << "@@@ ISSOFTWAREKEYBOARDVISIBLE" << visibility;
-#endif
- return visibility;
+ return m_softwareKeyboardVisible;
}
@@ -713,10 +706,11 @@ namespace QtAndroidInput
false);
}
- static void keyboardVisibilityChanged(JNIEnv */*env*/, jobject /*thiz*/, jboolean /*visibility*/)
+ static void keyboardVisibilityChanged(JNIEnv */*env*/, jobject /*thiz*/, jboolean visibility)
{
+ m_softwareKeyboardVisible = visibility;
QAndroidInputContext *inputContext = QAndroidInputContext::androidInputContext();
- if (inputContext)
+ if (inputContext && qGuiApp)
inputContext->emitInputPanelVisibleChanged();
#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
qDebug() << "@@@ KEYBOARDVISIBILITYCHANGED" << inputContext;
@@ -755,7 +749,6 @@ namespace QtAndroidInput
GET_AND_CHECK_STATIC_METHOD(m_showSoftwareKeyboardMethodID, appClass, "showSoftwareKeyboard", "(IIIII)V");
GET_AND_CHECK_STATIC_METHOD(m_resetSoftwareKeyboardMethodID, appClass, "resetSoftwareKeyboard", "()V");
GET_AND_CHECK_STATIC_METHOD(m_hideSoftwareKeyboardMethodID, appClass, "hideSoftwareKeyboard", "()V");
- GET_AND_CHECK_STATIC_METHOD(m_isSoftwareKeyboardVisibleMethodID, appClass, "isSoftwareKeyboardVisible", "()Z");
GET_AND_CHECK_STATIC_METHOD(m_updateSelectionMethodID, appClass, "updateSelection", "(IIII)V");
return true;
}
diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp
index 7b76177141..6df9f56c2c 100644
--- a/src/plugins/platforms/android/androidjnimain.cpp
+++ b/src/plugins/platforms/android/androidjnimain.cpp
@@ -559,6 +559,12 @@ static void setDisplayMetrics(JNIEnv */*env*/, jclass /*clazz*/,
jint desktopWidthPixels, jint desktopHeightPixels,
jdouble xdpi, jdouble ydpi, jdouble scaledDensity)
{
+ // Android does not give us the correct screen size for immersive mode, but
+ // the surface does have the right size
+
+ widthPixels = qMax(widthPixels, desktopWidthPixels);
+ heightPixels = qMax(heightPixels, desktopHeightPixels);
+
m_desktopWidthPixels = desktopWidthPixels;
m_desktopHeightPixels = desktopHeightPixels;
m_scaledDensity = scaledDensity;
@@ -573,8 +579,8 @@ static void setDisplayMetrics(JNIEnv */*env*/, jclass /*clazz*/,
} else {
m_androidPlatformIntegration->setDisplayMetrics(qRound(double(widthPixels) / xdpi * 25.4),
qRound(double(heightPixels) / ydpi * 25.4));
- m_androidPlatformIntegration->setDesktopSize(desktopWidthPixels, desktopHeightPixels);
m_androidPlatformIntegration->setScreenSize(widthPixels, heightPixels);
+ m_androidPlatformIntegration->setDesktopSize(desktopWidthPixels, desktopHeightPixels);
}
}
diff --git a/src/plugins/platforms/android/qandroidplatformintegration.cpp b/src/plugins/platforms/android/qandroidplatformintegration.cpp
index 53cb3588f6..cbf13e81d5 100644
--- a/src/plugins/platforms/android/qandroidplatformintegration.cpp
+++ b/src/plugins/platforms/android/qandroidplatformintegration.cpp
@@ -121,8 +121,8 @@ QAndroidPlatformIntegration::QAndroidPlatformIntegration(const QStringList &para
m_primaryScreen = new QAndroidPlatformScreen();
screenAdded(m_primaryScreen);
m_primaryScreen->setPhysicalSize(QSize(m_defaultPhysicalSizeWidth, m_defaultPhysicalSizeHeight));
- m_primaryScreen->setAvailableGeometry(QRect(0, 0, m_defaultGeometryWidth, m_defaultGeometryHeight));
m_primaryScreen->setSize(QSize(m_defaultScreenWidth, m_defaultScreenHeight));
+ m_primaryScreen->setAvailableGeometry(QRect(0, 0, m_defaultGeometryWidth, m_defaultGeometryHeight));
m_mainThread = QThread::currentThread();
QtAndroid::setAndroidPlatformIntegration(this);
diff --git a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp
index 2c6e8370ce..e8dc8a9c5c 100644
--- a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp
+++ b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp
@@ -64,17 +64,28 @@ void QAndroidPlatformOpenGLContext::swapBuffers(QPlatformSurface *surface)
QEGLPlatformContext::swapBuffers(surface);
}
-bool QAndroidPlatformOpenGLContext::needsFBOReadBackWorkaroud()
+bool QAndroidPlatformOpenGLContext::needsFBOReadBackWorkaround()
{
static bool set = false;
static bool needsWorkaround = false;
if (!set) {
- const char *rendererString = reinterpret_cast<const char *>(glGetString(GL_RENDERER));
- needsWorkaround =
- qstrncmp(rendererString, "Mali-4xx", 6) == 0 // Mali-400, Mali-450
- || qstrncmp(rendererString, "Adreno (TM) 2xx", 13) == 0 // Adreno 200, 203, 205
- || qstrcmp(rendererString, "GC1000 core") == 0;
+ QByteArray env = qgetenv("QT_ANDROID_DISABLE_GLYPH_CACHE_WORKAROUND");
+ needsWorkaround = env.isEmpty() || env == "0" || env == "false";
+
+ if (!needsWorkaround) {
+ const char *rendererString = reinterpret_cast<const char *>(glGetString(GL_RENDERER));
+ needsWorkaround =
+ qstrncmp(rendererString, "Mali-4xx", 6) == 0 // Mali-400, Mali-450
+ || qstrncmp(rendererString, "Adreno (TM) 2xx", 13) == 0 // Adreno 200, 203, 205
+ || qstrncmp(rendererString, "Adreno 2xx", 8) == 0 // Same as above but without the '(TM)'
+ || qstrncmp(rendererString, "Adreno (TM) 30x", 14) == 0 // Adreno 302, 305
+ || qstrncmp(rendererString, "Adreno 30x", 9) == 0 // Same as above but without the '(TM)'
+ || qstrcmp(rendererString, "GC800 core") == 0
+ || qstrcmp(rendererString, "GC1000 core") == 0
+ || qstrcmp(rendererString, "Immersion.16") == 0;
+ }
+
set = true;
}
@@ -90,7 +101,7 @@ bool QAndroidPlatformOpenGLContext::makeCurrent(QPlatformSurface *surface)
if (rendererString != 0 && qstrncmp(rendererString, "Android Emulator", 16) == 0)
ctx_d->workaround_missingPrecisionQualifiers = true;
- if (!ctx_d->workaround_brokenFBOReadBack && needsFBOReadBackWorkaroud())
+ if (!ctx_d->workaround_brokenFBOReadBack && needsFBOReadBackWorkaround())
ctx_d->workaround_brokenFBOReadBack = true;
return ret;
diff --git a/src/plugins/platforms/android/qandroidplatformopenglcontext.h b/src/plugins/platforms/android/qandroidplatformopenglcontext.h
index 10a89d541b..b734cb4db9 100644
--- a/src/plugins/platforms/android/qandroidplatformopenglcontext.h
+++ b/src/plugins/platforms/android/qandroidplatformopenglcontext.h
@@ -57,7 +57,7 @@ public:
private:
virtual EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface);
- static bool needsFBOReadBackWorkaroud();
+ static bool needsFBOReadBackWorkaround();
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/messages.cpp b/src/plugins/platforms/cocoa/messages.cpp
index 8fc8b312f5..4f7b038c6f 100644
--- a/src/plugins/platforms/cocoa/messages.cpp
+++ b/src/plugins/platforms/cocoa/messages.cpp
@@ -76,27 +76,29 @@ QString qt_mac_applicationmenu_string(int type)
QPlatformMenuItem::MenuRole detectMenuRole(const QString &caption)
{
+ QString captionNoAmpersand(caption);
+ captionNoAmpersand.remove(QChar('&'));
const QString aboutString = QCoreApplication::translate("QCocoaMenuItem", "About");
- if (caption.startsWith(aboutString, Qt::CaseInsensitive) || caption.endsWith(aboutString, Qt::CaseInsensitive))
+ if (captionNoAmpersand.startsWith(aboutString, Qt::CaseInsensitive) || caption.endsWith(aboutString, Qt::CaseInsensitive))
return QPlatformMenuItem::AboutRole;
- if (caption.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Config"), Qt::CaseInsensitive)
- || caption.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Preference"), Qt::CaseInsensitive)
- || caption.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Options"), Qt::CaseInsensitive)
- || caption.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Setting"), Qt::CaseInsensitive)
- || caption.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Setup"), Qt::CaseInsensitive)) {
+ if (captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Config"), Qt::CaseInsensitive)
+ || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Preference"), Qt::CaseInsensitive)
+ || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Options"), Qt::CaseInsensitive)
+ || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Setting"), Qt::CaseInsensitive)
+ || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Setup"), Qt::CaseInsensitive)) {
return QPlatformMenuItem::PreferencesRole;
}
- if (caption.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Quit"), Qt::CaseInsensitive)
- || caption.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Exit"), Qt::CaseInsensitive)) {
+ if (captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Quit"), Qt::CaseInsensitive)
+ || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Exit"), Qt::CaseInsensitive)) {
return QPlatformMenuItem::QuitRole;
}
- if (!caption.compare(QCoreApplication::translate("QCocoaMenuItem", "Cut"), Qt::CaseInsensitive))
+ if (!captionNoAmpersand.compare(QCoreApplication::translate("QCocoaMenuItem", "Cut"), Qt::CaseInsensitive))
return QPlatformMenuItem::CutRole;
- if (!caption.compare(QCoreApplication::translate("QCocoaMenuItem", "Copy"), Qt::CaseInsensitive))
+ if (!captionNoAmpersand.compare(QCoreApplication::translate("QCocoaMenuItem", "Copy"), Qt::CaseInsensitive))
return QPlatformMenuItem::CopyRole;
- if (!caption.compare(QCoreApplication::translate("QCocoaMenuItem", "Paste"), Qt::CaseInsensitive))
+ if (!captionNoAmpersand.compare(QCoreApplication::translate("QCocoaMenuItem", "Paste"), Qt::CaseInsensitive))
return QPlatformMenuItem::PasteRole;
- if (!caption.compare(QCoreApplication::translate("QCocoaMenuItem", "Select All"), Qt::CaseInsensitive))
+ if (!captionNoAmpersand.compare(QCoreApplication::translate("QCocoaMenuItem", "Select All"), Qt::CaseInsensitive))
return QPlatformMenuItem::SelectAllRole;
return QPlatformMenuItem::NoRole;
}
diff --git a/src/plugins/platforms/cocoa/qcocoaapplication.mm b/src/plugins/platforms/cocoa/qcocoaapplication.mm
index 551a59823c..bac76357da 100644
--- a/src/plugins/platforms/cocoa/qcocoaapplication.mm
+++ b/src/plugins/platforms/cocoa/qcocoaapplication.mm
@@ -189,6 +189,12 @@ QT_BEGIN_NAMESPACE
void qt_redirectNSApplicationSendEvent()
{
+ if (QCoreApplication::testAttribute(Qt::AA_MacPluginApplication))
+ // In a plugin we cannot chain sendEvent hooks: a second plugin could
+ // store the implementation of the first, which during the program flow
+ // can be unloaded.
+ return;
+
if ([NSApp isMemberOfClass:[QNSApplication class]]) {
// No need to change implementation since Qt
// already controls a subclass of NSApplication
@@ -209,6 +215,10 @@ void qt_redirectNSApplicationSendEvent()
void qt_resetNSApplicationSendEvent()
{
+ if (QCoreApplication::testAttribute(Qt::AA_MacPluginApplication))
+ return;
+
+
qt_cocoa_change_back_implementation([NSApplication class],
@selector(sendEvent:),
@selector(QT_MANGLE_NAMESPACE(qt_sendEvent_original):));
diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
index efe3269d42..326628a261 100644
--- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
+++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
@@ -163,6 +163,9 @@ static void cleanupCocoaApplicationDelegate()
- (NSMenu *)applicationDockMenu:(NSApplication *)sender
{
Q_UNUSED(sender);
+ // Manually invoke the delegate's -menuWillOpen: method.
+ // See QTBUG-39604 (and its fix) for details.
+ [[dockMenu delegate] menuWillOpen:dockMenu];
return [[dockMenu retain] autorelease];
}
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index ebe58be155..e0838cb342 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -369,11 +369,15 @@ void QCocoaIntegration::updateScreens()
return;
QSet<QCocoaScreen*> remainingScreens = QSet<QCocoaScreen*>::fromList(mScreens);
QList<QPlatformScreen *> siblings;
- for (uint i = 0; i < [screens count]; i++) {
+ uint screenCount = [screens count];
+ for (uint i = 0; i < screenCount; i++) {
NSScreen* scr = [screens objectAtIndex:i];
CGDirectDisplayID dpy = [[[scr deviceDescription] objectForKey:@"NSScreenNumber"] unsignedIntValue];
// If this screen is a mirror and is not the primary one of the mirror set, ignore it.
- if (CGDisplayIsInMirrorSet(dpy)) {
+ // Exception: The NSScreen API has been observed to a return a screen list with one
+ // mirrored, non-primary screen when Qt is running as a startup item. Always use the
+ // screen if there's only one screen in the list.
+ if (screenCount > 1 && CGDisplayIsInMirrorSet(dpy)) {
CGDirectDisplayID primary = CGDisplayMirrorsDisplay(dpy);
if (primary != kCGNullDirectDisplay && primary != dpy)
continue;
diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm
index a89979a8ea..3d0201e1a0 100644
--- a/src/plugins/platforms/cocoa/qcocoamenu.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenu.mm
@@ -463,9 +463,8 @@ void QCocoaMenu::showPopup(const QWindow *parentWindow, QPoint pos, const QPlatf
// Else, we need to transform 'pos' to window or screen coordinates.
NSPoint nsPos = NSMakePoint(pos.x() - 1, pos.y());
if (view) {
- // Flip y-coordinate first, the convert to content view space.
- nsPos.y = view.frame.size.height - nsPos.y;
- nsPos = [view convertPoint:nsPos toView:view.window.contentView];
+ // convert coordinates from view to the view's window
+ nsPos = [view convertPoint:nsPos toView:nil];
} else if (!QGuiApplication::screens().isEmpty()) {
QScreen *screen = QGuiApplication::screens().at(0);
nsPos.y = screen->availableVirtualSize().height() - nsPos.y;
diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h
index a75e366a73..dc38bcb83d 100644
--- a/src/plugins/platforms/cocoa/qnsview.h
+++ b/src/plugins/platforms/cocoa/qnsview.h
@@ -48,6 +48,8 @@
#include <QtGui/QImage>
#include <QtGui/QAccessible>
+#include "private/qcore_mac_p.h"
+
QT_BEGIN_NAMESPACE
class QCocoaWindow;
class QCocoaBackingStore;
@@ -56,7 +58,7 @@ QT_END_NAMESPACE
Q_FORWARD_DECLARE_OBJC_CLASS(QNSViewMouseMoveHelper);
-@interface QNSView : NSView <NSTextInputClient> {
+@interface QT_MANGLE_NAMESPACE(QNSView) : NSView <NSTextInputClient> {
QCocoaBackingStore* m_backingStore;
QPoint m_backingStoreOffset;
CGImageRef m_maskImage;
@@ -78,6 +80,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QNSViewMouseMoveHelper);
#endif
NSString *m_inputSource;
QNSViewMouseMoveHelper *m_mouseMoveHelper;
+ bool m_resendKeyEvent;
}
- (id)init;
@@ -138,4 +141,6 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QNSViewMouseMoveHelper);
@end
+QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSView);
+
#endif //QNSVIEW_H
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index cfcbb8053c..d72664f0a0 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -130,7 +130,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil;
@end
-@implementation QNSView
+@implementation QT_MANGLE_NAMESPACE(QNSView)
+ (void)initialize
{
@@ -159,6 +159,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil;
m_sendUpAsRightButton = false;
m_inputSource = 0;
m_mouseMoveHelper = [[QNSViewMouseMoveHelper alloc] initWithView:self];
+ m_resendKeyEvent = false;
if (!touchDevice) {
touchDevice = new QTouchDevice;
@@ -1425,6 +1426,8 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
}
}
}
+ if (m_resendKeyEvent)
+ m_sendKeyEvent = true;
}
if (m_sendKeyEvent && m_composingText.isEmpty())
@@ -1432,6 +1435,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
nativeScanCode, nativeVirtualKey, nativeModifiers, text, [nsevent isARepeat]);
m_sendKeyEvent = false;
+ m_resendKeyEvent = false;
}
- (void)keyDown:(NSEvent *)nsevent
@@ -1502,6 +1506,12 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
}
}
+- (void) insertNewline:(id)sender
+{
+ Q_UNUSED(sender);
+ m_resendKeyEvent = true;
+}
+
- (void) doCommandBySelector:(SEL)aSelector
{
[self tryToPerform:aSelector with:self];
diff --git a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp
index 7ae042cb50..c986a960f3 100644
--- a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp
+++ b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp
@@ -58,7 +58,8 @@ QT_BEGIN_NAMESPACE
QQnxRasterBackingStore::QQnxRasterBackingStore(QWindow *window)
: QPlatformBackingStore(window),
- m_hasUnflushedPaintOperations(false)
+ m_needsPosting(false),
+ m_scrolled(false)
{
qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << window;
@@ -85,10 +86,10 @@ void QQnxRasterBackingStore::flush(QWindow *window, const QRegion &region, const
qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << this->window();
// Sometimes this method is called even though there is nothing to be
- // flushed, for instance, after an expose event directly follows a
- // geometry change event.
- if (!m_hasUnflushedPaintOperations)
- return;
+ // flushed (posted in "screen" parlance), for instance, after an expose
+ // event directly follows a geometry change event.
+ if (!m_needsPosting)
+ return;
QQnxWindow *targetWindow = 0;
if (window)
@@ -99,25 +100,11 @@ void QQnxRasterBackingStore::flush(QWindow *window, const QRegion &region, const
// child windows, are performed; conceptually ,child windows have no buffers
// (actually they do have a 1x1 placeholder buffer due to libscreen limitations),
// since Qt will only draw to the backing store of the top-level window.
- if (!targetWindow || targetWindow == platformWindow()) {
+ if (!targetWindow || targetWindow == platformWindow())
+ platformWindow()->post(region); // update the display with newly rendered content
- // visit all pending scroll operations
- for (int i = m_scrollOpList.size() - 1; i >= 0; i--) {
-
- // do the scroll operation
- ScrollOp &op = m_scrollOpList[i];
- QRegion srcArea = op.totalArea.intersected( op.totalArea.translated(-op.dx, -op.dy) );
- platformWindow()->scroll(srcArea, op.dx, op.dy);
- }
-
- // clear all pending scroll operations
- m_scrollOpList.clear();
-
- // update the display with newly rendered content
- platformWindow()->post(region);
- }
-
- m_hasUnflushedPaintOperations = false;
+ m_needsPosting = false;
+ m_scrolled = false;
}
void QQnxRasterBackingStore::resize(const QSize &size, const QRegion &staticContents)
@@ -134,31 +121,14 @@ bool QQnxRasterBackingStore::scroll(const QRegion &area, int dx, int dy)
{
qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << window();
- // calculate entire region affected by scroll operation (src + dst)
- QRegion totalArea = area.translated(dx, dy);
- totalArea += area;
- m_hasUnflushedPaintOperations = true;
-
- // visit all pending scroll operations
- for (int i = m_scrollOpList.size() - 1; i >= 0; i--) {
-
- ScrollOp &op = m_scrollOpList[i];
- if (op.totalArea == totalArea) {
- // same area is being scrolled again - update delta
- op.dx += dx;
- op.dy += dy;
- return true;
- } else if (op.totalArea.intersects(totalArea)) {
- // current scroll overlaps previous scroll but is
- // not equal in area - just paint everything
- qWarning("QQNX: pending scroll operations overlap but not equal");
- return false;
- }
- }
+ m_needsPosting = true;
- // create new scroll operation
- m_scrollOpList.append( ScrollOp(totalArea, dx, dy) );
- return true;
+ if (!m_scrolled) {
+ platformWindow()->scroll(area, dx, dy, true);
+ m_scrolled = true;
+ return true;
+ }
+ return false;
}
void QQnxRasterBackingStore::beginPaint(const QRegion &region)
@@ -166,7 +136,7 @@ void QQnxRasterBackingStore::beginPaint(const QRegion &region)
Q_UNUSED(region);
qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << window();
- m_hasUnflushedPaintOperations = true;
+ m_needsPosting = true;
platformWindow()->adjustBufferSize();
diff --git a/src/plugins/platforms/qnx/qqnxrasterbackingstore.h b/src/plugins/platforms/qnx/qqnxrasterbackingstore.h
index 35efd68571..d71e274a1d 100644
--- a/src/plugins/platforms/qnx/qqnxrasterbackingstore.h
+++ b/src/plugins/platforms/qnx/qqnxrasterbackingstore.h
@@ -64,19 +64,11 @@ public:
void endPaint();
private:
- class ScrollOp {
- public:
- ScrollOp(const QRegion &a, int x, int y) : totalArea(a), dx(x), dy(y) {}
- QRegion totalArea;
- int dx;
- int dy;
- };
-
QQnxRasterWindow *platformWindow() const;
QWindow *m_window;
- QList<ScrollOp> m_scrollOpList;
- bool m_hasUnflushedPaintOperations;
+ bool m_needsPosting;
+ bool m_scrolled;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp b/src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp
index 08de94a082..232bd80fd0 100644
--- a/src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp
+++ b/src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp
@@ -46,7 +46,7 @@
#include <bps/event.h>
#include <bps/locale.h>
#include <bps/virtualkeyboard.h>
-#if defined(Q_OS_BLACKBERRY)
+#if defined(Q_OS_BLACKBERRY) && !defined(Q_OS_BLACKBERRY_TABLET)
#include <bbndk.h>
#endif
@@ -126,17 +126,21 @@ virtualkeyboard_layout_t QQnxVirtualKeyboardBps::keyboardLayout() const
return VIRTUALKEYBOARD_LAYOUT_WEB;
case NumPunc:
return VIRTUALKEYBOARD_LAYOUT_NUM_PUNC;
+#ifndef Q_OS_BLACKBERRY_TABLET
case Number:
return VIRTUALKEYBOARD_LAYOUT_NUMBER;
+#endif
case Symbol:
return VIRTUALKEYBOARD_LAYOUT_SYMBOL;
case Phone:
return VIRTUALKEYBOARD_LAYOUT_PHONE;
case Pin:
return VIRTUALKEYBOARD_LAYOUT_PIN;
+#ifndef Q_OS_BLACKBERRY_TABLET
case Password:
return VIRTUALKEYBOARD_LAYOUT_PASSWORD;
-#if defined(Q_OS_BLACKBERRY)
+#endif
+#if defined(Q_OS_BLACKBERRY) && !defined(Q_OS_BLACKBERRY_TABLET)
#if BBNDK_VERSION_AT_LEAST(10, 2, 1)
case Alphanumeric:
return VIRTUALKEYBOARD_LAYOUT_ALPHANUMERIC;
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
index b22c35137d..7dbca6c089 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
@@ -1583,11 +1583,11 @@ QStringList QWindowsFontDatabase::extraTryFontsForFamily(const QString &family)
if (!tryFonts) {
LANGID lid = GetUserDefaultLangID();
switch (lid&0xff) {
- case LANG_CHINESE: // Chinese (Taiwan)
- if ( lid == 0x0804 ) // Taiwan
- tryFonts = ch_TW_tryFonts;
- else
+ case LANG_CHINESE: // Chinese
+ if ( lid == 0x0804 || lid == 0x1004) // China mainland and Singapore
tryFonts = ch_CN_tryFonts;
+ else
+ tryFonts = ch_TW_tryFonts; // Taiwan, Hong Kong and Macau
break;
case LANG_JAPANESE:
tryFonts = jp_tryFonts;
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index f6b1eefc13..06b566629b 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -1971,7 +1971,7 @@ void QWindowsWindow::getSizeHints(MINMAXINFO *mmi) const
mmi->ptMaxPosition.x = screen->availableGeometry().x();
mmi->ptMaxPosition.y = screen->availableGeometry().y();
} else if (!screen){
- qWarning() << "effectiveScreen() returned a null screen";
+ qWarning() << "window()->screen() returned a null screen";
}
}
diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp
index 3b13df863e..bcb35f6cf0 100644
--- a/src/plugins/platforms/xcb/qglxintegration.cpp
+++ b/src/plugins/platforms/xcb/qglxintegration.cpp
@@ -165,7 +165,7 @@ static void updateFormatFromContext(QSurfaceFormat &format)
QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlatformOpenGLContext *share,
const QVariant &nativeHandle)
: QPlatformOpenGLContext()
- , m_screen(screen)
+ , m_display(DISPLAY_FROM_XCB(screen))
, m_config(0)
, m_context(0)
, m_shareContext(0)
@@ -200,7 +200,7 @@ void QGLXContext::init(QXcbScreen *screen, QPlatformOpenGLContext *share)
glXCreateContextAttribsARBProc glXCreateContextAttribsARB = 0;
glXCreateContextAttribsARB = (glXCreateContextAttribsARBProc) glXGetProcAddress((const GLubyte*)"glXCreateContextAttribsARB");
- QList<QByteArray> glxExt = QByteArray(glXQueryExtensionsString(DISPLAY_FROM_XCB(m_screen), m_screen->screenNumber())).split(' ');
+ QList<QByteArray> glxExt = QByteArray(glXQueryExtensionsString(m_display, screen->screenNumber())).split(' ');
bool supportsProfiles = glxExt.contains("GLX_ARB_create_context_profile");
// Use glXCreateContextAttribsARB if available
@@ -269,10 +269,10 @@ void QGLXContext::init(QXcbScreen *screen, QPlatformOpenGLContext *share)
contextAttributes << None;
- m_context = glXCreateContextAttribsARB(DISPLAY_FROM_XCB(screen), config, m_shareContext, true, contextAttributes.data());
+ m_context = glXCreateContextAttribsARB(m_display, config, m_shareContext, true, contextAttributes.data());
if (!m_context && m_shareContext) {
// re-try without a shared glx context
- m_context = glXCreateContextAttribsARB(DISPLAY_FROM_XCB(screen), config, 0, true, contextAttributes.data());
+ m_context = glXCreateContextAttribsARB(m_display, config, 0, true, contextAttributes.data());
if (m_context)
m_shareContext = 0;
}
@@ -285,10 +285,10 @@ void QGLXContext::init(QXcbScreen *screen, QPlatformOpenGLContext *share)
if (m_format.renderableType() == QSurfaceFormat::OpenGLES)
return;
- m_context = glXCreateNewContext(DISPLAY_FROM_XCB(screen), config, GLX_RGBA_TYPE, m_shareContext, true);
+ m_context = glXCreateNewContext(m_display, config, GLX_RGBA_TYPE, m_shareContext, true);
if (!m_context && m_shareContext) {
// re-try without a shared glx context
- m_context = glXCreateNewContext(DISPLAY_FROM_XCB(screen), config, GLX_RGBA_TYPE, 0, true);
+ m_context = glXCreateNewContext(m_display, config, GLX_RGBA_TYPE, 0, true);
if (m_context)
m_shareContext = 0;
}
@@ -306,14 +306,14 @@ void QGLXContext::init(QXcbScreen *screen, QPlatformOpenGLContext *share)
return;
// Note that m_format gets updated with the used surface format
- visualInfo = qglx_findVisualInfo(DISPLAY_FROM_XCB(screen), screen->screenNumber(), &m_format);
+ visualInfo = qglx_findVisualInfo(m_display, screen->screenNumber(), &m_format);
if (!visualInfo)
qFatal("Could not initialize GLX");
- m_context = glXCreateContext(DISPLAY_FROM_XCB(screen), visualInfo, m_shareContext, true);
+ m_context = glXCreateContext(m_display, visualInfo, m_shareContext, true);
if (!m_context && m_shareContext) {
// re-try without a shared glx context
m_shareContext = 0;
- m_context = glXCreateContext(DISPLAY_FROM_XCB(screen), visualInfo, 0, true);
+ m_context = glXCreateContext(m_display, visualInfo, Q_NULLPTR, true);
}
// Create a temporary window so that we can make the new context current
@@ -325,13 +325,15 @@ void QGLXContext::init(QXcbScreen *screen, QPlatformOpenGLContext *share)
if (m_context && window) {
GLXContext prevContext = glXGetCurrentContext();
GLXDrawable prevDrawable = glXGetCurrentDrawable();
- glXMakeCurrent(DISPLAY_FROM_XCB(screen), window, m_context);
+ glXMakeCurrent(m_display, window, m_context);
updateFormatFromContext(m_format);
- glXMakeCurrent(DISPLAY_FROM_XCB(screen), prevDrawable, prevContext);
+
+ // Make our context non-current
+ glXMakeCurrent(m_display, prevDrawable, prevContext);
}
// Destroy our temporary window
- XDestroyWindow(DISPLAY_FROM_XCB(screen), window);
+ XDestroyWindow(m_display, window);
}
void QGLXContext::init(QXcbScreen *screen, QPlatformOpenGLContext *share, const QVariant &nativeHandle)
@@ -449,7 +451,18 @@ void QGLXContext::init(QXcbScreen *screen, QPlatformOpenGLContext *share, const
QGLXContext::~QGLXContext()
{
if (m_ownsContext)
- glXDestroyContext(DISPLAY_FROM_XCB(m_screen), m_context);
+ glXDestroyContext(m_display, m_context);
+}
+
+static QXcbScreen *screenForPlatformSurface(QPlatformSurface *surface)
+{
+ QSurface::SurfaceClass surfaceClass = surface->surface()->surfaceClass();
+ if (surfaceClass == QSurface::Window) {
+ return static_cast<QXcbScreen *>(static_cast<QXcbWindow *>(surface)->screen());
+ } else if (surfaceClass == QSurface::Offscreen) {
+ return static_cast<QXcbScreen *>(static_cast<QGLXPbuffer *>(surface)->screen());
+ }
+ return Q_NULLPTR;
}
QVariant QGLXContext::nativeHandle() const
@@ -462,24 +475,24 @@ bool QGLXContext::makeCurrent(QPlatformSurface *surface)
bool success = false;
Q_ASSERT(surface->surface()->supportsOpenGL());
- Display *dpy = DISPLAY_FROM_XCB(m_screen);
GLXDrawable glxDrawable = 0;
QSurface::SurfaceClass surfaceClass = surface->surface()->surfaceClass();
if (surfaceClass == QSurface::Window) {
m_isPBufferCurrent = false;
QXcbWindow *window = static_cast<QXcbWindow *>(surface);
glxDrawable = window->xcb_window();
- success = glXMakeCurrent(dpy, glxDrawable, m_context);
+ success = glXMakeCurrent(m_display, glxDrawable, m_context);
} else if (surfaceClass == QSurface::Offscreen) {
m_isPBufferCurrent = true;
QGLXPbuffer *pbuffer = static_cast<QGLXPbuffer *>(surface);
glxDrawable = pbuffer->pbuffer();
- success = glXMakeContextCurrent(dpy, glxDrawable, glxDrawable, m_context);
+ success = glXMakeContextCurrent(m_display, glxDrawable, glxDrawable, m_context);
}
if (success) {
int interval = surface->format().swapInterval();
- if (interval >= 0 && m_swapInterval != interval) {
+ QXcbScreen *screen = screenForPlatformSurface(surface);
+ if (interval >= 0 && m_swapInterval != interval && screen) {
m_swapInterval = interval;
typedef void (*qt_glXSwapIntervalEXT)(Display *, GLXDrawable, int);
typedef void (*qt_glXSwapIntervalMESA)(unsigned int);
@@ -488,15 +501,15 @@ bool QGLXContext::makeCurrent(QPlatformSurface *surface)
static bool resolved = false;
if (!resolved) {
resolved = true;
- QList<QByteArray> glxExt = QByteArray(glXQueryExtensionsString(dpy,
- m_screen->screenNumber())).split(' ');
+ QList<QByteArray> glxExt = QByteArray(glXQueryExtensionsString(m_display,
+ screen->screenNumber())).split(' ');
if (glxExt.contains("GLX_EXT_swap_control"))
glXSwapIntervalEXT = (qt_glXSwapIntervalEXT) getProcAddress("glXSwapIntervalEXT");
if (glxExt.contains("GLX_MESA_swap_control"))
glXSwapIntervalMESA = (qt_glXSwapIntervalMESA) getProcAddress("glXSwapIntervalMESA");
}
if (glXSwapIntervalEXT)
- glXSwapIntervalEXT(dpy, glxDrawable, interval);
+ glXSwapIntervalEXT(m_display, glxDrawable, interval);
else if (glXSwapIntervalMESA)
glXSwapIntervalMESA(interval);
}
@@ -508,9 +521,9 @@ bool QGLXContext::makeCurrent(QPlatformSurface *surface)
void QGLXContext::doneCurrent()
{
if (m_isPBufferCurrent)
- glXMakeContextCurrent(DISPLAY_FROM_XCB(m_screen), 0, 0, 0);
+ glXMakeContextCurrent(m_display, 0, 0, 0);
else
- glXMakeCurrent(DISPLAY_FROM_XCB(m_screen), 0, 0);
+ glXMakeCurrent(m_display, 0, 0);
m_isPBufferCurrent = false;
}
@@ -521,7 +534,7 @@ void QGLXContext::swapBuffers(QPlatformSurface *surface)
glxDrawable = static_cast<QGLXPbuffer *>(surface)->pbuffer();
else
glxDrawable = static_cast<QXcbWindow *>(surface)->xcb_window();
- glXSwapBuffers(DISPLAY_FROM_XCB(m_screen), glxDrawable);
+ glXSwapBuffers(m_display, glxDrawable);
if (surface->surface()->surfaceClass() == QSurface::Window) {
QXcbWindow *platformWindow = static_cast<QXcbWindow *>(surface);
@@ -542,7 +555,7 @@ void (*QGLXContext::getProcAddress(const QByteArray &procName)) ()
if (resolved && !glXGetProcAddressARB)
return 0;
if (!glXGetProcAddressARB) {
- QList<QByteArray> glxExt = QByteArray(glXGetClientString(DISPLAY_FROM_XCB(m_screen), GLX_EXTENSIONS)).split(' ');
+ QList<QByteArray> glxExt = QByteArray(glXGetClientString(m_display, GLX_EXTENSIONS)).split(' ');
if (glxExt.contains("GLX_ARB_get_proc_address")) {
#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4)
void *handle = dlopen(NULL, RTLD_LAZY);
diff --git a/src/plugins/platforms/xcb/qglxintegration.h b/src/plugins/platforms/xcb/qglxintegration.h
index abe3216ad7..2acf262bd0 100644
--- a/src/plugins/platforms/xcb/qglxintegration.h
+++ b/src/plugins/platforms/xcb/qglxintegration.h
@@ -84,6 +84,7 @@ private:
void init(QXcbScreen *screen, QPlatformOpenGLContext *share, const QVariant &nativeHandle);
QXcbScreen *m_screen;
+ Display *m_display;
GLXFBConfig m_config;
GLXContext m_context;
GLXContext m_shareContext;
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index ed5fe6d7c0..636914fd07 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -414,6 +414,9 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra
qunsetenv("DESKTOP_STARTUP_ID");
sync();
+
+ if (qEnvironmentVariableIsEmpty("QT_IM_MODULE"))
+ qputenv("QT_IM_MODULE", QByteArray("compose"));
}
QXcbConnection::~QXcbConnection()
@@ -494,7 +497,7 @@ break;
if (QXcbWindowEventListener *eventListener = windowEventListenerFromId(e->event)) { \
handled = eventListener->handleGenericEvent(event, &result); \
if (!handled) \
- m_keyboard->handler(m_focusWindow ? m_focusWindow : eventListener, e); \
+ m_keyboard->handler(e); \
} \
} \
break;
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
index 879862b9d2..72bd22983e 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
@@ -164,7 +164,10 @@ void QXcbConnection::xi2SetupDevices()
if (bci->num_buttons >= 5) {
Atom label4 = bci->labels[3];
Atom label5 = bci->labels[4];
- if ((!label4 || qatom(label4) == QXcbAtom::ButtonWheelUp) && (!label5 || qatom(label5) == QXcbAtom::ButtonWheelDown))
+ // Some drivers have no labels on the wheel buttons, some have no label on just one and some have no label on
+ // button 4 and the wrong one on button 5. So we just check that they are not labelled with unrelated buttons.
+ if ((!label4 || qatom(label4) == QXcbAtom::ButtonWheelUp || qatom(label4) == QXcbAtom::ButtonWheelDown) &&
+ (!label5 || qatom(label5) == QXcbAtom::ButtonWheelUp || qatom(label5) == QXcbAtom::ButtonWheelDown))
scrollingDevice.legacyOrientations |= Qt::Vertical;
}
if (bci->num_buttons >= 7) {
diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
index c52714b456..dd2a9fcaed 100644
--- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
@@ -1299,7 +1299,7 @@ private:
bool m_release;
};
-void QXcbKeyboard::handleKeyEvent(QWindow *window, QEvent::Type type, xcb_keycode_t code,
+void QXcbKeyboard::handleKeyEvent(xcb_window_t sourceWindow, QEvent::Type type, xcb_keycode_t code,
quint16 state, xcb_timestamp_t time)
{
Q_XCB_NOOP(connection());
@@ -1307,6 +1307,13 @@ void QXcbKeyboard::handleKeyEvent(QWindow *window, QEvent::Type type, xcb_keycod
if (!m_config)
return;
+ QXcbWindow *source = connection()->platformWindowFromId(sourceWindow);
+ QXcbWindow *targetWindow = connection()->focusWindow() ? connection()->focusWindow() : source;
+ if (!targetWindow || !source)
+ return;
+ if (type == QEvent::KeyPress)
+ targetWindow->updateNetWmUserTime(time);
+
// It is crucial the order of xkb_state_key_get_one_sym & xkb_state_update_key operations is not reversed!
xcb_keysym_t sym = xkb_state_key_get_one_sym(xkb_state, code);
@@ -1347,7 +1354,7 @@ void QXcbKeyboard::handleKeyEvent(QWindow *window, QEvent::Type type, xcb_keycod
}
} else {
// look ahead for auto-repeat
- KeyChecker checker(((QXcbWindow *)window->handle())->xcb_window(), code, time);
+ KeyChecker checker(source->xcb_window(), code, time);
xcb_generic_event_t *event = connection()->checkEvent(checker);
if (event) {
isAutoRepeat = true;
@@ -1363,6 +1370,7 @@ void QXcbKeyboard::handleKeyEvent(QWindow *window, QEvent::Type type, xcb_keycod
filtered = inputContext->filterEvent(&event);
}
+ QWindow *window = targetWindow->window();
if (!filtered) {
if (type == QEvent::KeyPress && qtcode == Qt::Key_Menu) {
const QPoint globalPos = window->screen()->handle()->cursor()->pos();
@@ -1405,21 +1413,14 @@ QString QXcbKeyboard::lookupString(struct xkb_state *state, xcb_keycode_t code)
return QString::fromUtf8(chars);
}
-void QXcbKeyboard::handleKeyPressEvent(QXcbWindowEventListener *eventListener, const xcb_key_press_event_t *event)
+void QXcbKeyboard::handleKeyPressEvent(const xcb_key_press_event_t *event)
{
- QXcbWindow *window = eventListener->toWindow();
- if (!window)
- return;
- window->updateNetWmUserTime(event->time);
- handleKeyEvent(window->window(), QEvent::KeyPress, event->detail, event->state, event->time);
+ handleKeyEvent(event->event, QEvent::KeyPress, event->detail, event->state, event->time);
}
-void QXcbKeyboard::handleKeyReleaseEvent(QXcbWindowEventListener *eventListener, const xcb_key_release_event_t *event)
+void QXcbKeyboard::handleKeyReleaseEvent(const xcb_key_release_event_t *event)
{
- QXcbWindow *window = eventListener->toWindow();
- if (!window)
- return;
- handleKeyEvent(window->window(), QEvent::KeyRelease, event->detail, event->state, event->time);
+ handleKeyEvent(event->event, QEvent::KeyRelease, event->detail, event->state, event->time);
}
void QXcbKeyboard::handleMappingNotifyEvent(const void *event)
diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.h b/src/plugins/platforms/xcb/qxcbkeyboard.h
index 11b7429aca..e816d3c003 100644
--- a/src/plugins/platforms/xcb/qxcbkeyboard.h
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.h
@@ -64,8 +64,8 @@ public:
~QXcbKeyboard();
- void handleKeyPressEvent(QXcbWindowEventListener *eventListener, const xcb_key_press_event_t *event);
- void handleKeyReleaseEvent(QXcbWindowEventListener *eventListener, const xcb_key_release_event_t *event);
+ void handleKeyPressEvent(const xcb_key_press_event_t *event);
+ void handleKeyReleaseEvent(const xcb_key_release_event_t *event);
void handleMappingNotifyEvent(const void *event);
Qt::KeyboardModifiers translateModifiers(int s) const;
@@ -83,7 +83,7 @@ public:
#endif
protected:
- void handleKeyEvent(QWindow *window, QEvent::Type type, xcb_keycode_t code, quint16 state, xcb_timestamp_t time);
+ void handleKeyEvent(xcb_window_t sourceWindow, QEvent::Type type, xcb_keycode_t code, quint16 state, xcb_timestamp_t time);
void resolveMaskConflicts();
QString lookupString(struct xkb_state *state, xcb_keycode_t code) const;
diff --git a/src/plugins/platforms/xcb/xcb-plugin.pro b/src/plugins/platforms/xcb/xcb-plugin.pro
index f227076b3b..9aaafadcad 100644
--- a/src/plugins/platforms/xcb/xcb-plugin.pro
+++ b/src/plugins/platforms/xcb/xcb-plugin.pro
@@ -95,6 +95,7 @@ contains(QT_CONFIG, opengl) {
DEFINES += $$QMAKE_DEFINES_XCB
LIBS += $$QMAKE_LIBS_XCB
QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XCB
+QMAKE_CFLAGS += $$QMAKE_CFLAGS_XCB
CONFIG += qpa/genericunixfontdatabase
diff --git a/src/plugins/platforms/xcb/xcb-static/xcb-static.pro b/src/plugins/platforms/xcb/xcb-static/xcb-static.pro
index dfdcb2e83a..d0fe282b14 100644
--- a/src/plugins/platforms/xcb/xcb-static/xcb-static.pro
+++ b/src/plugins/platforms/xcb/xcb-static/xcb-static.pro
@@ -10,6 +10,9 @@ XCB_DIR = ../../../../3rdparty/xcb
INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/include/xcb $$XCB_DIR/sysinclude
+QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XCB
+QMAKE_CFLAGS += $$QMAKE_CFLAGS_XCB
+
# ignore compiler warnings in 3rdparty code
QMAKE_CFLAGS_STATIC_LIB+=-w
diff --git a/src/plugins/printsupport/cups/qcupsprintersupport_p.h b/src/plugins/printsupport/cups/qcupsprintersupport_p.h
index 1cba4e997b..9fe5f28850 100644
--- a/src/plugins/printsupport/cups/qcupsprintersupport_p.h
+++ b/src/plugins/printsupport/cups/qcupsprintersupport_p.h
@@ -43,6 +43,17 @@
#ifndef QCUPSPRINTERSUPPORT_H
#define QCUPSPRINTERSUPPORT_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <qpa/qplatformprintersupport.h>
#ifndef QT_NO_PRINTER