Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not filter Ctrl+Alt in non-rune cases #749

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions console_win.go
Original file line number Diff line number Diff line change
Expand Up @@ -666,14 +666,14 @@ func geti16(v []byte) int16 {
}

// Convert windows dwControlKeyState to modifier mask
func mod2mask(cks uint32) ModMask {
func mod2mask(cks uint32, filter_ctrl_alt bool) ModMask {
mm := ModNone
// Left or right control
ctrl := (cks & (0x0008 | 0x0004)) != 0
// Left or right alt
alt := (cks & (0x0002 | 0x0001)) != 0
// Filter out ctrl+alt (it means AltGr)
if !(ctrl && alt) {
if !filter_ctrl_alt || !(ctrl && alt) {
if ctrl {
mm |= ModCtrl
}
Expand Down Expand Up @@ -788,10 +788,10 @@ func (s *cScreen) getConsoleInput() error {
// synthesized key code
for krec.repeat > 0 {
// convert shift+tab to backtab
if mod2mask(krec.mod) == ModShift && krec.ch == vkTab {
if mod2mask(krec.mod, false) == ModShift && krec.ch == vkTab {
s.postEvent(NewEventKey(KeyBacktab, 0, ModNone))
} else {
s.postEvent(NewEventKey(KeyRune, rune(krec.ch), mod2mask(krec.mod)))
s.postEvent(NewEventKey(KeyRune, rune(krec.ch), mod2mask(krec.mod, true)))
}
krec.repeat--
}
Expand All @@ -803,7 +803,7 @@ func (s *cScreen) getConsoleInput() error {
return nil
}
for krec.repeat > 0 {
s.postEvent(NewEventKey(key, rune(krec.ch), mod2mask(krec.mod)))
s.postEvent(NewEventKey(key, rune(krec.ch), mod2mask(krec.mod, false)))
krec.repeat--
}

Expand All @@ -816,7 +816,7 @@ func (s *cScreen) getConsoleInput() error {
mrec.flags = getu32(rec.data[12:])
btns := mrec2btns(mrec.btns, mrec.flags)
// we ignore double click, events are delivered normally
s.postEvent(NewEventMouse(int(mrec.x), int(mrec.y), btns, mod2mask(mrec.mod)))
s.postEvent(NewEventMouse(int(mrec.x), int(mrec.y), btns, mod2mask(mrec.mod, false)))

case resizeEvent:
var rrec resizeRecord
Expand Down