Skip to content

Commit

Permalink
Don't set modifiers for AltGr on Windows
Browse files Browse the repository at this point in the history
AltGr is the same as ctrl+alt, and we don't want those to be set when you press
a key using AltGr.
  • Loading branch information
stk authored and gdamore committed Jan 3, 2024
1 parent 337e381 commit 96e2990
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions console_win.go
Original file line number Diff line number Diff line change
Expand Up @@ -599,12 +599,17 @@ func geti16(v []byte) int16 {
func mod2mask(cks uint32) ModMask {
mm := ModNone
// Left or right control
if (cks & (0x0008 | 0x0004)) != 0 {
mm |= ModCtrl
}
ctrl := (cks & (0x0008 | 0x0004)) != 0
// Left or right alt
if (cks & (0x0002 | 0x0001)) != 0 {
mm |= ModAlt
alt := (cks & (0x0002 | 0x0001)) != 0
// Filter out ctrl+alt (it means AltGr)
if !(ctrl && alt) {
if ctrl {
mm |= ModCtrl
}
if alt {
mm |= ModAlt
}
}
// Any shift
if (cks & 0x0010) != 0 {
Expand Down

0 comments on commit 96e2990

Please sign in to comment.