Left-clicking on Customize Toolbar popup doesn't give app focus to Firefox. b=434097 r=josh sr=roc

This commit is contained in:
Steven Michaud 2008-06-27 15:31:54 -05:00
Родитель 161f55769a
Коммит 0d4abe0152
1 изменённых файлов: 33 добавлений и 22 удалений

Просмотреть файл

@ -2249,16 +2249,20 @@ already_AddRefed<nsIDOMElement> GetFocusedElement()
[target scrollWheel:anEvent];
break;
case NSLeftMouseDown:
if ([NSApp isActive]) {
[target mouseDown:anEvent];
// If we're in a context menu we don't want the OS to send the coming
// NSLeftMouseUp event to NSApp via the window server, but we do want
// our ChildView to receive an NSLeftMouseUp event (and to send a Gecko
// NS_MOUSE_BUTTON_UP event to the corresponding nsChildView object).
// If our NSApp isn't active (i.e. if we're in a context menu raised
// by a right mouse down event) when it receives the coming NSLeftMouseUp
// via the window server, our app will (in effect) become partially
// activated, which has strange side effects: For example, if another
// app's window had the focus, that window will lose the focus and the
} else if (mIsContextMenu) {
[target mouseDown:anEvent];
// If we're in a context menu and our NSApp isn't active (i.e. if
// we're in a context menu raised by a right mouse-down event), we
// don't want the OS to send the coming NSLeftMouseUp event to NSApp
// via the window server, but we do want our ChildView to receive an
// NSLeftMouseUp event (and to send a Gecko NS_MOUSE_BUTTON_UP event
// to the corresponding nsChildView object). If our NSApp isn't
// active when it receives the coming NSLeftMouseUp via the window
// server, our app will (in effect) become partially activated,
// which has strange side effects: For example, if another app's
// window had the focus, that window will lose the focus and the
// other app's main menu will be completely disabled (though it will
// continue to be displayed).
// A side effect of not allowing the coming NSLeftMouseUp event to be
@ -2270,7 +2274,6 @@ already_AddRefed<nsIDOMElement> GetFocusedElement()
// If our ChildView's corresponding nsChildView object doesn't
// dispatch an NS_MOUSE_BUTTON_UP event, none of our active menu items
// will "work" on an NSLeftMouseUp.
if (mIsContextMenu && ![NSApp isActive]) {
NSEvent *newEvent = [NSEvent mouseEventWithType:NSLeftMouseUp
location:windowLocation
modifierFlags:[anEvent modifierFlags]
@ -2282,6 +2285,14 @@ already_AddRefed<nsIDOMElement> GetFocusedElement()
pressure:0.0];
[target mouseUp:newEvent];
RollUpPopups();
} else {
// If our NSApp isn't active and we're not a context menu (i.e. if
// we're an ordinary popup window), activate us before sending the
// event to its target. This prevents us from being used in the
// background, and resolves bmo bug 434097 (another app focus
// wierdness bug).
[NSApp activateIgnoringOtherApps:YES];
[target mouseDown:anEvent];
}
break;
case NSLeftMouseUp: