On Tue, May 23, 2017 at 8:52 AM Ian McKellar <ianl...@google.com> wrote:
> On Tue, May 23, 2017 at 3:03 AM Gerd Hoffmann <kra...@redhat.com> wrote: > >> >> I'm wondering whenever we should just use modifierFlags all the time. >> > > Probably. My initial patch tried to be minimally intrusive but I can try > reworking the NSEventTypeFlagsChanged handling to compare the new > modifierFlags to the last we've seen and synthesize the appropriate key > down/up events. > > After a little more experimentation I think that the approach in this patch is the right one. modifierFlags doesn't[1] indicate which instance of a modifier (ie: left or right) is being held. Except for the NSEventTypeFlagsChanged that's synthesized when a window takes focus the event's keyCode indicates which physical key is affected. That first event after focus has keyCode==0 which we can detect because 0 is the keyCode of the 'A' key which isn't a modifier. Ian [1] actually there are undocumented flags outside the NSEventModifierFlagDeviceIndependentFlagsMask mask that indicate left/right keys but I don't think we should use them.