зеркало из https://github.com/mozilla/pjs.git
allow tabbing from url bar to search field then into content area, part
of bug 198153
This commit is contained in:
Родитель
a8ac346497
Коммит
cd07a46e50
|
@ -761,10 +761,15 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
|
|||
[self completeSelectedResult];
|
||||
return YES;
|
||||
} else {
|
||||
// The usual nextKeyView business in the NIB should handle but it doesn't
|
||||
// this is basically a benign hack
|
||||
NSWindow* wind = [self window];
|
||||
[wind makeFirstResponder:wind];
|
||||
// use the normal key view unless we know more about our siblings and have
|
||||
// explicitly nil'd out the next key view. In that case, select the window
|
||||
// to break out of the toolbar and tab through the rest of the window
|
||||
if ([self nextKeyView])
|
||||
[[self window] selectKeyViewFollowingView:self];
|
||||
else {
|
||||
NSWindow* wind = [self window];
|
||||
[wind makeFirstResponder:wind];
|
||||
}
|
||||
}
|
||||
} else if (command == @selector(deleteBackward:) ||
|
||||
command == @selector(deleteForward:)) {
|
||||
|
|
|
@ -644,6 +644,21 @@ static NSArray* sToolbarDefaults = nil;
|
|||
// actually move the window
|
||||
[[self window] setFrameOrigin: testBrowserFrame.origin];
|
||||
}
|
||||
|
||||
// if the search field is not on the toolbar, nil out the nextKeyView of the
|
||||
// url bar so that we know to break off the toolbar when tabbing. If it is,
|
||||
// and we're running on pre-panther, set the search bar as the tab view. We
|
||||
// don't want to do this on panther because it will do it for us.
|
||||
if (![mSearchBar window])
|
||||
[mURLBar setNextKeyView:nil];
|
||||
else {
|
||||
const float kPantherAppKit = 743.0;
|
||||
if (NSAppKitVersionNumber < kPantherAppKit)
|
||||
[mURLBar setNextKeyView:mSearchBar];
|
||||
}
|
||||
|
||||
// needed when full keyboard access is enabled
|
||||
[mLock setRefusesFirstResponder:YES];
|
||||
}
|
||||
|
||||
- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)proposedFrameSize
|
||||
|
@ -728,6 +743,15 @@ static NSArray* sToolbarDefaults = nil;
|
|||
mSidebarToolbarItem = item;
|
||||
else if ( [[item itemIdentifier] isEqual:BookmarkToolbarItemIdentifier] )
|
||||
mBookmarkToolbarItem = item;
|
||||
else if ( [[item itemIdentifier] isEqual:SearchToolbarItemIdentifier] ) {
|
||||
// restore the next key view of the url bar to the search bar, but only
|
||||
// if we're on jaguar. On panther, we really don't know that it should
|
||||
// be the search toolbar (it could be another toolbar button if full keyboard
|
||||
// access is enabled) but it will fix itself automatically.
|
||||
const float kPantherAppKit = 743.0;
|
||||
if (NSAppKitVersionNumber < kPantherAppKit)
|
||||
[mURLBar setNextKeyView:mSearchBar];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -746,6 +770,12 @@ static NSArray* sToolbarDefaults = nil;
|
|||
[self stopThrobber];
|
||||
else if ( [[item itemIdentifier] isEqual:BookmarkToolbarItemIdentifier] )
|
||||
mBookmarkToolbarItem = nil;
|
||||
else if ( [[item itemIdentifier] isEqual:SearchToolbarItemIdentifier] ) {
|
||||
// search bar removed, set next key view of url bar to nil which tells
|
||||
// it to break out of the toolbar tab ring on a tab.
|
||||
[mURLBar setNextKeyView:nil];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar *)toolbar
|
||||
|
|
|
@ -43,6 +43,11 @@
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
- (BOOL)acceptsFirstResponder
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void) resetCursorRects
|
||||
{
|
||||
// XXX provide image for drag-hand cursor
|
||||
|
|
|
@ -180,11 +180,17 @@
|
|||
|
||||
// If the user hit tab, go to the next key view
|
||||
case NSTabTextMovement:
|
||||
[[self window] selectKeyViewFollowingView:self];
|
||||
{
|
||||
// [[self window] selectKeyViewFollowingView:self];
|
||||
// we should be able to just select the next key view, but at some point we have
|
||||
// to break the cycle and kick the user off the toolbar. Do it here. Selecting
|
||||
// the window allows us to tab into the content area.
|
||||
NSWindow* wind = [self window];
|
||||
[wind makeFirstResponder:wind];
|
||||
|
||||
if ([[self window] firstResponder] == [self window])
|
||||
[self selectText:self];
|
||||
|
||||
// if ([[self window] firstResponder] == [self window])
|
||||
// [self selectText:self];
|
||||
}
|
||||
break;
|
||||
|
||||
// If the user hit shift-tab, go to the key view before us
|
||||
|
|
Загрузка…
Ссылка в новой задаче