don't forward physical keyboard events to emulated machine when presenting another view controller

This commit is contained in:
Jesús A. Álvarez 2016-06-06 20:57:09 +02:00
parent b2194bfcc5
commit 4e268e144d
1 changed files with 2 additions and 1 deletions

View File

@ -110,7 +110,8 @@ static int8_t usb_to_adb_scancode[] = {
handleKeyboardEvents = NO;
}
});
if ([event isKindOfClass:keyboardEventClass] && handleKeyboardEvents) {
BOOL emulatorIsFrontmost = [AppDelegate sharedEmulator].running && [AppDelegate sharedInstance].window.rootViewController.presentedViewController == nil;
if ([event isKindOfClass:keyboardEventClass] && handleKeyboardEvents && emulatorIsFrontmost) {
[self handleKeyboardEvent:(UIPhysicalKeyboardEvent*)event];
}
}