Canop / miaou

A chat server with OAuth2 authentication, persistent and searchable history, video and audio, markdown formatting, private and public rooms, stars, votes, embedded games, and many other features
http://miaou.dystroy.org/
Other
542 stars 73 forks source link

Solve AltGr confclicting Key on Windows #91

Closed Ckln closed 6 years ago

Ckln commented 6 years ago

This PR make sure for any Ctrl + event that Miaou process that the "AltGr(aph)" key is not pressed. This is because on windows when the AltGr key is pressed Windows is also sending a Ctrl event. Thus we end up with some keyboard event which have altKey and ctrlKey set to true, while in fact only the AltGr key is pressed. In some keyboard configuration it will conflict with Miaou shortcuts. Examples of conflict on a bépo keymap:

Solution used: simply make sure that the keypress event has not Ctrl AND Alt has modifiers. This solution was chosen for multiples reason:

  1. When pressing on AltGr on Windows, it will always result in sending a Ctrl and an Alt Keypress event. however we could determine if AltGr was pressed by looking at the «location» of the Keypress
  2. However when we are interested in a combination of key pressed we lose the location information.
  3. It was quite simple and do not change a lot how Miaou work