From d1bf366e42f2af69249001cfe6857e4db91739b3 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Mon, 6 May 2013 15:07:01 +0200 Subject: [PATCH] Use [NSEvent keyCode] to retrieve a virtual key code. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ø --- src/plugins/platforms/cocoa/qnsview.mm | 7 ++----- 1 file 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;