From 99e5ca772d88e0c5e3d979c0312c51ae0a175891 Mon Sep 17 00:00:00 2001 From: "ccarlen%netscape.com" Date: Tue, 2 Jul 2002 19:01:34 +0000 Subject: [PATCH] Bug 154880 - dropdown lists don't go away on a click outside of them. r=pink/sr=sfraser --- .../powerplant/source/EmbedEventHandling.cpp | 44 +++++++++++-------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/embedding/browser/powerplant/source/EmbedEventHandling.cpp b/embedding/browser/powerplant/source/EmbedEventHandling.cpp index 9b5f584ec2dd..a8d9456d54db 100644 --- a/embedding/browser/powerplant/source/EmbedEventHandling.cpp +++ b/embedding/browser/powerplant/source/EmbedEventHandling.cpp @@ -142,24 +142,32 @@ void CEmbedEventAttachment::ExecuteSelf(MessageT inMessage, switch (inMacEvent->what) { - case mouseDown: - { - SInt16 thePart = ::MacFindWindow(inMacEvent->where, &macWindowP); - if (thePart == inContent && IsAlienGeckoWindow(macWindowP)) { - nsCOMPtr sink; - GetWindowEventSink(macWindowP, getter_AddRefs(sink)); - if ( sink ) { - PRBool handled = PR_FALSE; - sink->DispatchEvent(inMacEvent, &handled); - mLastAlienWindowClicked = macWindowP; - SetExecuteHost(false); - } - } - else - mLastAlienWindowClicked = nil; - } - break; - + case mouseDown: + { + mLastAlienWindowClicked = nil; + // If an alien window is frontmost, as they always are when present, + // Gecko needs to get the event - no matter where the click occured. + // This is so the pop-up window (what these alien windows are used for) + // will be rolled up on a click in the menu bar, title bar, etc. + WindowPtr frontWindow = ::FrontWindow(); + if (IsAlienGeckoWindow(frontWindow)) { + nsCOMPtr sink; + GetWindowEventSink(frontWindow, getter_AddRefs(sink)); + if (sink) { + PRBool handled = PR_FALSE; + sink->DispatchEvent(inMacEvent, &handled); + SInt16 thePart = ::MacFindWindow(inMacEvent->where, &macWindowP); + if ((thePart == inContent) && (frontWindow == macWindowP)) { + // It the click was actually in an alien window - done processing + // Otherwise, let PowerPlant continue processing the click. + mLastAlienWindowClicked = macWindowP; + SetExecuteHost(false); + } + } + } + } + break; + case mouseUp: { if (mLastAlienWindowClicked) {