From 1edcc511d6abfb0f87d45f550d62d1ca5518513b Mon Sep 17 00:00:00 2001 From: Antoine Mercadal Date: Fri, 5 Oct 2012 17:58:54 -0700 Subject: [PATCH] Allow custom action for search button If there is no menu, and search button has a target/action, then send the action. --- AppKit/CPSearchField.j | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/AppKit/CPSearchField.j b/AppKit/CPSearchField.j index 173fbfd7b..c9f6ba148 100644 --- a/AppKit/CPSearchField.j +++ b/AppKit/CPSearchField.j @@ -501,7 +501,12 @@ var RECENT_SEARCH_PREFIX = @" "; if (_CGRectContainsPoint([self searchButtonRectForBounds:[self bounds]], point)) { if (_searchMenuTemplate == nil) - [self _sendAction:self]; + { + if ([_searchButton target] && [_searchButton action]) + [_searchButton mouseDown:anEvent]; + else + [self _sendAction:self]; + } else [self _showMenu]; }