Bug 317486 Some plug-ins may eat WM_SETFOCUS / WM_KILLFOCUS patch by Masatoshi Kimura (emk) <VYV03354@nifty.ne.jp> r=ere, sr=roc

This commit is contained in:
masayuki%d-toybox.com 2005-12-05 05:59:23 +00:00
parent 2f2cb5e85a
commit 120c6432db

View File

@ -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<nsIEventQueueService> 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<nsIPluginInstance> &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);