From edf0be818cde51fcd47295171c65efd82b67ba65 Mon Sep 17 00:00:00 2001 From: Samuli Piippo Date: Thu, 9 Mar 2017 10:40:50 +0200 Subject: Use lowercase name for iphlpapi library Cross-compilation on linux with mingw-w64 failed, since it provides all libraries in lowercase name. Change-Id: I8e82a4504d4ec9d3047af6b1d6a11945754f182d Reviewed-by: Oliver Wolff --- src/plugins/bearer/generic/generic.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/bearer/generic/generic.pro b/src/plugins/bearer/generic/generic.pro index 02b3e96bfa..f30bdc4951 100644 --- a/src/plugins/bearer/generic/generic.pro +++ b/src/plugins/bearer/generic/generic.pro @@ -12,7 +12,7 @@ SOURCES += qgenericengine.cpp \ OTHER_FILES += generic.json -win32:!winrt:LIBS += -lIphlpapi +win32:!winrt:LIBS += -liphlpapi PLUGIN_TYPE = bearer PLUGIN_CLASS_NAME = QGenericEnginePlugin -- cgit v1.2.3 From c75e3f70b4c246c0e11c9e1dc6737fce7e1aecb3 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Mon, 13 Mar 2017 16:40:55 +0100 Subject: xcb: cleanup QXcbWindow::relayFocusToModalWindow() - recursion is not needed for walking up the parent chain; - use camel-case, modal_window -> modalWindow; Change-Id: I4b7697f2388fd16f11be67ba475bd63ad249d89e Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbwindow.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 78d000c774..15ca68c663 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -918,19 +918,17 @@ void QXcbWindow::hide() } } -static QWindow *tlWindow(QWindow *window) -{ - if (window && window->parent()) - return tlWindow(window->parent()); - return window; -} - bool QXcbWindow::relayFocusToModalWindow() const { - QWindow *w = tlWindow(static_cast(QObjectPrivate::get(window()))->eventReceiver()); - QWindow *modal_window = 0; - if (QGuiApplicationPrivate::instance()->isWindowBlocked(w,&modal_window) && modal_window != w) { - modal_window->requestActivate(); + QWindow *w = static_cast(QObjectPrivate::get(window()))->eventReceiver(); + // get top-level window + while (w && w->parent()) + w = w->parent(); + + QWindow *modalWindow = 0; + const bool blocked = QGuiApplicationPrivate::instance()->isWindowBlocked(w, &modalWindow); + if (blocked && modalWindow != w) { + modalWindow->requestActivate(); connection()->flush(); return true; } -- cgit v1.2.3 From b21069d6fa74273afbdab9af3a6ac89038e4a2b8 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Mon, 13 Feb 2017 12:02:29 +0400 Subject: Android: Fix Accessibility items positioning with QHighDpi enabled the View's position and metrics are in pixels, not points Change-Id: I285d5378db98187f54019bff9b8a1cde05dc3b35 Reviewed-by: BogDan Vatra --- src/plugins/platforms/android/androidjniaccessibility.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/android/androidjniaccessibility.cpp b/src/plugins/platforms/android/androidjniaccessibility.cpp index 3b1ce6d21d..eeaecd53b4 100644 --- a/src/plugins/platforms/android/androidjniaccessibility.cpp +++ b/src/plugins/platforms/android/androidjniaccessibility.cpp @@ -49,6 +49,7 @@ #include #include #include +#include #include "qdebug.h" @@ -137,7 +138,7 @@ namespace QtAndroidAccessibility QRect rect; QAccessibleInterface *iface = interfaceFromId(objectId); if (iface && iface->isValid()) { - rect = iface->rect(); + rect = QHighDpi::toNativePixels(iface->rect(), iface->window()); } jclass rectClass = env->FindClass("android/graphics/Rect"); @@ -150,11 +151,13 @@ namespace QtAndroidAccessibility { QAccessibleInterface *root = interfaceFromId(-1); if (root) { - QAccessibleInterface *child = root->childAt((int)x, (int)y); + QPoint pos = QHighDpi::fromNativePixels(QPoint(int(x), int(y)), root->window()); + + QAccessibleInterface *child = root->childAt(pos.x(), pos.y()); QAccessibleInterface *lastChild = 0; while (child && (child != lastChild)) { lastChild = child; - child = child->childAt((int)x, (int)y); + child = child->childAt(pos.x(), pos.y()); } if (lastChild) return QAccessible::uniqueId(lastChild); -- cgit v1.2.3 From f418d1b26a1f8e3e9d3a81017fee5c60fad5669f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 8 Mar 2017 13:13:12 +0100 Subject: Remove a Q_GLOBAL_STATIC with QMutex in favor of QBasicAtomicInt Much simpler, no memory allocation, no locking. Change-Id: Iae839f6a131a4f0784bffffd14a9e70c7b62d9a7 Reviewed-by: Olivier Goffart (Woboq GmbH) Reviewed-by: Marc Mutz --- src/plugins/sqldrivers/psql/qsql_psql.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/sqldrivers/psql/qsql_psql.cpp b/src/plugins/sqldrivers/psql/qsql_psql.cpp index 968b71a27d..7fa1ff7da5 100644 --- a/src/plugins/sqldrivers/psql/qsql_psql.cpp +++ b/src/plugins/sqldrivers/psql/qsql_psql.cpp @@ -50,7 +50,6 @@ #include #include #include -#include #include #include @@ -618,13 +617,10 @@ static QString qCreateParamString(const QVector &boundValues, const QS return params; } -Q_GLOBAL_STATIC(QMutex, qMutex) QString qMakePreparedStmtId() { - qMutex()->lock(); - static unsigned int qPreparedStmtCount = 0; - QString id = QLatin1String("qpsqlpstmt_") + QString::number(++qPreparedStmtCount, 16); - qMutex()->unlock(); + static QBasicAtomicInt qPreparedStmtCount = Q_BASIC_ATOMIC_INITIALIZER(0); + QString id = QLatin1String("qpsqlpstmt_") + QString::number(qPreparedStmtCount.fetchAndAddRelaxed(1) + 1, 16); return id; } -- cgit v1.2.3 From e9a7739e77f79baeb5452189b6d17e63de5b341d Mon Sep 17 00:00:00 2001 From: Peter Seiderer Date: Fri, 10 Mar 2017 22:23:06 +0100 Subject: eglfs: fix x11 header related compile failure Add egl config and QT_EGL_NO_X11 define (as all other eglfs project files do). Task-number: QTBUG-59427 Change-Id: Ifbb11eae0fdf0e58c0b7feecb9a7914a889c8f77 Reviewed-by: Oswald Buddenhagen Reviewed-by: Laszlo Agocs --- src/plugins/platforms/eglfs/eglfs-plugin.pro | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/plugins') diff --git a/src/plugins/platforms/eglfs/eglfs-plugin.pro b/src/plugins/platforms/eglfs/eglfs-plugin.pro index cf4863975a..ec229796e5 100644 --- a/src/plugins/platforms/eglfs/eglfs-plugin.pro +++ b/src/plugins/platforms/eglfs/eglfs-plugin.pro @@ -2,6 +2,11 @@ TARGET = qeglfs QT += eglfsdeviceintegration-private +CONFIG += egl + +# Avoid X11 header collision, use generic EGL native types +DEFINES += QT_EGL_NO_X11 + SOURCES += $$PWD/qeglfsmain.cpp OTHER_FILES += $$PWD/eglfs.json -- cgit v1.2.3 From ac74abdf50f7047cf43b3577a70d0995e197659d Mon Sep 17 00:00:00 2001 From: Michael Jabbour Date: Sat, 18 Mar 2017 04:46:45 +0200 Subject: PostgreSQL: fix datetime format when system locale doesn't use arabic numerals psql driver was previously using QDateTime::toString() function which is locale-depndent. Task-number: QTBUG-59524 Change-Id: I7f50f95b5c82e66476abfee24ad28b78b3257041 Reviewed-by: Thiago Macieira --- src/plugins/sqldrivers/psql/qsql_psql.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/sqldrivers/psql/qsql_psql.cpp b/src/plugins/sqldrivers/psql/qsql_psql.cpp index 7fa1ff7da5..1faab22f66 100644 --- a/src/plugins/sqldrivers/psql/qsql_psql.cpp +++ b/src/plugins/sqldrivers/psql/qsql_psql.cpp @@ -50,6 +50,7 @@ #include #include #include +#include #include #include @@ -1307,7 +1308,9 @@ QString QPSQLDriver::formatValue(const QSqlField &field, bool trimStrings) const // we force the value to be considered with a timezone information, and we force it to be UTC // this is safe since postgresql stores only the UTC value and not the timezone offset (only used // while parsing), so we have correct behavior in both case of with timezone and without tz - r = QLatin1String("TIMESTAMP WITH TIME ZONE ") + QLatin1Char('\'') + field.value().toDateTime().toUTC().toString(QLatin1String("yyyy-MM-ddThh:mm:ss.zzz")) + QLatin1Char('Z') + QLatin1Char('\''); + r = QLatin1String("TIMESTAMP WITH TIME ZONE ") + QLatin1Char('\'') + + QLocale::c().toString(field.value().toDateTime().toUTC(), QLatin1String("yyyy-MM-ddThh:mm:ss.zzz")) + + QLatin1Char('Z') + QLatin1Char('\''); } else { r = QLatin1String("NULL"); } -- cgit v1.2.3 From 524f39db899d68e0ef90184a268eb75ad4ac216e Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 20 Mar 2017 17:54:55 -0700 Subject: gtk3: Fix use of dangling pointers QString::toUtf8() returns QByteArray, which got implicitly converted to C strings and promptly deleted. Instead, return the QByteArray to the caller. Found by ASAN: ==13935==ERROR: AddressSanitizer: heap-use-after-free on address 0x6060000dffb8 at pc 0x7f764f27320b bp 0x7ffd49b11bb0 sp 0x7ffd49b11358 READ of size 7 at 0x6060000dffb8 thread T0 #1 0x7f7649d174e2 in g_strdup (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x684e2) #2 0x7f763f7abe5b (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x39e5b) #3 0x7f763f78915a in g_object_new_valist (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x1715a) #4 0x7f763f789520 in g_object_new (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x17520) #5 0x7f7640f6bcb0 in gtk_dialog_add_button (/usr/lib/x86_64-linux-gnu/libgtk-3.so.0+0x186cb0) #6 0x7f7640f8d2c9 in gtk_file_chooser_dialog_new (/usr/lib/x86_64-linux-gnu/libgtk-3.so.0+0x1a82c9) #7 0x7f7641727281 (/opt/Qt5.8.0/5.8/gcc_64/plugins/platformthemes/libqgtk3.so+0x13281) Task-number: QTBUG-59611 Change-Id: I37cc967e689f4523b504fffd14adbf944b53b754 Reviewed-by: J-P Nurmi --- src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp index 699b058932..8b6ec31400 100644 --- a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp +++ b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE -static const char *standardButtonText(int button) +static QByteArray standardButtonText(int button) { return QGtk3Theme::defaultStandardButtonText(button).toUtf8(); } -- cgit v1.2.3 From b07a06745eb79057ccc08bc908b2df866bc38ac0 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 3 Jan 2017 09:40:40 +0100 Subject: Windows QPA/Services: Do not invoke MailToProtocolHandler of url.dll As of Windows 10, MailToProtocolHandler is set as handler for mailto URLs if there is no mail client installed. As it silently fails or brings up a broken dialog after a long time, exclude it and fall back to ShellExecute() which brings up the URL assocation dialog. Task-number: QTBUG-57816 Change-Id: Ia8c09676bc44848e0549c06c3a82c9b5cce79279 Reviewed-by: Jesus Fernandez Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowsservices.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qwindowsservices.cpp b/src/plugins/platforms/windows/qwindowsservices.cpp index 7f9c9bd205..48332b35f8 100644 --- a/src/plugins/platforms/windows/qwindowsservices.cpp +++ b/src/plugins/platforms/windows/qwindowsservices.cpp @@ -98,7 +98,11 @@ static inline QString mailCommand() RegQueryValueEx(handle, L"", 0, 0, reinterpret_cast(command), &bufferSize); RegCloseKey(handle); } - if (!command[0]) + // QTBUG-57816: As of Windows 10, if there is no mail client installed, an entry like + // "rundll32.exe .. url.dll,MailToProtocolHandler %l" is returned. Launching it + // silently fails or brings up a broken dialog after a long time, so exclude it and + // fall back to ShellExecute() which brings up the URL assocation dialog. + if (!command[0] || wcsstr(command, L",MailToProtocolHandler") != nullptr) return QString(); wchar_t expandedCommand[MAX_PATH] = {0}; return ExpandEnvironmentStrings(command, expandedCommand, MAX_PATH) ? -- cgit v1.2.3 From 64475272a251b3ba773fec4bc6d00cfe46d1854b Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Thu, 16 Mar 2017 13:21:27 +0100 Subject: QMacPasteBoard - protect against dangling pointers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In QMacPasteboard we use converters from QMacInternalPasteboardMime, which has essentially a global QList of available converters. QMacInternalPasteboardMime and derived classes register/unregister their instances in this list (in ctors/dtors) and then QMacPasteboard is using converters from this list. Unfortunately, when we're un-registering converter (and this means we delete those objects) we do not remove dangling pointers from our pasteboard objects. Apparently, this problem can be seen only when working with macextras (thus having an access to this private API in client's code). Task-number: QTBUG-54832 Change-Id: Ie3aef4aaca8ef6c80544dc58821cf43fc26f84a1 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qmacclipboard.mm | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qmacclipboard.mm b/src/plugins/platforms/cocoa/qmacclipboard.mm index e09bb1e362..f3467fdc73 100644 --- a/src/plugins/platforms/cocoa/qmacclipboard.mm +++ b/src/plugins/platforms/cocoa/qmacclipboard.mm @@ -139,10 +139,22 @@ OSStatus QMacPasteboard::promiseKeeper(PasteboardRef paste, PasteboardItemID id, const long promise_id = (long)id; // Find the kept promise + QList availableConverters + = QMacInternalPasteboardMime::all(QMacInternalPasteboardMime::MIME_ALL); const QString flavorAsQString = QString::fromCFString(flavor); QMacPasteboard::Promise promise; for (int i = 0; i < qpaste->promises.size(); i++){ QMacPasteboard::Promise tmp = qpaste->promises[i]; + if (!availableConverters.contains(tmp.convertor)) { + // promise.converter is a pointer initialized by the value found + // in QMacInternalPasteboardMime's global list of QMacInternalPasteboardMimes. + // We add pointers to this list in QMacInternalPasteboardMime's ctor; + // we remove these pointers in QMacInternalPasteboardMime's dtor. + // If tmp.converter was not found in this list, we probably have a + // dangling pointer so let's skip it. + continue; + } + if (tmp.itemId == promise_id && tmp.convertor->canConvert(tmp.mime, flavorAsQString)){ promise = tmp; break; -- cgit v1.2.3 From 1b75a04336452bd4b5fc3764f26157d14c4e53a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 16 Dec 2016 10:27:58 +0100 Subject: Fix spelling: neccessary -> necessary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I7c1b1d4ef12391e1caf00eae4b816cdc6d08ee04 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm | 2 +- src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm | 2 +- src/plugins/platforms/cocoa/qcocoaintegration.mm | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm index 7368aabf7d..35ac7182af 100644 --- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm +++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm @@ -286,7 +286,7 @@ QT_END_NAMESPACE if (qEnvironmentVariableIsEmpty("QT_MAC_DISABLE_FOREGROUND_APPLICATION_TRANSFORM")) { if (QSysInfo::macVersion() >= QSysInfo::MV_10_12) { // Move the application window to front to avoid launching behind the terminal. - // Ignoring other apps is neccessary (we must ignore the terminal), but makes + // Ignoring other apps is necessary (we must ignore the terminal), but makes // Qt apps play slightly less nice with other apps when lanching from Finder // (See the activateIgnoringOtherApps docs.) [[NSApplication sharedApplication] activateIgnoringOtherApps:YES]; diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index 234da57f59..2aaad38659 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -428,7 +428,7 @@ static QString strippedText(QString s) { // Call this functions if mFileMode, mFileOptions, // mNameFilterDropDownList or mQDirFilter changes. - // The savepanel does not contain the neccessary functions for this. + // The savepanel does not contain the necessary functions for this. const QFileDialogOptions::FileMode fileMode = mOptions->fileMode(); bool chooseFilesOnly = fileMode == QFileDialogOptions::ExistingFile || fileMode == QFileDialogOptions::ExistingFiles; diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index 18340f4ee1..fe4933ed6f 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -316,7 +316,7 @@ QCocoaIntegration::QCocoaIntegration(const QStringList ¶mList) // from the terminal. On 10.12+ this call has been moved to applicationDidFinishLauching // to work around issues with loss of focus at startup. if (QSysInfo::macVersion() < QSysInfo::MV_10_12) { - // Ignoring other apps is neccessary (we must ignore the terminal), but makes + // Ignoring other apps is necessary (we must ignore the terminal), but makes // Qt apps play slightly less nice with other apps when lanching from Finder // (See the activateIgnoringOtherApps docs.) [cocoaApplication activateIgnoringOtherApps : YES]; -- cgit v1.2.3 From 7a902e86ceb392b8b6cd0b3119afa19ea619868d Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 22 Mar 2017 12:19:47 +0100 Subject: Windows: Register windows for touch when a device is plugged in Call QWindowsWindow::registerTouchWindow() for all windows when a device is plugged in while the application is running. Guard registerTouchWindow() against repetitive invocation and wrong window types. This amends the crash fix 7daae2c2c706fd5d1c1ae44ace6847bc297803a0 and touch should then work. Task-number: QTBUG-48849 Change-Id: I8b257dda144f28d60bcc5c4e369a413a90263998 Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qtwindowsglobal.h | 3 +++ src/plugins/platforms/windows/qwindowscontext.cpp | 15 +++++++++++++++ src/plugins/platforms/windows/qwindowswindow.cpp | 3 ++- 3 files changed, 20 insertions(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qtwindowsglobal.h b/src/plugins/platforms/windows/qtwindowsglobal.h index a5c05bf1a3..e703b5d47e 100644 --- a/src/plugins/platforms/windows/qtwindowsglobal.h +++ b/src/plugins/platforms/windows/qtwindowsglobal.h @@ -120,6 +120,7 @@ enum WindowsEventType // Simplify event types QueryEndSessionApplicationEvent = ApplicationEventFlag + 4, EndSessionApplicationEvent = ApplicationEventFlag + 5, AppCommandEvent = ApplicationEventFlag + 6, + DeviceChangeEvent = ApplicationEventFlag + 7, InputMethodStartCompositionEvent = InputMethodEventFlag + 1, InputMethodCompositionEvent = InputMethodEventFlag + 2, InputMethodEndCompositionEvent = InputMethodEventFlag + 3, @@ -271,6 +272,8 @@ inline QtWindows::WindowsEventType windowsEventType(UINT message, WPARAM wParamI #endif case WM_GESTURE: return QtWindows::GestureEvent; + case WM_DEVICECHANGE: + return QtWindows::DeviceChangeEvent; case WM_DPICHANGED: return QtWindows::DpiChangedEvent; default: diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 5745fc6d19..b7a866679f 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -79,6 +79,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -322,6 +323,13 @@ bool QWindowsContext::initTouch(unsigned integrationOptions) QWindowSystemInterface::registerTouchDevice(touchDevice); d->m_systemInfo |= QWindowsContext::SI_SupportsTouch; + + // A touch device was plugged while the app is running. Register all windows for touch. + if (QGuiApplicationPrivate::is_app_running) { + for (QWindowsWindow *w : qAsConst(d->m_windows)) + w->registerTouchWindow(); + } + return true; } @@ -965,6 +973,13 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, } switch (et) { + case QtWindows::DeviceChangeEvent: + if (d->m_systemInfo & QWindowsContext::SI_SupportsTouch) + break; + // See if there are any touch devices added + if (wParam == DBT_DEVNODES_CHANGED) + initTouch(); + break; case QtWindows::KeyboardLayoutChangeEvent: if (QWindowsInputContext *wic = windowsInputContext()) wic->handleInputLanguageChanged(wParam, lParam); diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 79dce2fc43..2875463e62 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -2411,7 +2411,8 @@ void QWindowsWindow::setTouchWindowTouchTypeStatic(QWindow *window, QWindowsWind void QWindowsWindow::registerTouchWindow(QWindowsWindowFunctions::TouchWindowTouchTypes touchTypes) { - if ((QWindowsContext::instance()->systemInfo() & QWindowsContext::SI_SupportsTouch)) { + if ((QWindowsContext::instance()->systemInfo() & QWindowsContext::SI_SupportsTouch) + && !testFlag(TouchRegistered)) { ULONG touchFlags = 0; const bool ret = QWindowsContext::user32dll.isTouchWindow(m_data.hwnd, &touchFlags); // Return if it is not a touch window or the flags are already set by a hook -- cgit v1.2.3 From da4b91e2b2c6bb7949e2151a72be1f11c28768d6 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Wed, 1 Mar 2017 17:39:25 +0200 Subject: Fix hang on sleep/wakeup This patch fixes the followings: - call "it.value()" only on valid iterators - destroySurface() doesn't remove the surfaceId from m_surfaces - the surfaceId is removed from m_surfaces when the QtSurface is really destroyed Task-number: QTBUG-59185 Change-Id: Iee37dde16fee16f19906812c55c1f0b0279b033c Reviewed-by: Mathias Hasselmann Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/android/androidjnimain.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp index 1f681cc1a3..0fabb25233 100644 --- a/src/plugins/platforms/android/androidjnimain.cpp +++ b/src/plugins/platforms/android/androidjnimain.cpp @@ -402,11 +402,6 @@ namespace QtAndroid if (surfaceId == -1) return; - QMutexLocker lock(&m_surfacesMutex); - const auto &it = m_surfaces.find(surfaceId); - if (it != m_surfaces.end()) - m_surfaces.remove(surfaceId); - QJNIEnvironmentPrivate env; if (!env) return; @@ -583,14 +578,18 @@ static void setSurface(JNIEnv *env, jobject /*thiz*/, jint id, jobject jSurface, { QMutexLocker lock(&m_surfacesMutex); const auto &it = m_surfaces.find(id); - if (it.value() == nullptr) // This should never happen... - return; - if (it == m_surfaces.end()) { qWarning()<<"Can't find surface" << id; return; } - it.value()->surfaceChanged(env, jSurface, w, h); + auto surfaceClient = it.value(); + if (!surfaceClient) // This should never happen... + return; + + surfaceClient->surfaceChanged(env, jSurface, w, h); + + if (!jSurface) + m_surfaces.erase(it); } static void setDisplayMetrics(JNIEnv */*env*/, jclass /*clazz*/, -- cgit v1.2.3 From 197b55c93966939af6443656fc0fff72c0d67dbc Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 24 Mar 2017 21:59:03 +0100 Subject: iOS: Hide the overlay when the keyboard is hidden If the keyboard is hidden via the hide keyboard button then the edit menu should also hide with it. This ensures it behaves in the same way as native applications on iOS then. Change-Id: I4c714dd5c5cb27d8eaf310e2911dc38feb1cb74e Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qiostextinputoverlay.mm | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/plugins') diff --git a/src/plugins/platforms/ios/qiostextinputoverlay.mm b/src/plugins/platforms/ios/qiostextinputoverlay.mm index 78f84729da..9b97ce17bb 100644 --- a/src/plugins/platforms/ios/qiostextinputoverlay.mm +++ b/src/plugins/platforms/ios/qiostextinputoverlay.mm @@ -116,6 +116,11 @@ static void executeBlockWithoutAnimation(Block block) dispatch_async(dispatch_get_main_queue (), ^{ self.visible = YES; }); } }]; + [center addObserverForName:UIKeyboardDidHideNotification object:nil queue:nil + usingBlock:^(NSNotification *) { + self.visible = NO; + }]; + } return self; -- cgit v1.2.3