From 41d7d3e47bf063e7ad14d8c62a5947baf2c4f622 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Sat, 18 Oct 2014 06:12:42 +0200 Subject: [PATCH] (iOS) Simplify _keyCommandForEvent --- apple/iOS/platform.m | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/apple/iOS/platform.m b/apple/iOS/platform.m index d8ba6fefc5..3af7e22942 100644 --- a/apple/iOS/platform.m +++ b/apple/iOS/platform.m @@ -142,16 +142,18 @@ static void handle_touch_event(NSArray* touches) if (event._hidEvent) { NSString* ch = (NSString*)event._privateInput; + uint32_t character = 0; - if (!ch || ch.length == 0) - apple_input_keyboard_event(event._isKeyDown, (uint32_t)event._keyCode, 0, (uint32_t)event._modifierFlags); - else + if (ch && ch.length != 0) { - apple_input_keyboard_event(event._isKeyDown, (uint32_t)event._keyCode, [ch characterAtIndex:0], (uint32_t)event._modifierFlags); + character = [ch characterAtIndex:0]; + apple_input_keyboard_event(event._isKeyDown, (uint32_t)event._keyCode, 0, (uint32_t)event._modifierFlags); for (i = 1; i < ch.length; i++) apple_input_keyboard_event(event._isKeyDown, 0, [ch characterAtIndex:i], (uint32_t)event._modifierFlags); } + + apple_input_keyboard_event(event._isKeyDown, (uint32_t)event._keyCode, character, (uint32_t)event._modifierFlags); } return [super _keyCommandForEvent:event];