Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-9502] Delay focus events till window is opened #4705

Merged
merged 2 commits into from
Sep 17, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 1 addition & 17 deletions iphone/Classes/TiViewProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -1324,23 +1324,7 @@ - (BOOL) isUsingBarButtonItem

-(CGRect)appFrame //TODO: Why is this here? It doesn't have anything to do with a specific instance.
{
CGRect result=[[UIScreen mainScreen] applicationFrame];
switch ([[UIApplication sharedApplication] statusBarOrientation])
{
case UIInterfaceOrientationLandscapeLeft:
case UIInterfaceOrientationLandscapeRight:
{
CGFloat leftMargin = result.origin.y;
CGFloat topMargin = result.origin.x;
CGFloat newHeight = result.size.width;
CGFloat newWidth = result.size.height;
result = CGRectMake(leftMargin, topMargin, newWidth, newHeight);
break;
}
default: {
break;
}
}
CGRect result = [[[[TiApp app] controller] view] bounds];
return result;
}

Expand Down
7 changes: 6 additions & 1 deletion iphone/Classes/TiWindowProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ -(void)windowDidOpen
opened = YES;
if ([self _hasListeners:@"open"]) {
[self fireEvent:@"open" withObject:nil withSource:self propagate:NO reportSuccess:NO errorCode:0 message:nil];
if (focussed && [self handleFocusEvents]) {
if ([self _hasListeners:@"focus"]) {
[self fireEvent:@"focus" withObject:nil withSource:self propagate:NO reportSuccess:NO errorCode:0 message:nil];
}
}
}
[super windowDidOpen];
[self forgetProxy:openAnimation];
Expand Down Expand Up @@ -334,7 +339,7 @@ -(void)gainFocus
{
if (focussed == NO) {
focussed = YES;
if ([self handleFocusEvents]) {
if ([self handleFocusEvents] && opened) {
if ([self _hasListeners:@"focus"]) {
[self fireEvent:@"focus" withObject:nil withSource:self propagate:NO reportSuccess:NO errorCode:0 message:nil];
}
Expand Down