summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-12-05 13:32:35 +0100
committerLiang Qi <liang.qi@qt.io>2017-12-05 13:37:21 +0100
commit53b141dcebc2ca423dbc31e5b6321a769155e9a4 (patch)
treee62c7d9875acab8094d64d137c90e7e5f53c0893 /src/plugins
parent2c6c044500a92a3a125ce4b5d936992bdf02a487 (diff)
parent6508fdca1dcc7105947befadba272d0fd4bbc27f (diff)
Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts: src/plugins/platforms/ios/quiview.mm Change-Id: I88384c70047391c75d9ff166c8d9881ff6751dbf
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/ios/qiosapplicationstate.mm2
-rw-r--r--src/plugins/platforms/ios/qioseventdispatcher.mm14
-rw-r--r--src/plugins/platforms/ios/qiosscreen.mm36
-rw-r--r--src/plugins/platforms/ios/qiostextresponder.mm1
-rw-r--r--src/plugins/platforms/ios/quiview.mm14
-rw-r--r--src/plugins/platforms/xcb/qxcbdrag.cpp11
-rw-r--r--src/plugins/platforms/xcb/qxcbdrag.h4
-rw-r--r--src/plugins/sqldrivers/db2/db2.pro2
-rw-r--r--src/plugins/sqldrivers/db2/qsql_db2.cpp28
-rw-r--r--src/plugins/sqldrivers/psql/qsql_psql.cpp2
10 files changed, 70 insertions, 44 deletions
diff --git a/src/plugins/platforms/ios/qiosapplicationstate.mm b/src/plugins/platforms/ios/qiosapplicationstate.mm
index 13e7e1150f..7c8e1f9927 100644
--- a/src/plugins/platforms/ios/qiosapplicationstate.mm
+++ b/src/plugins/platforms/ios/qiosapplicationstate.mm
@@ -75,7 +75,7 @@ static void handleApplicationStateChanged(UIApplicationState uiApplicationState)
{
Qt::ApplicationState state = qtApplicationState(uiApplicationState);
qCDebug(lcQpaApplication) << "moved to" << state;
- QWindowSystemInterface::handleApplicationStateChanged<QWindowSystemInterface::SynchronousDelivery>(state);
+ QWindowSystemInterface::handleApplicationStateChanged(state);
}
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/ios/qioseventdispatcher.mm b/src/plugins/platforms/ios/qioseventdispatcher.mm
index cf7680529a..de2c30cdfb 100644
--- a/src/plugins/platforms/ios/qioseventdispatcher.mm
+++ b/src/plugins/platforms/ios/qioseventdispatcher.mm
@@ -294,7 +294,7 @@ static bool rootLevelRunLoopIntegration()
{
[[NSNotificationCenter defaultCenter]
addObserver:self
- selector:@selector(applicationDidFinishLaunching)
+ selector:@selector(applicationDidFinishLaunching:)
name:UIApplicationDidFinishLaunchingNotification
object:nil];
@@ -320,8 +320,10 @@ static bool rootLevelRunLoopIntegration()
# error "Unknown processor family"
#endif
-+ (void)applicationDidFinishLaunching
++ (void)applicationDidFinishLaunching:(NSNotification *)notification
{
+ qCDebug(lcQpaApplication) << "Application launched with options" << notification.userInfo;
+
if (!isQtApplication())
return;
@@ -329,7 +331,7 @@ static bool rootLevelRunLoopIntegration()
// We schedule the main-redirection for the next run-loop pass, so that we
// can return from this function and let UIApplicationMain finish its job.
// This results in running Qt's application eventloop as a nested runloop.
- qEventDispatcherDebug() << "Scheduling main() on next run-loop pass";
+ qCDebug(lcQpaApplication) << "Scheduling main() on next run-loop pass";
CFRunLoopTimerRef userMainTimer = CFRunLoopTimerCreateWithHandler(kCFAllocatorDefault,
CFAbsoluteTimeGetCurrent(), 0, 0, 0, ^(CFRunLoopTimerRef) { user_main_trampoline(); });
CFRunLoopAddTimer(CFRunLoopGetMain(), userMainTimer, kCFRunLoopCommonModes);
@@ -339,7 +341,7 @@ static bool rootLevelRunLoopIntegration()
switch (setjmp(processEventEnterJumpPoint)) {
case kJumpPointSetSuccessfully:
- qEventDispatcherDebug() << "Running main() on separate stack"; qIndent();
+ qCDebug(lcQpaApplication) << "Running main() on separate stack"; qIndent();
// Redirect the stack pointer to the start of the reserved stack. This ensures
// that when we longjmp out of the event dispatcher and continue execution, the
@@ -358,7 +360,7 @@ static bool rootLevelRunLoopIntegration()
case kJumpedFromEventDispatcherProcessEvents:
// We've returned from the longjmp in the event dispatcher,
// and the stack has been restored to its old self.
- qUnIndent(); qEventDispatcherDebug() << "Returned from processEvents";
+ qUnIndent(); qCDebug(lcQpaApplication) << "Returned from processEvents";
if (Q_UNLIKELY(debugStackUsage))
userMainStack.printUsage();
@@ -422,6 +424,8 @@ QIOSEventDispatcher::QIOSEventDispatcher(QObject *parent)
, m_processEventLevel(0)
, m_runLoopExitObserver(this, &QIOSEventDispatcher::handleRunLoopExit, kCFRunLoopExit)
{
+ // We want all delivery of events from the system to be handled synchronously
+ QWindowSystemInterface::setSynchronousWindowSystemEvents(true);
}
bool __attribute__((returns_twice)) QIOSEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm
index e8854a4c4b..7c88cddd54 100644
--- a/src/plugins/platforms/ios/qiosscreen.mm
+++ b/src/plugins/platforms/ios/qiosscreen.mm
@@ -180,12 +180,12 @@ QT_BEGIN_NAMESPACE
/*!
Returns the model identifier of the device.
-
- When running under the simulator, the identifier will not
- match the simulated device, but will be x86_64 or i386.
*/
static QString deviceModelIdentifier()
{
+#if TARGET_OS_SIMULATOR
+ return QString::fromLocal8Bit(qgetenv("SIMULATOR_MODEL_IDENTIFIER"));
+#else
static const char key[] = "hw.machine";
size_t size;
@@ -195,6 +195,7 @@ static QString deviceModelIdentifier()
sysctlbyname(key, &value, &size, NULL, 0);
return QString::fromLatin1(value);
+#endif
}
QIOSScreen::QIOSScreen(UIScreen *screen)
@@ -203,25 +204,30 @@ QIOSScreen::QIOSScreen(UIScreen *screen)
, m_uiWindow(0)
, m_orientationListener(0)
{
- if (screen == [UIScreen mainScreen]) {
- QString deviceIdentifier = deviceModelIdentifier();
+ QString deviceIdentifier = deviceModelIdentifier();
+ if (screen == [UIScreen mainScreen] && !deviceIdentifier.startsWith("AppleTV")) {
// Based on https://en.wikipedia.org/wiki/List_of_iOS_devices#Display
// iPhone (1st gen), 3G, 3GS, and iPod Touch (1st–3rd gen) are 18-bit devices
- if (deviceIdentifier.contains(QRegularExpression("^(iPhone1,[12]|iPhone2,1|iPod[1-3],1)$")))
- m_depth = 18;
- else
- m_depth = 24;
+ static QRegularExpression lowBitDepthDevices("^(iPhone1,[12]|iPhone2,1|iPod[1-3],1)$");
+ m_depth = deviceIdentifier.contains(lowBitDepthDevices) ? 18 : 24;
+
+ static QRegularExpression iPhoneXModels("^iPhone(10,[36])$");
+ static QRegularExpression iPhonePlusModels("^iPhone(7,1|8,2|9,[24]|10,[25])$");
+ static QRegularExpression iPadMiniModels("^iPad(2,[567]|4,[4-9]|5,[12])$");
- if (deviceIdentifier.contains(QRegularExpression("^iPhone(7,1|8,2|9,2|9,4)$"))) {
- // iPhone Plus models
+ if (deviceIdentifier.contains(iPhoneXModels)) {
+ m_physicalDpi = 458;
+ } else if (deviceIdentifier.contains(iPhonePlusModels)) {
m_physicalDpi = 401;
- } else if (deviceIdentifier.contains(QRegularExpression("^iPad(1,1|2,[1-4]|3,[1-6]|4,[1-3]|5,[3-4]|6,[7-8])$"))) {
- // All iPads except the iPad Mini series
- m_physicalDpi = 132 * devicePixelRatio();
+ } else if (deviceIdentifier.startsWith("iPad")) {
+ if (deviceIdentifier.contains(iPadMiniModels))
+ m_physicalDpi = 163 * devicePixelRatio();
+ else
+ m_physicalDpi = 132 * devicePixelRatio();
} else {
- // All non-Plus iPhones, and iPad Minis
+ // All normal iPhones, and iPods
m_physicalDpi = 163 * devicePixelRatio();
}
} else {
diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm
index 7d48a012dd..b029c49a67 100644
--- a/src/plugins/platforms/ios/qiostextresponder.mm
+++ b/src/plugins/platforms/ios/qiostextresponder.mm
@@ -377,7 +377,6 @@
QScopedValueRollback<BOOL> rollback(m_inSendEventToFocusObject, true);
QWindowSystemInterface::handleKeyEvent(qApp->focusWindow(), QEvent::KeyPress, key, modifiers);
QWindowSystemInterface::handleKeyEvent(qApp->focusWindow(), QEvent::KeyRelease, key, modifiers);
- QWindowSystemInterface::flushWindowSystemEvents();
}
#ifndef QT_NO_SHORTCUT
diff --git a/src/plugins/platforms/ios/quiview.mm b/src/plugins/platforms/ios/quiview.mm
index a56530e1d9..a2ecc8c3cd 100644
--- a/src/plugins/platforms/ios/quiview.mm
+++ b/src/plugins/platforms/ios/quiview.mm
@@ -161,7 +161,7 @@
QRect lastReportedGeometry = qt_window_private(window)->geometry;
QRect currentGeometry = QRectF::fromCGRect(self.frame).toRect();
qCDebug(lcQpaWindow) << m_qioswindow->window() << "new geometry is" << currentGeometry;
- QWindowSystemInterface::handleGeometryChange<QWindowSystemInterface::SynchronousDelivery>(window, currentGeometry);
+ QWindowSystemInterface::handleGeometryChange(window, currentGeometry);
if (currentGeometry.size() != lastReportedGeometry.size()) {
// Trigger expose event on resize
@@ -194,7 +194,7 @@
}
qCDebug(lcQpaWindow) << m_qioswindow->window() << region << "isExposed" << m_qioswindow->isExposed();
- QWindowSystemInterface::handleExposeEvent<QWindowSystemInterface::SynchronousDelivery>(m_qioswindow->window(), region);
+ QWindowSystemInterface::handleExposeEvent(m_qioswindow->window(), region);
}
// -------------------------------------------------------------------------
@@ -225,7 +225,7 @@
}
if (qGuiApp->focusWindow() != m_qioswindow->window())
- QWindowSystemInterface::handleWindowActivated<QWindowSystemInterface::SynchronousDelivery>(m_qioswindow->window());
+ QWindowSystemInterface::handleWindowActivated(m_qioswindow->window());
else
qImDebug() << m_qioswindow->window() << "already active, not sending window activation";
@@ -263,7 +263,7 @@
UIResponder *newResponder = FirstResponderCandidate::currentCandidate();
if ([self responderShouldTriggerWindowDeactivation:newResponder])
- QWindowSystemInterface::handleWindowActivated<QWindowSystemInterface::SynchronousDelivery>(0);
+ QWindowSystemInterface::handleWindowActivated(0);
return YES;
}
@@ -354,7 +354,7 @@
- (void)sendTouchEventWithTimestamp:(ulong)timeStamp
{
QIOSIntegration *iosIntegration = QIOSIntegration::instance();
- QWindowSystemInterface::handleTouchEvent<QWindowSystemInterface::SynchronousDelivery>(m_qioswindow->window(), timeStamp, iosIntegration->touchDevice(), m_activeTouches.values());
+ QWindowSystemInterface::handleTouchEvent(m_qioswindow->window(), timeStamp, iosIntegration->touchDevice(), m_activeTouches.values());
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
@@ -433,7 +433,7 @@
NSTimeInterval timestamp = event ? event.timestamp : [[NSProcessInfo processInfo] systemUptime];
QIOSIntegration *iosIntegration = static_cast<QIOSIntegration *>(QGuiApplicationPrivate::platformIntegration());
- QWindowSystemInterface::handleTouchCancelEvent<QWindowSystemInterface::SynchronousDelivery>(m_qioswindow->window(), ulong(timestamp * 1000), iosIntegration->touchDevice());
+ QWindowSystemInterface::handleTouchCancelEvent(m_qioswindow->window(), ulong(timestamp * 1000), iosIntegration->touchDevice());
}
- (int)mapPressTypeToKey:(UIPress*)press
@@ -461,7 +461,7 @@
int key = [self mapPressTypeToKey:press];
if (key == Qt::Key_unknown)
continue;
- if (QWindowSystemInterface::handleKeyEvent<QWindowSystemInterface::SynchronousDelivery>(m_qioswindow->window(), type, key, Qt::NoModifier))
+ if (QWindowSystemInterface::handleKeyEvent(m_qioswindow->window(), type, key, Qt::NoModifier))
handled = true;
}
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp
index d4521de8e0..1e963268ef 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.cpp
+++ b/src/plugins/platforms/xcb/qxcbdrag.cpp
@@ -165,6 +165,9 @@ void QXcbDrag::init()
QXcbCursor::queryPointer(connection(), &current_virtual_desktop, 0);
drag_types.clear();
+
+ dropped = false;
+ canceled = false;
}
bool QXcbDrag::eventFilter(QObject *o, QEvent *e)
@@ -215,6 +218,10 @@ void QXcbDrag::startDrag()
void QXcbDrag::endDrag()
{
QBasicDrag::endDrag();
+ if (!dropped && !canceled && canDrop()) {
+ // Set executed drop action when dropping outside application.
+ setExecutedDropAction(accepted_drop_action);
+ }
initiatorWindow.clear();
}
@@ -989,6 +996,8 @@ void QXcbDrag::handleDrop(QPlatformWindow *, const xcb_client_message_event_t *e
// reset
target_time = XCB_CURRENT_TIME;
+
+ dropped = true;
}
@@ -1087,6 +1096,8 @@ void QXcbDrag::cancel()
// remove canceled object
currentDrag()->deleteLater();
+
+ canceled = true;
}
// find an ancestor with XdndAware on it
diff --git a/src/plugins/platforms/xcb/qxcbdrag.h b/src/plugins/platforms/xcb/qxcbdrag.h
index f261cc1322..31f1c47d83 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.h
+++ b/src/plugins/platforms/xcb/qxcbdrag.h
@@ -135,6 +135,10 @@ private:
QRect source_sameanswer;
bool waiting_for_status;
+ // helpers for setting executed drop action outside application
+ bool dropped;
+ bool canceled;
+
// top-level window we sent position to last.
xcb_window_t current_target;
// window to send events to (always valid if current_target)
diff --git a/src/plugins/sqldrivers/db2/db2.pro b/src/plugins/sqldrivers/db2/db2.pro
index eef65fac66..b99fe91fe3 100644
--- a/src/plugins/sqldrivers/db2/db2.pro
+++ b/src/plugins/sqldrivers/db2/db2.pro
@@ -7,5 +7,7 @@ QMAKE_USE += db2
OTHER_FILES += db2.json
+equals(QT_ARCH, x86_64): DEFINES += ODBC64
+
PLUGIN_CLASS_NAME = QDB2DriverPlugin
include(../qsqldriverbase.pri)
diff --git a/src/plugins/sqldrivers/db2/qsql_db2.cpp b/src/plugins/sqldrivers/db2/qsql_db2.cpp
index 1a9631f1eb..2bfd99cfa9 100644
--- a/src/plugins/sqldrivers/db2/qsql_db2.cpp
+++ b/src/plugins/sqldrivers/db2/qsql_db2.cpp
@@ -272,7 +272,7 @@ static QSqlField qMakeFieldInfo(const QDB2ResultPrivate* d, int i)
{
SQLSMALLINT colNameLen;
SQLSMALLINT colType;
- SQLUINTEGER colSize;
+ SQLULEN colSize;
SQLSMALLINT colScale;
SQLSMALLINT nullable;
SQLRETURN r = SQL_ERROR;
@@ -314,7 +314,7 @@ static int qGetIntData(SQLHANDLE hStmt, int column, bool& isNull)
{
SQLINTEGER intbuf;
isNull = false;
- SQLINTEGER lengthIndicator = 0;
+ SQLLEN lengthIndicator = 0;
SQLRETURN r = SQLGetData(hStmt,
column + 1,
SQL_C_SLONG,
@@ -332,7 +332,7 @@ static double qGetDoubleData(SQLHANDLE hStmt, int column, bool& isNull)
{
SQLDOUBLE dblbuf;
isNull = false;
- SQLINTEGER lengthIndicator = 0;
+ SQLLEN lengthIndicator = 0;
SQLRETURN r = SQLGetData(hStmt,
column+1,
SQL_C_DOUBLE,
@@ -351,7 +351,7 @@ static SQLBIGINT qGetBigIntData(SQLHANDLE hStmt, int column, bool& isNull)
{
SQLBIGINT lngbuf = Q_INT64_C(0);
isNull = false;
- SQLINTEGER lengthIndicator = 0;
+ SQLLEN lengthIndicator = 0;
SQLRETURN r = SQLGetData(hStmt,
column+1,
SQL_C_SBIGINT,
@@ -368,7 +368,7 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool& is
{
QString fieldVal;
SQLRETURN r = SQL_ERROR;
- SQLINTEGER lengthIndicator = 0;
+ SQLLEN lengthIndicator = 0;
if (colSize <= 0)
colSize = 255;
@@ -404,12 +404,12 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool& is
return fieldVal;
}
-static QByteArray qGetBinaryData(SQLHANDLE hStmt, int column, SQLINTEGER& lengthIndicator, bool& isNull)
+static QByteArray qGetBinaryData(SQLHANDLE hStmt, int column, SQLLEN& lengthIndicator, bool& isNull)
{
QByteArray fieldVal;
SQLSMALLINT colNameLen;
SQLSMALLINT colType;
- SQLUINTEGER colSize;
+ SQLULEN colSize;
SQLSMALLINT colScale;
SQLSMALLINT nullable;
SQLRETURN r = SQL_ERROR;
@@ -643,9 +643,9 @@ bool QDB2Result::exec()
{
Q_D(QDB2Result);
QList<QByteArray> tmpStorage; // holds temporary ptrs
- QVarLengthArray<SQLINTEGER, 32> indicators(boundValues().count());
+ QVarLengthArray<SQLLEN, 32> indicators(boundValues().count());
- memset(indicators.data(), 0, indicators.size() * sizeof(SQLINTEGER));
+ memset(indicators.data(), 0, indicators.size() * sizeof(SQLLEN));
setActive(false);
setAt(QSql::BeforeFirstRow);
SQLRETURN r;
@@ -661,7 +661,7 @@ bool QDB2Result::exec()
int i;
for (i = 0; i < values.count(); ++i) {
// bind parameters - only positional binding allowed
- SQLINTEGER *ind = &indicators[i];
+ SQLLEN *ind = &indicators[i];
if (values.at(i).isNull())
*ind = SQL_NULL_DATA;
if (bindValueType(i) & QSql::Out)
@@ -1006,7 +1006,7 @@ QVariant QDB2Result::data(int field)
return QVariant();
}
SQLRETURN r = 0;
- SQLINTEGER lengthIndicator = 0;
+ SQLLEN lengthIndicator = 0;
bool isNull = false;
const QSqlField info = d->recInf.field(field);
@@ -1119,7 +1119,7 @@ bool QDB2Result::isNull(int i)
int QDB2Result::numRowsAffected()
{
Q_D(const QDB2Result);
- SQLINTEGER affectedRowCount = 0;
+ SQLLEN affectedRowCount = 0;
SQLRETURN r = SQLRowCount(d->hStmt, &affectedRowCount);
if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO)
return affectedRowCount;
@@ -1248,7 +1248,7 @@ bool QDB2Driver::open(const QString& db, const QString& user, const QString& pas
const QString opt(tmp.left(idx));
const QString val(tmp.mid(idx + 1).simplified());
- SQLUINTEGER v = 0;
+ SQLULEN v = 0;
r = SQL_SUCCESS;
if (opt == QLatin1String("SQL_ATTR_ACCESS_MODE")) {
if (val == QLatin1String("SQL_MODE_READ_ONLY")) {
@@ -1634,7 +1634,7 @@ bool QDB2Driver::rollbackTransaction()
bool QDB2Driver::setAutoCommit(bool autoCommit)
{
Q_D(QDB2Driver);
- SQLUINTEGER ac = autoCommit ? SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF;
+ SQLULEN ac = autoCommit ? SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF;
SQLRETURN r = SQLSetConnectAttr(d->hDbc,
SQL_ATTR_AUTOCOMMIT,
reinterpret_cast<SQLPOINTER>(ac),
diff --git a/src/plugins/sqldrivers/psql/qsql_psql.cpp b/src/plugins/sqldrivers/psql/qsql_psql.cpp
index 0f4b7a80af..35b0f9a3e3 100644
--- a/src/plugins/sqldrivers/psql/qsql_psql.cpp
+++ b/src/plugins/sqldrivers/psql/qsql_psql.cpp
@@ -229,7 +229,7 @@ class QPSQLResultPrivate : public QSqlResultPrivate
{
Q_DECLARE_PUBLIC(QPSQLResult)
public:
- Q_DECLARE_SQLDRIVER_PRIVATE(QPSQLDriver);
+ Q_DECLARE_SQLDRIVER_PRIVATE(QPSQLDriver)
QPSQLResultPrivate(QPSQLResult *q, const QPSQLDriver *drv)
: QSqlResultPrivate(q, drv),
result(0),