summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorCyril Oblikov <munknex@gmail.com>2013-03-25 12:03:51 +0300
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-26 07:31:12 +0100
commite90ce866fa61ece9eca3b8e0846d46bb73752824 (patch)
tree02626773d52fd033dfba7082ba96a11197ee63e6 /src/plugins/platforms
parentbadbb6fdd2b59b324b6b044fa03076492f27ddf0 (diff)
Fixed shortcuts for some (e.g. Russian) layouts
If CMD modificator is active [nsevent characters] is used now to get keyCode. In this case for example English "X" is returned instead of Russian "Ч" even if Russian input source is selected. Task-number: QTBUG-30306 Change-Id: I93cd292633e68327df0c580ed74fe8ad1c9ed27d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 4ff44ca7f5..12a6bb9e69 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -837,6 +837,7 @@ static QTouchDevice *touchDevice = 0;
ulong nativeModifiers = [nsevent modifierFlags];
Qt::KeyboardModifiers modifiers = [self convertKeyModifiers: nativeModifiers];
NSString *charactersIgnoringModifiers = [nsevent charactersIgnoringModifiers];
+ NSString *characters = [nsevent characters];
// [from Qt 4 impl] There is no way to get the scan code from carbon. But we cannot
// use the value 0, since it indicates that the event originates from somewhere
@@ -849,9 +850,12 @@ static QTouchDevice *touchDevice = 0;
QChar ch;
int keyCode;
- if ([charactersIgnoringModifiers length] > 0) {
- // convert the first character into a key code
- ch = QChar([charactersIgnoringModifiers characterAtIndex:0]);
+ if ([charactersIgnoringModifiers length] > 0) { // convert the first character into a key code
+ if ((modifiers & Qt::ControlModifier) && ([characters length] != 0)) {
+ ch = QChar([characters characterAtIndex:0]);
+ } else {
+ ch = QChar([charactersIgnoringModifiers characterAtIndex:0]);
+ }
keyCode = [self convertKeyCode:ch];
} else {
// might be a dead key
@@ -867,7 +871,7 @@ static QTouchDevice *touchDevice = 0;
// ignore text for the U+F700-U+F8FF range. This is used by Cocoa when
// delivering function keys (e.g. arrow keys, backspace, F1-F35, etc.)
if ([charactersIgnoringModifiers length] == 1 && (ch.unicode() < 0xf700 || ch.unicode() > 0xf8ff))
- text = QCFString::toQString([nsevent characters]);
+ text = QCFString::toQString(characters);
if (m_composingText.isEmpty())
m_sendKeyEvent = !QWindowSystemInterface::tryHandleShortcutEvent(m_window, timestamp, keyCode, modifiers, text);