mirror of
https://github.com/zydeco/minivmac4ios.git
synced 2024-11-29 05:49:21 +00:00
don't try to handle physical keyboard events on iOS <9
This commit is contained in:
parent
cc3b3bc59a
commit
76b82d92fc
@ -101,7 +101,16 @@ static int8_t usb_to_adb_scancode[] = {
|
|||||||
|
|
||||||
- (void)handleKeyUIEvent:(UIEvent *)event {
|
- (void)handleKeyUIEvent:(UIEvent *)event {
|
||||||
[super handleKeyUIEvent:event];
|
[super handleKeyUIEvent:event];
|
||||||
if ([event isKindOfClass:keyboardEventClass]) {
|
static dispatch_once_t onceToken;
|
||||||
|
static BOOL handleKeyboardEvents = YES;
|
||||||
|
dispatch_once(&onceToken, ^{
|
||||||
|
if ([NSProcessInfo instancesRespondToSelector:@selector(operatingSystemVersion)]) {
|
||||||
|
handleKeyboardEvents = [NSProcessInfo processInfo].operatingSystemVersion.majorVersion >= 9;
|
||||||
|
} else {
|
||||||
|
handleKeyboardEvents = NO;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if ([event isKindOfClass:keyboardEventClass] && handleKeyboardEvents) {
|
||||||
[self handleKeyboardEvent:(UIPhysicalKeyboardEvent*)event];
|
[self handleKeyboardEvent:(UIPhysicalKeyboardEvent*)event];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user