From ceb0813eee7709fa1a085c96f678c6df6e27f01d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesu=CC=81s=20A=2E=20A=CC=81lvarez?= Date: Wed, 1 Feb 2023 18:11:49 +0100 Subject: [PATCH] steal key events if handled by emulator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes #45 somewhat, but not for ⌘-Q or ⌘-H --- Mini vMac/MNVMApplication.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Mini vMac/MNVMApplication.m b/Mini vMac/MNVMApplication.m index 1061a02..a036374 100644 --- a/Mini vMac/MNVMApplication.m +++ b/Mini vMac/MNVMApplication.m @@ -100,7 +100,6 @@ static int8_t usb_to_adb_scancode[] = { } - (void)handleKeyUIEvent:(UIEvent *)event { - [super handleKeyUIEvent:event]; static dispatch_once_t onceToken; static BOOL handleKeyboardEvents = YES; dispatch_once(&onceToken, ^{ @@ -113,6 +112,8 @@ static int8_t usb_to_adb_scancode[] = { BOOL emulatorIsFrontmost = [AppDelegate sharedEmulator].running && [AppDelegate sharedInstance].window.rootViewController.presentedViewController == nil; if ([event isKindOfClass:keyboardEventClass] && handleKeyboardEvents && emulatorIsFrontmost) { [self handleKeyboardEvent:(UIPhysicalKeyboardEvent*)event]; + } else { + [super handleKeyUIEvent:event]; } }