diff --git a/dom/plugins/PluginInstanceParent.cpp b/dom/plugins/PluginInstanceParent.cpp index 5790b5eda609..c9ffc6378b01 100644 --- a/dom/plugins/PluginInstanceParent.cpp +++ b/dom/plugins/PluginInstanceParent.cpp @@ -903,11 +903,8 @@ PluginInstanceParent::PluginWindowHookProc(HWND hWnd, switch (message) { case WM_SETFOCUS: - // Widget may be calling us back from AnswerPluginGotFocus(), make - // sure we don't end up sending this back over. If we're not in - // SendMessage, this is coming from the dom / focus manager. - if ((::InSendMessageEx(NULL) & (ISMEX_SEND|ISMEX_REPLIED)) != ISMEX_SEND) - self->CallSetPluginFocus(); + // Let the child plugin window know it should take focus. + self->CallSetPluginFocus(); break; case WM_CLOSE: diff --git a/widget/src/windows/nsWindow.cpp b/widget/src/windows/nsWindow.cpp index 7101bbba7e68..3b50099e9798 100644 --- a/widget/src/windows/nsWindow.cpp +++ b/widget/src/windows/nsWindow.cpp @@ -3655,12 +3655,20 @@ nsWindow::IsAsyncResponseEvent(UINT aMsg, LRESULT& aResult) return false; } -// static void -nsWindow::IPCWindowProcHandler(HWND& hWnd, UINT& msg, WPARAM& wParam, LPARAM& lParam) +nsWindow::IPCWindowProcHandler(UINT& msg, WPARAM& wParam, LPARAM& lParam) { NS_ASSERTION(!mozilla::ipc::SyncChannel::IsPumpingMessages(), "Failed to prevent a nonqueued message from running!"); + + // Windowed plugins receiving focus triggering WM_ACTIVATE app messages. + if (mWindowType == eWindowType_plugin && msg == WM_SETFOCUS && + ::GetPropW(mWnd, L"PluginInstanceParentProperty")) { + ::ReplyMessage(0); + return; + } + + // Modal UI being displayed in windowless plugins. if (mozilla::ipc::RPCChannel::IsSpinLoopActive() && (::InSendMessageEx(NULL)&(ISMEX_REPLIED|ISMEX_SEND)) == ISMEX_SEND) { LRESULT res; @@ -3695,8 +3703,12 @@ nsWindow::IPCWindowProcHandler(HWND& hWnd, UINT& msg, WPARAM& wParam, LPARAM& lP // The WndProc procedure for all nsWindows in this toolkit LRESULT CALLBACK nsWindow::WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { + // Get the window which caused the event and ask it to process the message + nsWindow *someWindow = GetNSWindowPtr(hWnd); + #ifdef MOZ_IPC - IPCWindowProcHandler(hWnd, msg, wParam, lParam); + if (someWindow) + someWindow->IPCWindowProcHandler(msg, wParam, lParam); #endif // create this here so that we store the last rolled up popup until after @@ -3707,9 +3719,6 @@ LRESULT CALLBACK nsWindow::WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM if ( DealWithPopups(hWnd, msg, wParam, lParam, &popupHandlingResult) ) return popupHandlingResult; - // Get the window which caused the event and ask it to process the message - nsWindow *someWindow = GetNSWindowPtr(hWnd); - // XXX This fixes 50208 and we are leaving 51174 open to further investigate // why we are hitting this assert if (nsnull == someWindow) { diff --git a/widget/src/windows/nsWindow.h b/widget/src/windows/nsWindow.h index e41eb93f7ad2..94cc0ac0d003 100644 --- a/widget/src/windows/nsWindow.h +++ b/widget/src/windows/nsWindow.h @@ -387,7 +387,7 @@ protected: #ifdef MOZ_IPC static bool IsAsyncResponseEvent(UINT aMsg, LRESULT& aResult); - static void IPCWindowProcHandler(HWND& hWnd, UINT& msg, WPARAM& wParam, LPARAM& lParam); + void IPCWindowProcHandler(UINT& msg, WPARAM& wParam, LPARAM& lParam); #endif // MOZ_IPC /**