ui/app: (ios) relay system focus events

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-06-20 19:05:06 +02:00
parent b9205d9965
commit 173d56a67a
2 changed files with 16 additions and 0 deletions
+10
View File
@@ -36,6 +36,16 @@ static void redraw(CFTypeRef viewRef, BOOL sync) {
GioViewController *controller = [[GioViewController alloc] initWithNibName:nil bundle:nil];
controller.screen = self.window.screen;
self.window.rootViewController = controller;
[[NSNotificationCenter defaultCenter] addObserverForName:UIWindowDidBecomeKeyNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notification) {
UIView *view = self.window.rootViewController.view;
if (view != nil)
onFocus((__bridge CFTypeRef)view, YES);
}];
[[NSNotificationCenter defaultCenter] addObserverForName:UIWindowDidResignKeyNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notification) {
UIView *view = self.window.rootViewController.view;
if (view != nil)
onFocus((__bridge CFTypeRef)view, NO);
}];
[self.window makeKeyAndVisible];
return YES;
}