зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1095761 - Child plugin window focus handling for e10s. r=aklotz
This commit is contained in:
Родитель
b3db3d25ad
Коммит
d6954d90ce
|
@ -23,6 +23,8 @@
|
||||||
#include "gfxSharedImageSurface.h"
|
#include "gfxSharedImageSurface.h"
|
||||||
#include "nsNPAPIPluginInstance.h"
|
#include "nsNPAPIPluginInstance.h"
|
||||||
#include "nsPluginInstanceOwner.h"
|
#include "nsPluginInstanceOwner.h"
|
||||||
|
#include "nsFocusManager.h"
|
||||||
|
#include "nsIDOMElement.h"
|
||||||
#ifdef MOZ_X11
|
#ifdef MOZ_X11
|
||||||
#include "gfxXlibSurface.h"
|
#include "gfxXlibSurface.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -45,10 +47,6 @@
|
||||||
#include "mozilla/plugins/PluginSurfaceParent.h"
|
#include "mozilla/plugins/PluginSurfaceParent.h"
|
||||||
#include "nsClassHashtable.h"
|
#include "nsClassHashtable.h"
|
||||||
#include "nsHashKeys.h"
|
#include "nsHashKeys.h"
|
||||||
// Plugin focus event for widget.
|
|
||||||
extern const wchar_t* kOOPPPluginFocusEventId;
|
|
||||||
UINT gOOPPPluginFocusEvent =
|
|
||||||
RegisterWindowMessage(kOOPPPluginFocusEventId);
|
|
||||||
extern const wchar_t* kFlashFullscreenClass;
|
extern const wchar_t* kFlashFullscreenClass;
|
||||||
#elif defined(MOZ_WIDGET_GTK)
|
#elif defined(MOZ_WIDGET_GTK)
|
||||||
#include <gdk/gdk.h>
|
#include <gdk/gdk.h>
|
||||||
|
@ -1789,7 +1787,6 @@ PluginInstanceParent::SubclassPluginWindow(HWND aWnd)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(XP_WIN)
|
|
||||||
if (XRE_GetProcessType() == GeckoProcessType_Content) {
|
if (XRE_GetProcessType() == GeckoProcessType_Content) {
|
||||||
if (!aWnd) {
|
if (!aWnd) {
|
||||||
NS_WARNING("PluginInstanceParent::SubclassPluginWindow unexpected null window");
|
NS_WARNING("PluginInstanceParent::SubclassPluginWindow unexpected null window");
|
||||||
|
@ -1802,7 +1799,6 @@ PluginInstanceParent::SubclassPluginWindow(HWND aWnd)
|
||||||
sPluginInstanceList->Put((void*)mPluginHWND, this);
|
sPluginInstanceList->Put((void*)mPluginHWND, this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
NS_ASSERTION(!(mPluginHWND && aWnd != mPluginHWND),
|
NS_ASSERTION(!(mPluginHWND && aWnd != mPluginHWND),
|
||||||
"PluginInstanceParent::SubclassPluginWindow hwnd is not our window!");
|
"PluginInstanceParent::SubclassPluginWindow hwnd is not our window!");
|
||||||
|
@ -1821,7 +1817,6 @@ PluginInstanceParent::SubclassPluginWindow(HWND aWnd)
|
||||||
void
|
void
|
||||||
PluginInstanceParent::UnsubclassPluginWindow()
|
PluginInstanceParent::UnsubclassPluginWindow()
|
||||||
{
|
{
|
||||||
#if defined(XP_WIN)
|
|
||||||
if (XRE_GetProcessType() == GeckoProcessType_Content) {
|
if (XRE_GetProcessType() == GeckoProcessType_Content) {
|
||||||
if (mPluginHWND) {
|
if (mPluginHWND) {
|
||||||
// Remove 'this' from the plugin list safely
|
// Remove 'this' from the plugin list safely
|
||||||
|
@ -1837,7 +1832,6 @@ PluginInstanceParent::UnsubclassPluginWindow()
|
||||||
mPluginHWND = nullptr;
|
mPluginHWND = nullptr;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (mPluginHWND && mPluginWndProc) {
|
if (mPluginHWND && mPluginWndProc) {
|
||||||
::SetWindowLongPtrA(mPluginHWND, GWLP_WNDPROC,
|
::SetWindowLongPtrA(mPluginHWND, GWLP_WNDPROC,
|
||||||
|
@ -1980,14 +1974,21 @@ PluginInstanceParent::AnswerPluginFocusChange(const bool& gotFocus)
|
||||||
{
|
{
|
||||||
PLUGIN_LOG_DEBUG(("%s", FULLFUNCTION));
|
PLUGIN_LOG_DEBUG(("%s", FULLFUNCTION));
|
||||||
|
|
||||||
// Currently only in use on windows - an rpc event we receive from the
|
// Currently only in use on windows - an event we receive from the child
|
||||||
// child when it's plugin window (or one of it's children) receives keyboard
|
// when it's plugin window (or one of it's children) receives keyboard
|
||||||
// focus. We forward the event down to widget so the dom/focus manager can
|
// focus. We detect this and forward a notification here so we can update
|
||||||
// be updated.
|
// focus.
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
// XXX This needs to go to PuppetWidget. bug ???
|
if (gotFocus) {
|
||||||
if (XRE_GetProcessType() == GeckoProcessType_Default) {
|
nsPluginInstanceOwner* owner = GetOwner();
|
||||||
::SendMessage(mPluginHWND, gOOPPPluginFocusEvent, gotFocus ? 1 : 0, 0);
|
if (owner) {
|
||||||
|
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||||
|
nsCOMPtr<nsIDOMElement> element;
|
||||||
|
owner->GetDOMElement(getter_AddRefs(element));
|
||||||
|
if (fm && element) {
|
||||||
|
fm->SetFocus(element, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -250,11 +250,6 @@ const char* nsWindow::sDefaultMainWindowClass = kClassNameGeneral;
|
||||||
|
|
||||||
TriStateBool nsWindow::sHasBogusPopupsDropShadowOnMultiMonitor = TRI_UNKNOWN;
|
TriStateBool nsWindow::sHasBogusPopupsDropShadowOnMultiMonitor = TRI_UNKNOWN;
|
||||||
|
|
||||||
// Used in OOPP plugin focus processing.
|
|
||||||
const wchar_t* kOOPPPluginFocusEventId = L"OOPP Plugin Focus Widget Event";
|
|
||||||
uint32_t nsWindow::sOOPPPluginFocusEvent =
|
|
||||||
RegisterWindowMessageW(kOOPPPluginFocusEventId);
|
|
||||||
|
|
||||||
DWORD nsWindow::sFirstEventTime = 0;
|
DWORD nsWindow::sFirstEventTime = 0;
|
||||||
TimeStamp nsWindow::sFirstEventTimeStamp = TimeStamp();
|
TimeStamp nsWindow::sFirstEventTimeStamp = TimeStamp();
|
||||||
|
|
||||||
|
@ -5392,26 +5387,6 @@ nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
if (msg == nsAppShell::GetTaskbarButtonCreatedMessage())
|
|
||||||
SetHasTaskbarIconBeenCreated();
|
|
||||||
if (msg == sOOPPPluginFocusEvent) {
|
|
||||||
if (wParam == 1) {
|
|
||||||
// With OOPP, the plugin window exists in another process and is a child of
|
|
||||||
// this window. This window is a placeholder plugin window for the dom. We
|
|
||||||
// receive this event when the child window receives focus. (sent from
|
|
||||||
// PluginInstanceParent.cpp)
|
|
||||||
::SendMessage(mWnd, WM_MOUSEACTIVATE, 0, 0); // See nsPluginNativeWindowWin.cpp
|
|
||||||
} else {
|
|
||||||
// WM_KILLFOCUS was received by the child process.
|
|
||||||
if (sJustGotDeactivate) {
|
|
||||||
DispatchFocusToTopLevelWindow(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case WM_SETTINGCHANGE:
|
case WM_SETTINGCHANGE:
|
||||||
if (IsWin8OrLater() && lParam &&
|
if (IsWin8OrLater() && lParam &&
|
||||||
!wcsicmp(L"ConvertibleSlateMode", (wchar_t*)lParam)) {
|
!wcsicmp(L"ConvertibleSlateMode", (wchar_t*)lParam)) {
|
||||||
|
@ -5429,6 +5404,14 @@ nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
if (msg == nsAppShell::GetTaskbarButtonCreatedMessage()) {
|
||||||
|
SetHasTaskbarIconBeenCreated();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//*aRetValue = result;
|
//*aRetValue = result;
|
||||||
|
|
|
@ -491,8 +491,6 @@ protected:
|
||||||
static TriStateBool sHasBogusPopupsDropShadowOnMultiMonitor;
|
static TriStateBool sHasBogusPopupsDropShadowOnMultiMonitor;
|
||||||
static bool HasBogusPopupsDropShadowOnMultiMonitor();
|
static bool HasBogusPopupsDropShadowOnMultiMonitor();
|
||||||
|
|
||||||
static uint32_t sOOPPPluginFocusEvent;
|
|
||||||
|
|
||||||
// Non-client margin settings
|
// Non-client margin settings
|
||||||
// Pre-calculated outward offset applied to default frames
|
// Pre-calculated outward offset applied to default frames
|
||||||
nsIntMargin mNonClientOffset;
|
nsIntMargin mNonClientOffset;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче