Commit 5307906d authored by Wez's avatar Wez Committed by Commit Bot

[Windows] Make KeyEvent is-repeat flag consistent with other platforms.

In https://chromium-review.googlesource.com/c/chromium/src/+/754130 we
switched to populating the is-repeat flag of ui::KeyEvent solely based
on the flags in the underlying native event, if present.

In the case of a key event triggering a pop-up window to appear, this
caused the first auto-repeat of that event to be dispatched without the
repeat flag set.

To address this we restore the "fallback" path to manually determine
whether an event should be flagged as a repeat, in the case of where a
native event does not itself have the repeat flag set.

Bug: 895266
Change-Id: Ia224e38768d67bf0dc74d60d7e5ed7b6b6663d80
Reviewed-on: https://chromium-review.googlesource.com/c/1281874Reviewed-by: default avatarDave Tapuska <dtapuska@chromium.org>
Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Commit-Queue: Wez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600116}
parent 8b9172a6
...@@ -1083,10 +1083,9 @@ bool KeyEvent::IsRepeated(const KeyEvent& event) { ...@@ -1083,10 +1083,9 @@ bool KeyEvent::IsRepeated(const KeyEvent& event) {
// Bit 30 of lParam represents the "previous key state". If set, the key // Bit 30 of lParam represents the "previous key state". If set, the key
// was already down, therefore this is an auto-repeat. // was already down, therefore this is an auto-repeat.
is_repeat = (event.native_event().lParam & 0x40000000) != 0; is_repeat = (event.native_event().lParam & 0x40000000) != 0;
} else }
#endif #endif
{ if (!is_repeat) {
// Note that this is only reach for non-native events under Windows.
if (event.key_code() == (*last_key_event)->key_code() && if (event.key_code() == (*last_key_event)->key_code() &&
event.flags() == ((*last_key_event)->flags() & ~ui::EF_IS_REPEAT) && event.flags() == ((*last_key_event)->flags() & ~ui::EF_IS_REPEAT) &&
(event.time_stamp() - (*last_key_event)->time_stamp()) (event.time_stamp() - (*last_key_event)->time_stamp())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment