diff --git a/AppKit/CPTextField.j b/AppKit/CPTextField.j index ef77ea021..619c12d08 100644 --- a/AppKit/CPTextField.j +++ b/AppKit/CPTextField.j @@ -569,6 +569,14 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder"); return YES; } +/*! + Text fields require panels to become key window, so this returns \c YES. +*/ +- (BOOL)needsPanelToBecomeKey +{ + return YES; +} + - (void)mouseDown:(CPEvent)anEvent { // Don't track! (ever?) @@ -1028,6 +1036,8 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder"); var view = [[_CPImageAndTextView alloc] initWithFrame:_CGRectMakeZero()]; //[view setImagePosition:CPNoImage]; + [view setHitTests:NO]; + return view; } diff --git a/AppKit/CPView.j b/AppKit/CPView.j index e865737b2..a112d62ca 100644 --- a/AppKit/CPView.j +++ b/AppKit/CPView.j @@ -1284,6 +1284,14 @@ var CPViewFlags = { }, return self; } +/*! + Returns \c YES if this view requires a panel to become key. Normally only text fields, so this returns \c NO. +*/ +- (BOOL)needsPanelToBecomeKey +{ + return NO; +} + /*! Returns \c YES if mouse events aren't needed by the receiver and can be sent to the superview. The default implementation returns \c NO if the view is opaque. diff --git a/AppKit/CPWindow/CPWindow.j b/AppKit/CPWindow/CPWindow.j index 07d9f38f4..84fff9816 100644 --- a/AppKit/CPWindow/CPWindow.j +++ b/AppKit/CPWindow/CPWindow.j @@ -1321,7 +1321,7 @@ CPTexturedBackgroundWindowMask var theWindow = [anEvent window]; - if ([theWindow isKeyWindow] || [theWindow becomesKeyOnlyIfNeeded]) + if ([theWindow isKeyWindow] || [theWindow becomesKeyOnlyIfNeeded] && ![_leftMouseDownView needsPanelToBecomeKey]) return [_leftMouseDownView mouseDown:anEvent]; else {