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>
bb10
Gatis Paeglis 2013-05-06 15:07:01 +02:00 committed by The Qt Project
parent ebd5de126c
commit d1bf366e42
1 changed files with 2 additions and 5 deletions

View File

@ -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;