Bug 563377 - Flash fullscreen window refuses to close. r=bent.

This commit is contained in:
Jim Mathies 2010-05-18 11:43:45 -05:00
parent 30a2680088
commit eb4761537a
2 changed files with 33 additions and 2 deletions

View File

@ -54,6 +54,7 @@
extern const PRUnichar* kOOPPPluginFocusEventId;
UINT gOOPPPluginFocusEvent =
RegisterWindowMessage(kOOPPPluginFocusEventId);
extern const PRUnichar* kFlashFullscreenClass;
UINT gOOPPSpinNativeLoopEvent =
RegisterWindowMessage(L"SyncChannel Spin Inner Loop Message");
UINT gOOPPStopNativeLoopEvent =
@ -660,7 +661,7 @@ PluginInstanceParent::NPP_HandleEvent(void* event)
if (hwnd && hwnd != mPluginHWND &&
GetClassNameW(hwnd, szClass,
sizeof(szClass)/sizeof(PRUnichar)) &&
!wcscmp(szClass, L"ShockwaveFlashFullScreen")) {
!wcscmp(szClass, kFlashFullscreenClass)) {
return 0;
}
}

View File

@ -69,12 +69,17 @@ using namespace mozilla::plugins;
#ifndef WM_MOUSEHWHEEL
#define WM_MOUSEHWHEEL 0x020E
#endif
const PRUnichar * kFlashFullscreenClass = L"ShockwaveFlashFullScreen";
#endif
namespace {
PluginModuleChild* gInstance = nsnull;
}
#ifdef XP_WIN
// Used with fix for flash fullscreen window loosing focus.
static bool gDelayFlashFocusReplyUntilEval = false;
#endif
PluginModuleChild::PluginModuleChild() :
mLibrary(0),
@ -1167,6 +1172,13 @@ _evaluate(NPP aNPP,
return false;
}
#ifdef XP_WIN
if (gDelayFlashFocusReplyUntilEval) {
ReplyMessage(0);
gDelayFlashFocusReplyUntilEval = false;
}
#endif
return actor->Evaluate(aScript, aResult);
}
@ -1884,6 +1896,8 @@ PluginModuleChild::ExitedCall()
LRESULT CALLBACK
PluginModuleChild::CallWindowProcHook(int nCode, WPARAM wParam, LPARAM lParam)
{
gDelayFlashFocusReplyUntilEval = false;
// Trap and reply to anything we recognize as the source of a
// potential send message deadlock.
if (nCode >= 0 &&
@ -1892,7 +1906,6 @@ PluginModuleChild::CallWindowProcHook(int nCode, WPARAM wParam, LPARAM lParam)
switch(pCwp->message) {
// Sync messages we can reply to:
case WM_SETFOCUS:
case WM_KILLFOCUS:
case WM_MOUSEHWHEEL:
case WM_MOUSEWHEEL:
case WM_HSCROLL:
@ -1902,6 +1915,23 @@ PluginModuleChild::CallWindowProcHook(int nCode, WPARAM wParam, LPARAM lParam)
case WM_WINDOWPOSCHANGED:
ReplyMessage(0);
break;
case WM_KILLFOCUS:
{
// Fix for flash fullscreen window loosing focus. On single
// core systems, sync killfocus events need to be handled
// after the flash fullscreen window procedure processes this
// message, otherwise fullscreen focus will not work correctly.
PRUnichar szClass[26];
if (GetClassNameW(pCwp->hwnd, szClass,
sizeof(szClass)/sizeof(PRUnichar)) &&
!wcscmp(szClass, kFlashFullscreenClass)) {
gDelayFlashFocusReplyUntilEval = true;
}
else {
ReplyMessage(0);
}
}
break;
// Sync message that can't be handled:
case WM_WINDOWPOSCHANGING:
case WM_DESTROY: