From 84874617f6f0426879c37009f3eb98a9db212f5a Mon Sep 17 00:00:00 2001 From: "hwaara%gmail.com" Date: Wed, 12 Apr 2006 15:10:00 +0000 Subject: [PATCH] Fix bug 333635, Popupmenus don't close properly. r=josh --- widget/src/cocoa/nsChildView.mm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/widget/src/cocoa/nsChildView.mm b/widget/src/cocoa/nsChildView.mm index b76008f4901..3be3dc812e7 100644 --- a/widget/src/cocoa/nsChildView.mm +++ b/widget/src/cocoa/nsChildView.mm @@ -2556,6 +2556,7 @@ nsChildView::GetThebesSurface() - (void)mouseDown:(NSEvent *)theEvent { + BOOL popupRolledUp = NO; // make sure this view is not in the rollup widget // the fastest way to do this is by comparing native window pointers if (gRollupWidget != nsnull) { @@ -2563,10 +2564,18 @@ nsChildView::GetThebesSurface() NSWindow *rollupNativeWindow = (NSWindow*)gRollupWidget->GetNativeData(NS_NATIVE_WINDOW); if (ourNativeWindow != rollupNativeWindow) { // roll up any popups - if (gRollupListener != nsnull) + if (gRollupListener != nsnull) { 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 ([ChildView areHandScrollModifiers:[theEvent modifierFlags]]) {