Fix bug 333635, Popupmenus don't close properly. r=josh

This commit is contained in:
hwaara%gmail.com 2006-04-12 15:10:00 +00:00
Родитель af180d3353
Коммит 84874617f6
1 изменённых файлов: 10 добавлений и 1 удалений

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

@ -2556,6 +2556,7 @@ nsChildView::GetThebesSurface()
- (void)mouseDown:(NSEvent *)theEvent - (void)mouseDown:(NSEvent *)theEvent
{ {
BOOL popupRolledUp = NO;
// make sure this view is not in the rollup widget // make sure this view is not in the rollup widget
// the fastest way to do this is by comparing native window pointers // the fastest way to do this is by comparing native window pointers
if (gRollupWidget != nsnull) { if (gRollupWidget != nsnull) {
@ -2563,10 +2564,18 @@ nsChildView::GetThebesSurface()
NSWindow *rollupNativeWindow = (NSWindow*)gRollupWidget->GetNativeData(NS_NATIVE_WINDOW); NSWindow *rollupNativeWindow = (NSWindow*)gRollupWidget->GetNativeData(NS_NATIVE_WINDOW);
if (ourNativeWindow != rollupNativeWindow) { if (ourNativeWindow != rollupNativeWindow) {
// roll up any popups // roll up any popups
if (gRollupListener != nsnull) if (gRollupListener != nsnull) {
gRollupListener->Rollup(); gRollupListener->Rollup();
popupRolledUp = YES;
}
} }
} }
// If we rolled up a popup, we don't want to pass the click down to gecko.
// This happens e.g. when you click a popupmenubutton (the menu opens), then click
// on the popupmenubutton a second time, which should hide the menu.
if (popupRolledUp)
return;
// if the command and alt keys are held down, initiate hand scrolling // if the command and alt keys are held down, initiate hand scrolling
if ([ChildView areHandScrollModifiers:[theEvent modifierFlags]]) { if ([ChildView areHandScrollModifiers:[theEvent modifierFlags]]) {