Skip to content

Commit

Permalink
-use _endSheet to end sheets
Browse files Browse the repository at this point in the history
-do not call orderFront: if the sheet is already visible
  • Loading branch information
walisser committed Apr 29, 2012
1 parent 8fd5f30 commit 66f55df
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions AppKit/CPApplication.j
Expand Up @@ -933,21 +933,19 @@ CPRunContinuesResponse = -1002;
return;
}

if ([aWindow attachedSheet])
{
[CPException raise:CPInternalInconsistencyException reason:@"The target window of beginSheet: already has a sheet"];
return;
}

if ([aWindow isSheet])
{
[CPException raise:CPInternalInconsistencyException reason:@"The target window of beginSheet: cannot be a sheet"];
return;
}


[aWindow orderFront:self];
[aSheet setPlatformWindow:[aWindow platformWindow]];

// -dw- if a sheet is already visible, we skip this since it serves no purpose and causes
// orderOut: to be called on the sheet, which is not what we want.
if (![aWindow isVisible])
{
[aWindow orderFront:self];
[aSheet setPlatformWindow:[aWindow platformWindow]];
}
[aWindow _attachSheet:aSheet modalDelegate:aModalDelegate didEndSelector:aDidEndSelector contextInfo:aContextInfo];
}

Expand Down Expand Up @@ -976,7 +974,7 @@ CPRunContinuesResponse = -1002;
if (context != nil && context["sheet"] === sheet)
{
context["returnCode"] = returnCode;
[aWindow _detachSheetWindow];
[aWindow _endSheet];
return;
}
}
Expand Down

0 comments on commit 66f55df

Please sign in to comment.