From 3c90ac02d1a6dc383c21d3911f0db881f9341802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Sun, 24 Nov 2019 21:40:13 +0100 Subject: macOS: Replace use of deprecated NSDragPboard enum Change-Id: I90128abe310f971a89ecb6551e31950211adda77 Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/cocoa/qcocoadrag.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qcocoadrag.mm b/src/plugins/platforms/cocoa/qcocoadrag.mm index 09433194a6..95808b8a11 100644 --- a/src/plugins/platforms/cocoa/qcocoadrag.mm +++ b/src/plugins/platforms/cocoa/qcocoadrag.mm @@ -134,7 +134,7 @@ Qt::DropAction QCocoaDrag::drag(QDrag *o) NSImage *nsimage = qt_mac_create_nsimage(pm); [nsimage setSize:NSSizeFromCGSize(pmDeviceIndependentSize.toCGSize())]; - QMacPasteboard dragBoard((CFStringRef) NSDragPboard, QMacInternalPasteboardMime::MIME_DND); + QMacPasteboard dragBoard(CFStringRef(NSPasteboardNameDrag), QMacInternalPasteboardMime::MIME_DND); m_drag->mimeData()->setData(QLatin1String("application/x-qt-mime-type-name"), QByteArray("dummy")); dragBoard.setMimeData(m_drag->mimeData(), QMacPasteboard::LazyRequest); @@ -145,7 +145,7 @@ Qt::DropAction QCocoaDrag::drag(QDrag *o) CGFloat flippedY = pmDeviceIndependentSize.height() - hotSpot.y(); event_location.y -= flippedY; NSSize mouseOffset_unused = NSMakeSize(0.0, 0.0); - NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard]; + NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSPasteboardNameDrag]; [theWindow dragImage:nsimage at:event_location -- cgit v1.2.3 From 770a1d71560f7195fed0ada523884784bc89f791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Sun, 24 Nov 2019 21:57:35 +0100 Subject: macOS: Replace use of deprecated acceptsTouchEvents API The equivalent of setting acceptsTouchEvents to YES is enabling indirect touches. Direct touches are enabled by default by AppKit, but can be explicitly disabled by clearing the NSTouchTypeMaskDirect bit. Change-Id: I5ba09d36f6ee2ce962e3ce21bab06537dd1fa5ad Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/cocoa/qcocoawindow.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 15329ca708..6e2d446898 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -1692,9 +1692,9 @@ void QCocoaWindow::registerTouch(bool enable) { m_registerTouchCount += enable ? 1 : -1; if (enable && m_registerTouchCount == 1) - [m_view setAcceptsTouchEvents:YES]; + m_view.allowedTouchTypes |= NSTouchTypeMaskIndirect; else if (m_registerTouchCount == 0) - [m_view setAcceptsTouchEvents:NO]; + m_view.allowedTouchTypes &= ~NSTouchTypeMaskIndirect; } void QCocoaWindow::setContentBorderThickness(int topThickness, int bottomThickness) -- cgit v1.2.3 From b8cf3c35002affe9f1876dd3940d75171be43f64 Mon Sep 17 00:00:00 2001 From: Andre de la Rocha Date: Fri, 22 Nov 2019 19:44:48 +0100 Subject: Windows QPA: Disable the native Windows OSK if Qt Virtual Keyboard is in use This change detects that the Qt Virtual Keyboard is in use through the QT_IM_MODULE environment variable and disables the native Windows OSK accordingly, to avoid showing both virtual keyboards at the same time. Task-number: QTBUG-76088 Change-Id: I2715b337e6de729f0514ea1892b94b3c4f9cd984 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowsinputcontext.cpp | 7 +++++-- .../windows/uiautomation/qwindowsuiamainprovider.cpp | 12 +++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/qwindowsinputcontext.cpp b/src/plugins/platforms/windows/qwindowsinputcontext.cpp index 079c25f9eb..19d632dc10 100644 --- a/src/plugins/platforms/windows/qwindowsinputcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsinputcontext.cpp @@ -283,8 +283,11 @@ void QWindowsInputContext::showInputPanel() // We only call ShowCaret() on Windows 10 after 1703 as in earlier versions // the caret would actually be visible (QTBUG-74492) and the workaround for // the Surface seems unnecessary there anyway. But leave it hidden for IME. - if (QOperatingSystemVersion::current() >= - QOperatingSystemVersion(QOperatingSystemVersion::Windows, 10, 0, 16299)) { + // Only trigger the native OSK if the Qt OSK is not in use. + static bool imModuleEmpty = qEnvironmentVariableIsEmpty("QT_IM_MODULE"); + if (imModuleEmpty + && QOperatingSystemVersion::current() + >= QOperatingSystemVersion(QOperatingSystemVersion::Windows, 10, 0, 16299)) { ShowCaret(platformWindow->handle()); } else { HideCaret(platformWindow->handle()); diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp index f589fd6b10..e5a9f275ae 100644 --- a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp +++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp @@ -390,7 +390,17 @@ HRESULT QWindowsUiaMainProvider::GetPropertyValue(PROPERTYID idProp, VARIANT *pR setVariantI4(UIA_WindowControlTypeId, pRetVal); } else { // Control type converted from role. - setVariantI4(roleToControlTypeId(accessible->role()), pRetVal); + auto controlType = roleToControlTypeId(accessible->role()); + + // The native OSK should be disbled if the Qt OSK is in use. + static bool imModuleEmpty = qEnvironmentVariableIsEmpty("QT_IM_MODULE"); + + // If we want to disable the native OSK auto-showing + // we have to report text fields as non-editable. + if (controlType == UIA_EditControlTypeId && !imModuleEmpty) + controlType = UIA_TextControlTypeId; + + setVariantI4(controlType, pRetVal); } break; case UIA_HelpTextPropertyId: -- cgit v1.2.3 From cc5c47d85f106356e290a95f2cca2c38b1b3c42d Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Thu, 21 Nov 2019 16:37:06 +0100 Subject: macOS Accessibility: Fix role for comboboxes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise combobox with editable text field won't work. Change-Id: I135c3a63cf8fba66d724e140a5a63828853e154e Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoaaccessibility.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm index db4ec251ae..106c226adc 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm @@ -133,7 +133,7 @@ static void populateRoleMap() roleMap[QAccessible::SpinBox] = NSAccessibilityIncrementorRole; roleMap[QAccessible::Slider] = NSAccessibilitySliderRole; roleMap[QAccessible::ProgressBar] = NSAccessibilityProgressIndicatorRole; - roleMap[QAccessible::ComboBox] = NSAccessibilityPopUpButtonRole; + roleMap[QAccessible::ComboBox] = NSAccessibilityComboBoxRole; roleMap[QAccessible::RadioButton] = NSAccessibilityRadioButtonRole; roleMap[QAccessible::CheckBox] = NSAccessibilityCheckBoxRole; roleMap[QAccessible::StaticText] = NSAccessibilityStaticTextRole; -- cgit v1.2.3 From 438702ac5f592573dbb9ed5fac84b241eb2d767a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Sun, 24 Nov 2019 22:06:27 +0100 Subject: macOS: Don't tweak NSApp presentationOptions on startup AppKit will initialize NSScreens nowadays, so we don't need to manually trigger it. Task-number: QTBUG-80193 Change-Id: Ic0251a1b978b9d4ff53f20e67902787cf529fa87 Reviewed-by: Timur Pocheptsov Reviewed-by: Volker Hilsheimer --- src/plugins/platforms/cocoa/qcocoaintegration.mm | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index 9a2f19c2f2..b7f15a2bf1 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -197,16 +197,6 @@ QCocoaIntegration::QCocoaIntegration(const QStringList ¶mList) [cocoaApplication setMenu:[qtMenuLoader menu]]; } - // The presentation options such as whether or not the dock and/or menu bar is - // hidden (automatically by the system) affects the main screen's available - // geometry. Since we're initializing the screens synchronously at application - // startup we need to ensure that the presentation options have been propagated - // to the screen before we read out its properties. Normally OS X does this in - // an asynchronous callback, but that's too late for us. We force the propagation - // by explicitly setting the presentation option to the magic 'default value', - // which will resolve to an actual value and result in screen invalidation. - cocoaApplication.presentationOptions = NSApplicationPresentationDefault; - QCocoaScreen::initializeScreens(); QMacInternalPasteboardMime::initializeMimeTypes(); -- cgit v1.2.3 From 9ac156c90b92a981f70929e081c64083b14e9a57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 2 Dec 2019 13:33:30 +0100 Subject: iOS: Guard against request for textInputView without focus window Change-Id: I7b8df07fffef1cc948f6720685234540a20ccc81 Fixes: QTBUG-79316 Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/ios/qiostextresponder.mm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm index 396c769be8..1bc9744528 100644 --- a/src/plugins/platforms/ios/qiostextresponder.mm +++ b/src/plugins/platforms/ios/qiostextresponder.mm @@ -781,12 +781,16 @@ - (UIView *)textInputView { + auto *focusWindow = QGuiApplication::focusWindow(); + if (!focusWindow) + return nil; + // iOS expects rects we return from other UITextInput methods // to be relative to the view this method returns. // Since QInputMethod returns rects relative to the top level // QWindow, that is also the view we need to return. - Q_ASSERT(qApp->focusWindow()->handle()); - QPlatformWindow *topLevel = qApp->focusWindow()->handle(); + Q_ASSERT(focusWindow->handle()); + QPlatformWindow *topLevel = focusWindow->handle(); while (QPlatformWindow *p = topLevel->parent()) topLevel = p; return reinterpret_cast(topLevel->winId()); -- cgit v1.2.3