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/platforms') 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/platforms') 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 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/platforms') 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 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/platforms') 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/platforms') 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/platforms') 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/platforms') 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/platforms') 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/platforms') 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