fix: correct triggeredByAccelerator Event property behavior (#18865)

Fixes #18808

Previously, the triggeredByAccelerator flag would be entirely coupled with whether or not the modifier keys were being used or not.

This PR swaps out the ui::EventFlagsFromModifiers([event modifierFlags])) call in the macOS code to ui::EventFlagsFromNSEventWithModifiers(event, [event modifierFlags])). The latter outputs flags that take into account mouse click events on top of modifier flags (see Chromium documentation).

The business logic to detect triggeredByAccelerator is then changed to exclude any mouse click flags.
This commit is contained in:
Erick Zhao 2019-06-28 14:38:18 -07:00 committed by Shelley Vohr
parent 6eed4a98ce
commit e03a40026a
3 changed files with 81 additions and 23 deletions

View file

@ -345,7 +345,7 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
if (model) {
NSEvent* event = [NSApp currentEvent];
model->ActivatedAt(modelIndex,
ui::EventFlagsFromModifiers([event modifierFlags]));
ui::EventFlagsFromNSEventWithModifiers(event, [event modifierFlags]));
}
}