summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGatis Paeglis <gatis.paeglis@digia.com>2013-05-06 15:07:01 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-10 23:48:32 +0200
commitd1bf366e42f2af69249001cfe6857e4db91739b3 (patch)
tree2df8fabf931dbd760597c0c398dae24016bae695 /src
parentebd5de126c4be0e6047ec07f16e579606b14ed46 (diff)
Use [NSEvent keyCode] to retrieve a virtual key code.
No need to use old style Carbon Event Manager function when there is Cocoa [NSEvent keyCode] equivalent for retrieving virtual key code. Change-Id: I5cceb76fc662e42a46a17dc69131091a64ca6060 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index a53d6c4e44..1e4062bdb6 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -872,14 +872,11 @@ static QTouchDevice *touchDevice = 0;
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
+ // 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
// else than the keyboard.
quint32 nativeScanCode = 1;
-
- UInt32 nativeVirtualKey = 0;
- EventRef eventRef = EventRef([nsevent eventRef]);
- GetEventParameter(eventRef, kEventParamKeyCode, typeUInt32, 0, sizeof(nativeVirtualKey), 0, &nativeVirtualKey);
+ quint32 nativeVirtualKey = [nsevent keyCode];
QChar ch;
int keyCode;