Refs #1364. Avoid repeated makeFirstResponder: calls within sheet parent.

If a window contained a text field which was the initial first responder, and the window was displaying a sheet, clicking on the window would cause the text field to alternate between being the first responder and not.

This was caused by the window `orderFront:` setting its first responder to the initial responder if there wasn't any responder yet. This would cause the text field to focus, even that the window wasn't the key window, and then on the next click the text field would blur which would make the text field automatically resign its first responder status.

The solution is to leave the first responder status alone if a window which isn't the key window is `orderFront:`ed. This appears to be more sensible UX in general. You don't expect the first responder of non-key windows to change when you click it's background.
This commit is contained in:
Alexander Ljungberg
2012-08-14 22:43:01 +01:00
parent 77266e0b3c
commit e3d0d69918
+3 -3
View File
@@ -857,12 +857,12 @@ CPTexturedBackgroundWindowMask
[_platformWindow order:CPWindowAbove window:self relativeTo:nil];
#endif
if (_firstResponder === self || !_firstResponder)
[self makeFirstResponder:_initialFirstResponder];
if (!CPApp._keyWindow)
[self makeKeyWindow];
if ([self isKeyWindow] && (_firstResponder === self || !_firstResponder))
[self makeFirstResponder:_initialFirstResponder];
if (!CPApp._mainWindow)
[self makeMainWindow];
}