From d418ba0b3470ebe056fb4d065b2bc2da6df30eab Mon Sep 17 00:00:00 2001 From: "masayuki%d-toybox.com" Date: Mon, 5 Dec 2005 05:59:23 +0000 Subject: [PATCH] Bug 317486 Some plug-ins may eat WM_SETFOCUS / WM_KILLFOCUS patch by Masatoshi Kimura (emk) r=ere, sr=roc git-svn-id: svn://10.0.0.236/trunk@185689 18797224-902f-48f8-a5cc-f745e15eee43 --- .../base/src/nsPluginNativeWindowWin.cpp | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/mozilla/modules/plugin/base/src/nsPluginNativeWindowWin.cpp b/mozilla/modules/plugin/base/src/nsPluginNativeWindowWin.cpp index 77d3910a05d..d85cb36e447 100644 --- a/mozilla/modules/plugin/base/src/nsPluginNativeWindowWin.cpp +++ b/mozilla/modules/plugin/base/src/nsPluginNativeWindowWin.cpp @@ -137,11 +137,13 @@ private: public: // locals + WNDPROC GetPrevWindowProc(); WNDPROC GetWindowProc(); nsIEventQueueService *GetEventService(); PluginWindowEvent * GetPluginWindowEvent(HWND aWnd, UINT aMsg, WPARAM aWParam, LPARAM aLParam); private: + WNDPROC mPrevWinProc; WNDPROC mPluginWinProc; nsCOMPtr mEventService; PluginWindowEvent mPluginWindowEvent; @@ -305,6 +307,16 @@ static LRESULT CALLBACK PluginWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM } } break; + + case WM_SETFOCUS: + case WM_KILLFOCUS: { + // Make sure setfocus and killfocus get through + // even if they are eaten by the plugin + WNDPROC prevWndProc = win->GetPrevWindowProc(); + if (prevWndProc) + ::CallWindowProc(prevWndProc, hWnd, msg, wParam, lParam); + break; + } #endif } @@ -394,6 +406,7 @@ nsPluginNativeWindowWin::nsPluginNativeWindowWin() : nsPluginNativeWindow() width = 0; height = 0; + mPrevWinProc = NULL; mPluginWinProc = NULL; mPluginWindowEvent.SetIsAlloced(PR_FALSE); mPluginType = nsPluginType_Unknown; @@ -412,6 +425,11 @@ nsPluginNativeWindowWin::~nsPluginNativeWindowWin() } } +WNDPROC nsPluginNativeWindowWin::GetPrevWindowProc() +{ + return mPrevWinProc; +} + WNDPROC nsPluginNativeWindowWin::GetWindowProc() { return mPluginWinProc; @@ -499,8 +517,17 @@ nsresult nsPluginNativeWindowWin::CallSetWindow(nsCOMPtr &aPl // WINCE does not subclass windows. See bug 300011 for the details. #ifndef WINCE - if (!aPluginInstance) + if (!aPluginInstance) { UndoSubclassAndAssociateWindow(); + mPrevWinProc = NULL; + } + + // We need WndProc before plug-ins do subclass in nsPluginNativeWindow::CallSetWindow. + if (aPluginInstance) { + WNDPROC currentWndProc = (WNDPROC)::GetWindowLong((HWND)window, GWL_WNDPROC); + if (currentWndProc != PluginWndProc) + mPrevWinProc = currentWndProc; + } #endif nsPluginNativeWindow::CallSetWindow(aPluginInstance);