Is Mod5Mask always AltGr (on my system it is)?
The existing code calculates m_altgrMask.