From 6cbbd1f93d369059e16c62f4b8ba60ad3407d886 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 14 Jan 2014 13:10:09 +0100 Subject: Cocoa: Popups should not become key MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... at least not like that. We still need to find a way for the popup to receive and process key events on its own, instead of depending on other layers inside Qt. This would make Qt Quick control's PopupWindow implementation much simpler, for example. Revert "Cocoa: Allow popups to grab mouse and keyboard" This reverts commit a25e6528d3806d3b5fd87c5a1cacd6c748215db1. Task-number: QTBUG-35820 Task-number: QTBUG-35904 Change-Id: Ica10529308ab25938397c16b9c1e1ce6cbd8f247 Reviewed-by: Gabriel de Dietrich Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoawindow.h | 1 - src/plugins/platforms/cocoa/qcocoawindow.mm | 9 +-------- 2 files changed, 1 insertion(+), 9 deletions(-) (limited to 'src/plugins/platforms/cocoa') diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h index 66c3241b3d..452be90108 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.h +++ b/src/plugins/platforms/cocoa/qcocoawindow.h @@ -211,7 +211,6 @@ public: // for QNSView QRect m_exposedGeometry; int m_registerTouchCount; bool m_resizableTransientParent; - bool m_overrideBecomeKey; static const int NoAlertRequest; NSInteger m_alertRequest; diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 8e977236fa..56665719e8 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -160,9 +160,7 @@ static bool isMouseEvent(NSEvent *ev) // Only tool or dialog windows should become key: if (m_cocoaPlatformWindow - && (m_cocoaPlatformWindow->m_overrideBecomeKey || - m_cocoaPlatformWindow->window()->type() == Qt::Tool || - m_cocoaPlatformWindow->window()->type() == Qt::Dialog)) + && (m_cocoaPlatformWindow->window()->type() == Qt::Tool || m_cocoaPlatformWindow->window()->type() == Qt::Dialog)) return YES; return NO; } @@ -217,7 +215,6 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw) , m_isExposed(false) , m_registerTouchCount(0) , m_resizableTransientParent(false) - , m_overrideBecomeKey(false) , m_alertRequest(NoAlertRequest) , monitor(nil) , m_drawContentBorderGradient(false) @@ -705,8 +702,6 @@ bool QCocoaWindow::setKeyboardGrabEnabled(bool grab) if (!m_nsWindow) return false; - m_overrideBecomeKey = grab; - if (grab && ![m_nsWindow isKeyWindow]) [m_nsWindow makeKeyWindow]; else if (!grab && [m_nsWindow isKeyWindow]) @@ -719,8 +714,6 @@ bool QCocoaWindow::setMouseGrabEnabled(bool grab) if (!m_nsWindow) return false; - m_overrideBecomeKey = grab; - if (grab && ![m_nsWindow isKeyWindow]) [m_nsWindow makeKeyWindow]; else if (!grab && [m_nsWindow isKeyWindow]) -- cgit v1.2.3 From 2565ef220b9f261fc2d62869b8d38625e41bc6fd Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Tue, 14 Jan 2014 09:34:47 +0100 Subject: Revert "Cocoa: fix single punctuation input via CJK input method" This change makes a regression. This reverts commit a79f8a3a6774875fc16fd63461e04c2791a8d03d. Task-number: QTBUG-36033 Change-Id: Ibcb19cd8631f85c81433c9625bbbf280404db1c4 Reviewed-by: Jens Bache-Wiig --- src/plugins/platforms/cocoa/qnsview.mm | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/plugins/platforms/cocoa') diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index f7b129aea1..ecb6c127aa 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -1346,6 +1346,11 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) { Q_UNUSED(replacementRange) + if (m_sendKeyEvent && m_composingText.isEmpty()) { + // don't send input method events for simple text input (let handleKeyEvent send key events instead) + return; + } + QString commitString; if ([aString length]) { if ([aString isKindOfClass:[NSAttributedString class]]) { -- cgit v1.2.3 From 09f54e99f2e956908f9104181e7d61fa2f6a027d Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Mon, 20 Jan 2014 09:56:24 +0100 Subject: Cocoa: avoid a crash for cursor in QCocoaWindow It need to be copied. Task-number: QTBUG-35887 Change-Id: Ia165e6a8f9dc23733e53e11f9e1e98bf54e7dd20 Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoawindow.mm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms/cocoa') diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 56665719e8..bf5e0cfbc4 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -264,6 +264,7 @@ QCocoaWindow::~QCocoaWindow() [m_contentView release]; [m_nsWindow release]; [m_nsWindowDelegate release]; + [m_windowCursor release]; } QSurfaceFormat QCocoaWindow::format() const @@ -1059,7 +1060,10 @@ void QCocoaWindow::setWindowCursor(NSCursor *cursor) [cursor set]; // or we can set the cursor on mouse enter/leave using tracking // areas. This is done in QNSView, save the cursor: - m_windowCursor = cursor; + if (m_windowCursor != cursor) { + [m_windowCursor release]; + m_windowCursor = [cursor retain]; + } } void QCocoaWindow::registerTouch(bool enable) -- cgit v1.2.3 From 3fadd88f30d7308500b7d6012c45346e9c6f47d0 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 21 Jan 2014 12:59:10 +0100 Subject: Mac Style: Fix non-native menubar item spacing Unfortunate consequence from inheriting from Common style instead of Windows style. Also, a font entry missing in QCocoaTheme. Task-number: QTBUG-36224 Change-Id: I560494b1727734671478f70ee1ba800d21c916ca Reviewed-by: Jens Bache-Wiig --- src/plugins/platforms/cocoa/qcocoasystemsettings.mm | 1 + 1 file changed, 1 insertion(+) (limited to 'src/plugins/platforms/cocoa') diff --git a/src/plugins/platforms/cocoa/qcocoasystemsettings.mm b/src/plugins/platforms/cocoa/qcocoasystemsettings.mm index 194394d11a..1c08d4bcb7 100644 --- a/src/plugins/platforms/cocoa/qcocoasystemsettings.mm +++ b/src/plugins/platforms/cocoa/qcocoasystemsettings.mm @@ -254,6 +254,7 @@ QHash qt_mac_createRoleFonts() fonts.insert(QPlatformTheme::ListBoxFont, qt_mac_qfontForThemeFont(kThemeViewsFont)); fonts.insert(QPlatformTheme::TitleBarFont, qt_mac_qfontForThemeFont(kThemeWindowTitleFont)); fonts.insert(QPlatformTheme::MenuFont, qt_mac_qfontForThemeFont(kThemeMenuItemFont)); + fonts.insert(QPlatformTheme::MenuBarFont, qt_mac_qfontForThemeFont(kThemeMenuItemFont)); fonts.insert(QPlatformTheme::ComboMenuItemFont, qt_mac_qfontForThemeFont(kThemeSystemFont)); fonts.insert(QPlatformTheme::HeaderViewFont, qt_mac_qfontForThemeFont(kThemeSmallSystemFont)); fonts.insert(QPlatformTheme::TipLabelFont, qt_mac_qfontForThemeFont(kThemeSmallSystemFont)); -- cgit v1.2.3 From c58c98a248e104e55a7210b80a9f221bb019cbc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Mon, 20 Jan 2014 13:01:32 +0100 Subject: Cocoa: Silence tablet event warning on 10.6 10.6 sends tablet events for trackpad interaction, but not proximity events. The reason for this is not known. The events are discard. Silence the warning to avoid flooding the console. Change-Id: I6c215e8c15fc5b4b80e68b00f172121fc4d251b7 Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qnsview.mm | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/plugins/platforms/cocoa') diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index ecb6c127aa..e75b835d58 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -830,6 +830,12 @@ Q_GLOBAL_STATIC(QCocoaTabletDeviceDataHash, tabletDeviceDataHash) uint deviceId = [theEvent deviceID]; if (!tabletDeviceDataHash->contains(deviceId)) { + // 10.6 sends tablet events for trackpad interaction, but + // not proximity events. Silence the warning to prevent + // flooding the console. + if (QSysInfo::QSysInfo::MacintoshVersion == QSysInfo::MV_10_6) + return; + qWarning("QNSView handleTabletEvent: This tablet device is unknown" " (received no proximity event for it). Discarding event."); return; -- cgit v1.2.3 From 85ff4e8fe473337c687a4ee8afc4b3ca4f96f7b7 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Wed, 29 Jan 2014 23:30:00 +0100 Subject: Upgrade Window Level for stay on top widget on OS X Currently setting the WindowStaysOnTopHint makes the window appear over its children e.g. a QMessageBox. This patch aims to provide a more sensible level for stay on top widget [ChangeLog][QtWidget][OS X] Fixes an issue where stay on top widgets would cover their own children Task-number: QTBUG-36178 Change-Id: Ie86b0e0244d2fdee3638d4ab576445ef190d4bc6 Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoawindow.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms/cocoa') diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index bf5e0cfbc4..211ecd60ab 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -449,7 +449,7 @@ NSInteger QCocoaWindow::windowLevel(Qt::WindowFlags flags) // StayOnTop window should appear above Tool windows. if (flags & Qt::WindowStaysOnTopHint) - windowLevel = NSPopUpMenuWindowLevel; + windowLevel = NSModalPanelWindowLevel; // Tooltips should appear above StayOnTop windows. if (type == Qt::ToolTip) windowLevel = NSScreenSaverWindowLevel; -- cgit v1.2.3 From 64d95e3df27c4e859b2b7e88aac0640bc5c2ddd9 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 24 Jan 2014 09:14:33 +0100 Subject: OSX: FileDialogHelper uses options to remember the selected filter Task-number: QTBUG-35958 Change-Id: I998cf93232e79f70837cfa8f63592b69ea0dc563 Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms/cocoa') diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index 08505d91a2..f401459cc3 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -665,8 +665,10 @@ void QCocoaFileDialogHelper::selectNameFilter(const QString &filter) const int index = options()->nameFilters().indexOf(filter); if (index != -1) { QNSOpenSavePanelDelegate *delegate = static_cast(mDelegate); - if (!delegate) + if (!delegate) { + options()->setInitiallySelectedNameFilter(filter); return; + } [delegate->mPopUpButton selectItemAtIndex:index]; [delegate filterChanged:nil]; } @@ -676,7 +678,7 @@ QString QCocoaFileDialogHelper::selectedNameFilter() const { QNSOpenSavePanelDelegate *delegate = static_cast(mDelegate); if (!delegate) - return QString(); + return options()->initiallySelectedNameFilter(); int index = [delegate->mPopUpButton indexOfSelectedItem]; if (index >= options()->nameFilters().count()) return QString(); -- cgit v1.2.3 From 839997adfa6ecf6209dbde94ec831d1c3a203de4 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Tue, 14 Jan 2014 14:32:39 +0100 Subject: Cocoa: fix single punctuation input via CJK input method 2d05d3bd2815c220474b3c07bf3f2ef7417d3070 was not correct. On OS X, when user uses CJK input method, only types single punctuation, it was converted to CJK ones, and not showed in composing text. Task-number: QTBUG-35700 Change-Id: I2d1063d2f837d075929dc5ebb5722fdefc6ee0f6 Reviewed-by: Eike Ziller Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qnsview.h | 1 + src/plugins/platforms/cocoa/qnsview.mm | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms/cocoa') diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h index 403f8dc78a..7e146c5f58 100644 --- a/src/plugins/platforms/cocoa/qnsview.h +++ b/src/plugins/platforms/cocoa/qnsview.h @@ -71,6 +71,7 @@ QT_END_NAMESPACE bool m_subscribesForGlobalFrameNotifications; QCocoaGLContext *m_glContext; bool m_shouldSetGLContextinDrawRect; + NSString *m_inputSource; } - (id)init; diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index e75b835d58..ed9aad1654 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -90,6 +90,7 @@ static QTouchDevice *touchDevice = 0; m_shouldSetGLContextinDrawRect = false; currentCustomDragTypes = 0; m_sendUpAsRightButton = false; + m_inputSource = 0; if (!touchDevice) { touchDevice = new QTouchDevice; @@ -108,6 +109,7 @@ static QTouchDevice *touchDevice = 0; m_maskData = 0; m_window = 0; m_subscribesForGlobalFrameNotifications = false; + [m_inputSource release]; [[NSNotificationCenter defaultCenter] removeObserver:self]; delete currentCustomDragTypes; @@ -1222,6 +1224,10 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) Qt::KeyboardModifiers modifiers = [QNSView convertKeyModifiers: nativeModifiers]; NSString *charactersIgnoringModifiers = [nsevent charactersIgnoringModifiers]; NSString *characters = [nsevent characters]; + if (m_inputSource != characters) { + [m_inputSource release]; + m_inputSource = [characters retain]; + } // There is no way to get the scan code from carbon/cocoa. But we cannot // use the value 0, since it indicates that the event originates from somewhere @@ -1352,7 +1358,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) { Q_UNUSED(replacementRange) - if (m_sendKeyEvent && m_composingText.isEmpty()) { + if (m_sendKeyEvent && m_composingText.isEmpty() && [aString isEqualToString:m_inputSource]) { // don't send input method events for simple text input (let handleKeyEvent send key events instead) return; } -- cgit v1.2.3