Fixed: couldn't set the first responder of a sheet

Previously the sheet was made key at the beginning of the animation. It turns out events would not reliably make it to the sheet during animation. The other problem is that if a text field was the first responder, at the beginning of the animation it is offscreen, which means it refuses first responder and sets the first responder to nil.

Now we no longer try to make the sheet key before the animation ends, avoiding the text field problem.
This commit is contained in:
Aparajita Fishman committed 2013-03-14 00:30:37 -04:00
1 parent 9a28beb6b5
commit 03b663463d
1 file changed
+3 -7
+3 -7
View File
@@ -2735,8 +2735,7 @@ CPTexturedBackgroundWindowMask
- (void)_sheetShouldAnimateIn:(CPTimer)timer
{
// Can't open sheet while opening or closing animation is going on
if (_sheetContext["isOpening"] ||
_sheetContext["isClosing"])
if (_sheetContext["isOpening"] || _sheetContext["isClosing"])
return;
var sheet = _sheetContext["sheet"];
@@ -2778,11 +2777,6 @@ CPTexturedBackgroundWindowMask
_sheetContext["isOpening"] = YES;
[sheet _setFrame:endFrame delegate:self duration:[self animationResizeTime:endFrame] curve:CPAnimationEaseOut];
// NOTE: cocoa doesn't make window key until animation is done, but a
// keypress while animating eventually gets to the window. Therefore,
// there must be a runloop specifically designed for sheets?
[sheet makeKeyWindow];
}
- (void)_sheetShouldAnimateOut:(CPTimer)timer
@@ -2842,6 +2836,8 @@ CPTexturedBackgroundWindowMask
// we wanted to close the sheet while it animated in, do that now
if (_sheetContext["shouldClose"] === YES)
[self _detachSheetWindow];
else
[sheet makeKeyWindow];
}
else
{