gecko-dev/widget/windows/WinNativeEventData.h
Masayuki Nakano b332dc9ff4 Bug 1257759 part.5 PluginInstanceChild should post received native key event to chrome process if the key combination may be a shortcut key r=jimm
When PluginInstanceChild receives native key events, it should post the events to the chrome process first for checking if the key combination is reserved.  However, posting all key events to the chrome process may make damage to the performance of text input.  Therefore, this patch starts to post a key event whose key combination may be a shortcut key.  However, for avoiding to shuffle the event order, it posts following key events until all posted key events are handled by the chrome process.

For receiving response from widget, this patch defines nsIKeyEventInPluginCallback.  It's specified by nsIWidget::OnWindowedPluginKeyEvent() for ensuring the caller will receive the reply.  Basically, the caller of nsIWidget::OnWindowedPluginKeyEvent() should reply to the child process.  However, if the widget is a PuppetWidget, it cannot return the result synchronously.  Therefore, PuppetWidget::OnWindowedPluginKeyEvent() returns NS_SUCCESS_EVENT_HANDLED_ASYNCHRONOUSLY and stores the callback to mKeyEventInPluginCallbacks.  Then, TabParent::HandledWindowedPluginKeyEvent() will call PuppetWidget::HandledWindowedPluginKeyEvent().

MozReview-Commit-ID: G6brOU26NwQ

--HG--
extra : rebase_source : 8140456de278956d2d594e85c7b397ae366b4962
2016-04-19 20:09:37 +09:00

57 lines
1.5 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_widget_WinNativeEventData_h_
#define mozilla_widget_WinNativeEventData_h_
#include <windows.h>
#include "mozilla/EventForwards.h"
#include "mozilla/widget/WinModifierKeyState.h"
namespace mozilla {
namespace widget {
/**
* WinNativeKeyEventData is used by nsIWidget::OnWindowedPluginKeyEvent() and
* related IPC methods. This class cannot hold any pointers and references
* since which are not available in different process.
*/
class WinNativeKeyEventData final
{
public:
UINT mMessage;
WPARAM mWParam;
LPARAM mLParam;
Modifiers mModifiers;
private:
uintptr_t mKeyboardLayout;
public:
WinNativeKeyEventData(UINT aMessage,
WPARAM aWParam,
LPARAM aLParam,
const ModifierKeyState& aModifierKeyState)
: mMessage(aMessage)
, mWParam(aWParam)
, mLParam(aLParam)
, mModifiers(aModifierKeyState.GetModifiers())
, mKeyboardLayout(reinterpret_cast<uintptr_t>(::GetKeyboardLayout(0)))
{
}
HKL GetKeyboardLayout() const
{
return reinterpret_cast<HKL>(mKeyboardLayout);
}
};
} // namespace widget
} // namespace mozilla
#endif // #ifndef mozilla_widget_WinNativeEventData_h_