From f7a4224bca02ee4a403a7ed70820bcee6eec7510 Mon Sep 17 00:00:00 2001 From: "brade%netscape.com" Date: Thu, 3 May 2001 20:19:43 +0000 Subject: [PATCH] fix for bug 66742; r=joki, sr=sfraser; grab focusedWidget between keydown and keypress in case it was changed --- widget/src/mac/nsMacEventHandler.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/widget/src/mac/nsMacEventHandler.cpp b/widget/src/mac/nsMacEventHandler.cpp index 66b5a96474d2..cbe7973aef96 100644 --- a/widget/src/mac/nsMacEventHandler.cpp +++ b/widget/src/mac/nsMacEventHandler.cpp @@ -1055,6 +1055,16 @@ PRBool nsMacEventHandler::HandleKeyEvent(EventRecord& aOSEvent) case keyDown: InitializeKeyEvent(keyEvent,aOSEvent,focusedWidget,NS_KEY_DOWN); result = focusedWidget->DispatchWindowEvent(keyEvent); + + // get the focused widget again in case something happened to it on the previous event + nsWindow* checkFocusedWidget = gEventDispatchHandler.GetActive(); + if (!checkFocusedWidget) + checkFocusedWidget = mTopLevelWidget; + + // if this isn't the same widget we had before, we should not send a keypress + if (checkFocusedWidget != focusedWidget) + return result; + //if (result == PR_FALSE) // continue processing??? talk to Tague about this (key event spec) { InitializeKeyEvent(keyEvent,aOSEvent,focusedWidget,NS_KEY_PRESS);