summaryrefslogtreecommitdiff
path: root/widget/TextEvents.h
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2022-10-23 21:45:26 +0000
committerMoonchild <moonchild@palemoon.org>2022-10-23 21:45:26 +0000
commit2d752c925976cc983885d8f96b58a45dd5e31133 (patch)
treeb5202eb4add0c638c56fb867ac30b489c027f7b7 /widget/TextEvents.h
parent528ae6aeb0fd69994ee5aed950492c42bede0aa3 (diff)
parent7ac438f6ad7abca71e044582d7fca96cf1f84d20 (diff)
downloaduxp-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.h24
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,