diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h index 403f8dc78a3..7e146c5f583 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 e75b835d58e..ed9aad16548 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; }