mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-17 14:25:49 +00:00
Bug 1689034 - part 2: Get rid of some native messages for plugins r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D103139
This commit is contained in:
parent
796bb2f86e
commit
06bbff1f71
@ -538,10 +538,6 @@ static const nsCString GetMessageName(UINT aMessage) {
|
||||
return "WM_DEADCHAR"_ns;
|
||||
case WM_SYSDEADCHAR:
|
||||
return "WM_SYSDEADCHAR"_ns;
|
||||
case MOZ_WM_KEYDOWN:
|
||||
return "MOZ_WM_KEYDOWN"_ns;
|
||||
case MOZ_WM_KEYUP:
|
||||
return "MOZ_WM_KEYUP"_ns;
|
||||
case WM_APPCOMMAND:
|
||||
return "WM_APPCOMMAND"_ns;
|
||||
case WM_QUIT:
|
||||
@ -746,8 +742,6 @@ static const nsCString ToString(const MSG& aMSG) {
|
||||
case WM_KEYUP:
|
||||
case WM_SYSKEYDOWN:
|
||||
case WM_SYSKEYUP:
|
||||
case MOZ_WM_KEYDOWN:
|
||||
case MOZ_WM_KEYUP:
|
||||
result.AppendPrintf(
|
||||
"virtual keycode=%s, repeat count=%d, "
|
||||
"scancode=0x%02X, extended key=%s, "
|
||||
@ -1368,7 +1362,6 @@ void NativeKey::InitIsSkippableForKeyOrChar(const MSG& aLastKeyMSG) {
|
||||
switch (mMsg.message) {
|
||||
case WM_KEYDOWN:
|
||||
case WM_SYSKEYDOWN:
|
||||
case MOZ_WM_KEYDOWN:
|
||||
case WM_CHAR:
|
||||
case WM_SYSCHAR:
|
||||
case WM_DEADCHAR:
|
||||
@ -1381,7 +1374,6 @@ void NativeKey::InitIsSkippableForKeyOrChar(const MSG& aLastKeyMSG) {
|
||||
switch (aLastKeyMSG.message) {
|
||||
case WM_KEYDOWN:
|
||||
case WM_SYSKEYDOWN:
|
||||
case MOZ_WM_KEYDOWN:
|
||||
if (aLastKeyMSG.wParam == VK_PACKET) {
|
||||
// If the last message was VK_PACKET, that means that a keyboard
|
||||
// utility tried to insert a character. So, current message is
|
||||
@ -1419,9 +1411,7 @@ void NativeKey::InitWithKeyOrChar() {
|
||||
case WM_KEYDOWN:
|
||||
case WM_SYSKEYDOWN:
|
||||
case WM_KEYUP:
|
||||
case WM_SYSKEYUP:
|
||||
case MOZ_WM_KEYDOWN:
|
||||
case MOZ_WM_KEYUP: {
|
||||
case WM_SYSKEYUP: {
|
||||
// Modify sLastKeyMSG now since retrieving following char messages may
|
||||
// cause sending another key message if odd tool hooks GetMessage(),
|
||||
// PeekMessage().
|
||||
@ -2436,7 +2426,7 @@ bool NativeKey::HandleKeyDownMessage(bool* aEventDispatched) const {
|
||||
}
|
||||
|
||||
bool defaultPrevented = false;
|
||||
if (mFakeCharMsgs || IsKeyMessageOnPlugin() ||
|
||||
if (mFakeCharMsgs ||
|
||||
!RedirectedKeyDownMessageManager::IsRedirectedMessage(mMsg)) {
|
||||
nsresult rv = mDispatcher->BeginNativeInputTransaction();
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
@ -2454,16 +2444,14 @@ bool NativeKey::HandleKeyDownMessage(bool* aEventDispatched) const {
|
||||
"event...",
|
||||
this));
|
||||
|
||||
EventMessage keyDownMessage =
|
||||
IsKeyMessageOnPlugin() ? eKeyDownOnPlugin : eKeyDown;
|
||||
WidgetKeyboardEvent keydownEvent(true, keyDownMessage, mWidget);
|
||||
WidgetKeyboardEvent keydownEvent(true, eKeyDown, mWidget);
|
||||
nsEventStatus status = InitKeyEvent(keydownEvent, mModKeyState);
|
||||
MOZ_LOG(
|
||||
sNativeKeyLogger, LogLevel::Info,
|
||||
("%p NativeKey::HandleKeyDownMessage(), dispatching keydown event...",
|
||||
this));
|
||||
bool dispatched = mDispatcher->DispatchKeyboardEvent(
|
||||
keyDownMessage, keydownEvent, status, const_cast<NativeKey*>(this));
|
||||
eKeyDown, keydownEvent, status, const_cast<NativeKey*>(this));
|
||||
if (aEventDispatched) {
|
||||
*aEventDispatched = dispatched;
|
||||
}
|
||||
@ -2479,18 +2467,6 @@ bool NativeKey::HandleKeyDownMessage(bool* aEventDispatched) const {
|
||||
}
|
||||
defaultPrevented = status == nsEventStatus_eConsumeNoDefault;
|
||||
|
||||
// We don't need to handle key messages on plugin for eKeyPress since
|
||||
// eKeyDownOnPlugin is handled as both eKeyDown and eKeyPress.
|
||||
if (IsKeyMessageOnPlugin()) {
|
||||
MOZ_LOG(
|
||||
sNativeKeyLogger, LogLevel::Info,
|
||||
("%p NativeKey::HandleKeyDownMessage(), doesn't dispatch keypress "
|
||||
"event(s) because it's a keydown message on windowed plugin, "
|
||||
"defaultPrevented=%s",
|
||||
this, GetBoolName(defaultPrevented)));
|
||||
return defaultPrevented;
|
||||
}
|
||||
|
||||
if (mWidget->Destroyed() || IsFocusedWindowChanged()) {
|
||||
MOZ_LOG(sNativeKeyLogger, LogLevel::Info,
|
||||
("%p NativeKey::HandleKeyDownMessage(), keydown event caused "
|
||||
@ -2514,8 +2490,7 @@ bool NativeKey::HandleKeyDownMessage(bool* aEventDispatched) const {
|
||||
// application, we shouldn't redirect the message to it because the keydown
|
||||
// message is processed by us, so, nobody shouldn't process it.
|
||||
HWND focusedWnd = ::GetFocus();
|
||||
if (!defaultPrevented && !mFakeCharMsgs && !IsKeyMessageOnPlugin() &&
|
||||
focusedWnd && !isIMEEnabled &&
|
||||
if (!defaultPrevented && !mFakeCharMsgs && focusedWnd && !isIMEEnabled &&
|
||||
WinUtils::IsIMEEnabled(mWidget->GetInputContext())) {
|
||||
RedirectedKeyDownMessageManager::RemoveNextCharMessage(focusedWnd);
|
||||
|
||||
@ -2819,14 +2794,13 @@ bool NativeKey::HandleKeyUpMessage(bool* aEventDispatched) const {
|
||||
MOZ_LOG(sNativeKeyLogger, LogLevel::Debug,
|
||||
("%p NativeKey::HandleKeyUpMessage(), initializing keyup event...",
|
||||
this));
|
||||
EventMessage keyUpMessage = IsKeyMessageOnPlugin() ? eKeyUpOnPlugin : eKeyUp;
|
||||
WidgetKeyboardEvent keyupEvent(true, keyUpMessage, mWidget);
|
||||
WidgetKeyboardEvent keyupEvent(true, eKeyUp, mWidget);
|
||||
nsEventStatus status = InitKeyEvent(keyupEvent, mModKeyState);
|
||||
MOZ_LOG(sNativeKeyLogger, LogLevel::Info,
|
||||
("%p NativeKey::HandleKeyUpMessage(), dispatching keyup event...",
|
||||
this));
|
||||
bool dispatched = mDispatcher->DispatchKeyboardEvent(
|
||||
keyUpMessage, keyupEvent, status, const_cast<NativeKey*>(this));
|
||||
eKeyUp, keyupEvent, status, const_cast<NativeKey*>(this));
|
||||
if (aEventDispatched) {
|
||||
*aEventDispatched = dispatched;
|
||||
}
|
||||
@ -2848,13 +2822,6 @@ bool NativeKey::HandleKeyUpMessage(bool* aEventDispatched) const {
|
||||
bool NativeKey::NeedsToHandleWithoutFollowingCharMessages() const {
|
||||
MOZ_ASSERT(IsKeyDownMessage());
|
||||
|
||||
// We cannot know following char messages of key messages in a plugin
|
||||
// process. So, let's compute the character to be inputted with every
|
||||
// printable key should be computed with the keyboard layout.
|
||||
if (IsKeyMessageOnPlugin()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If the key combination is reserved by the system, the caller shouldn't
|
||||
// do anything with following WM_*CHAR messages. So, let's return true here.
|
||||
if (IsReservedBySystem()) {
|
||||
@ -2962,7 +2929,6 @@ bool NativeKey::IsSamePhysicalKeyMessage(const MSG& aKeyOrCharMsg1,
|
||||
|
||||
bool NativeKey::GetFollowingCharMessage(MSG& aCharMsg) {
|
||||
MOZ_ASSERT(IsKeyDownMessage());
|
||||
MOZ_ASSERT(!IsKeyMessageOnPlugin());
|
||||
|
||||
aCharMsg.message = WM_NULL;
|
||||
|
||||
|
@ -622,12 +622,10 @@ class MOZ_STACK_CLASS NativeKey final {
|
||||
}
|
||||
|
||||
bool IsKeyDownMessage() const {
|
||||
return (mMsg.message == WM_KEYDOWN || mMsg.message == WM_SYSKEYDOWN ||
|
||||
mMsg.message == MOZ_WM_KEYDOWN);
|
||||
return mMsg.message == WM_KEYDOWN || mMsg.message == WM_SYSKEYDOWN;
|
||||
}
|
||||
bool IsKeyUpMessage() const {
|
||||
return (mMsg.message == WM_KEYUP || mMsg.message == WM_SYSKEYUP ||
|
||||
mMsg.message == MOZ_WM_KEYUP);
|
||||
return mMsg.message == WM_KEYUP || mMsg.message == WM_SYSKEYUP;
|
||||
}
|
||||
bool IsSysKeyDownOrKeyUpMessage() const {
|
||||
return mMsg.message == WM_SYSKEYDOWN || mMsg.message == WM_SYSKEYUP;
|
||||
@ -662,9 +660,6 @@ class MOZ_STACK_CLASS NativeKey final {
|
||||
bool IsFollowedByPrintableCharMessage() const;
|
||||
bool IsFollowedByPrintableCharOrSysCharMessage() const;
|
||||
bool IsFollowedByDeadCharMessage() const;
|
||||
bool IsKeyMessageOnPlugin() const {
|
||||
return (mMsg.message == MOZ_WM_KEYDOWN || mMsg.message == MOZ_WM_KEYUP);
|
||||
}
|
||||
bool IsPrintableCharMessage(const MSG& aMSG) const {
|
||||
return aMSG.message == WM_CHAR &&
|
||||
!IsControlChar(static_cast<char16_t>(aMSG.wParam));
|
||||
|
@ -37,17 +37,6 @@
|
||||
// Internal message used for rolling up popups for dmanip events
|
||||
#define MOZ_WM_DMANIP (WM_APP + 0x0317)
|
||||
|
||||
// Following MOZ_WM_*KEY* messages are used by PluginInstanceChild and
|
||||
// NativeKey internally. (never posted to the queue)
|
||||
#define MOZ_WM_KEYDOWN (WM_APP + 0x0318)
|
||||
#define MOZ_WM_KEYUP (WM_APP + 0x0319)
|
||||
#define MOZ_WM_SYSKEYDOWN (WM_APP + 0x031A)
|
||||
#define MOZ_WM_SYSKEYUP (WM_APP + 0x031B)
|
||||
#define MOZ_WM_CHAR (WM_APP + 0x031C)
|
||||
#define MOZ_WM_SYSCHAR (WM_APP + 0x031D)
|
||||
#define MOZ_WM_DEADCHAR (WM_APP + 0x031E)
|
||||
#define MOZ_WM_SYSDEADCHAR (WM_APP + 0x031F)
|
||||
|
||||
// XXX Should rename them to MOZ_WM_* and use safer values!
|
||||
// Messages for fullscreen transition window
|
||||
#define WM_FULLSCREEN_TRANSITION_BEFORE (WM_USER + 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user