diff options
author | Moonchild <moonchild@palemoon.org> | 2022-10-23 21:45:26 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2022-10-23 21:45:26 +0000 |
commit | 2d752c925976cc983885d8f96b58a45dd5e31133 (patch) | |
tree | b5202eb4add0c638c56fb867ac30b489c027f7b7 /widget/TextEvents.h | |
parent | 528ae6aeb0fd69994ee5aed950492c42bede0aa3 (diff) | |
parent | 7ac438f6ad7abca71e044582d7fca96cf1f84d20 (diff) | |
download | uxp-2d752c925976cc983885d8f96b58a45dd5e31133.tar.gz |
Merge pull request 'Align keypress events in content with the web' (#2020) from keypress-event-work into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2020
Diffstat (limited to 'widget/TextEvents.h')
-rw-r--r-- | widget/TextEvents.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/widget/TextEvents.h b/widget/TextEvents.h index 6c29341144..59aa91b2e0 100644 --- a/widget/TextEvents.h +++ b/widget/TextEvents.h @@ -183,6 +183,30 @@ public: return IsKeyEventOnPlugin(mMessage); } + bool IsInputtingText() const + { + // NOTE: On some keyboard layouts, some characters are put in with Control + // or Alt keys, but at that time, widget unsets the modifier flag + // from the eKeyPress event, so it does not count as a modifier in + // this check. + return mMessage == eKeyPress && + mCharCode && + !(mModifiers & (MODIFIER_ALT | + MODIFIER_CONTROL | + MODIFIER_META | + MODIFIER_OS)); + } + + bool IsInputtingLineBreak() const + { + return mMessage == eKeyPress && + mKeyNameIndex == KEY_NAME_INDEX_Enter && + !(mModifiers & (MODIFIER_ALT | + MODIFIER_CONTROL | + MODIFIER_META | + MODIFIER_OS)); + } + virtual WidgetEvent* Duplicate() const override { MOZ_ASSERT(mClass == eKeyboardEventClass, |