зеркало из https://github.com/mozilla/gecko-dev.git
Bug 855975 part.18 Merge widget::NativeKey::DispatchKeyDown() into widget::NativeKey::HandleKeyDown() r=jimm
This commit is contained in:
Родитель
22ab5a3d5b
Коммит
c9d8a4d90f
|
@ -764,29 +764,6 @@ NativeKey::DispatchKeyEvent(nsKeyEvent& aKeyEvent,
|
|||
return mWidget->DispatchWindowEvent(&aKeyEvent);
|
||||
}
|
||||
|
||||
bool
|
||||
NativeKey::DispatchKeyDownEvent(bool* aEventDispatched) const
|
||||
{
|
||||
MOZ_ASSERT(mMsg.message == WM_KEYDOWN || mMsg.message == WM_SYSKEYDOWN);
|
||||
|
||||
if (aEventDispatched) {
|
||||
*aEventDispatched = false;
|
||||
}
|
||||
|
||||
// Ignore [shift+]alt+space so the OS can handle it.
|
||||
if (mModKeyState.IsAlt() && !mModKeyState.IsControl() &&
|
||||
mVirtualKeyCode == VK_SPACE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsKeyEvent keydownEvent(true, NS_KEY_DOWN, mWidget);
|
||||
InitKeyEvent(keydownEvent, mModKeyState);
|
||||
if (aEventDispatched) {
|
||||
*aEventDispatched = true;
|
||||
}
|
||||
return DispatchKeyEvent(keydownEvent, &mMsg);
|
||||
}
|
||||
|
||||
bool
|
||||
NativeKey::HandleKeyDownMessage(bool* aEventDispatched) const
|
||||
{
|
||||
|
@ -799,19 +776,20 @@ NativeKey::HandleKeyDownMessage(bool* aEventDispatched) const
|
|||
bool defaultPrevented = false;
|
||||
if (mIsFakeCharMsg ||
|
||||
!RedirectedKeyDownMessageManager::IsRedirectedMessage(mMsg)) {
|
||||
bool isIMEEnabled = WinUtils::IsIMEEnabled(mWidget->GetInputContext());
|
||||
bool eventDispatched;
|
||||
defaultPrevented = DispatchKeyDownEvent(&eventDispatched);
|
||||
if (aEventDispatched) {
|
||||
*aEventDispatched = eventDispatched;
|
||||
}
|
||||
if (!eventDispatched) {
|
||||
// If keydown event was not dispatched, keypress event shouldn't be
|
||||
// caused with the message.
|
||||
RedirectedKeyDownMessageManager::Forget();
|
||||
// Ignore [shift+]alt+space so the OS can handle it.
|
||||
if (mModKeyState.IsAlt() && !mModKeyState.IsControl() &&
|
||||
mVirtualKeyCode == VK_SPACE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isIMEEnabled = WinUtils::IsIMEEnabled(mWidget->GetInputContext());
|
||||
nsKeyEvent keydownEvent(true, NS_KEY_DOWN, mWidget);
|
||||
InitKeyEvent(keydownEvent, mModKeyState);
|
||||
if (aEventDispatched) {
|
||||
*aEventDispatched = true;
|
||||
}
|
||||
defaultPrevented = DispatchKeyEvent(keydownEvent, &mMsg);
|
||||
|
||||
// If IMC wasn't associated to the window but is associated it now (i.e.,
|
||||
// focus is moved from a non-editable editor to an editor by keydown
|
||||
// event handler), WM_CHAR and WM_SYSCHAR shouldn't cause first character
|
||||
|
|
|
@ -385,12 +385,6 @@ public:
|
|||
*/
|
||||
bool HandleKeyDownMessage(bool* aEventDispatched = nullptr) const;
|
||||
|
||||
/**
|
||||
* Dspatces keydown event. Retrns true if the event is consumed.
|
||||
* Otherwise, false.
|
||||
*/
|
||||
bool DispatchKeyDownEvent(bool* aEventDispatched = nullptr) const;
|
||||
|
||||
/**
|
||||
* Handles WM_CHAR message or WM_SYSCHAR message. The instance must be
|
||||
* initialized with WM_KEYDOWN, WM_SYSKEYDOWN or them.
|
||||
|
|
Загрузка…
Ссылка в новой задаче