• Leonard Grey's avatar
    Mac: Bail on flagsChanged: if keycode is 0 · 59048c8c
    Leonard Grey authored
    flagsChanged: is under-documented, but in Apple's examples, the actual
    key which causes the change flag is provided in the |keyCode| property
    and |modifierFlags| is used to determine whether it's a keyup or keydown.
    
    When sending command key combinations via AppleScript (and possibly other
    methods), the system feeds us a flags changed event with modifier flags
    set correctly for "Command down" but an unset key code. Since key code 0
    is A, we interpret this as Cmd+A (select all) when no such thing was intended.
    
    The correct event is sent as well (with, for example, key code 55 for left command),
    so we should drop the key code 0 event instead of trying to intepret it.
    
    Hopefully this change also fixes https://crbug.com/885163
    
    Bug: 889618
    Change-Id: Ibc8fe0216b917cc50a23c252209f2ac09a10edf9
    Reviewed-on: https://chromium-review.googlesource.com/c/1259243Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
    Commit-Queue: Leonard Grey <lgrey@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#596319}
    59048c8c
bridged_content_view.mm 57.7 KB