1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

term.ui: use the new [flag] enums (#8881)

This commit is contained in:
spaceface
2021-02-21 15:07:49 +01:00
committed by GitHub
parent 0470baafa6
commit 260f677469
8 changed files with 92 additions and 81 deletions

View File

@@ -164,10 +164,10 @@ fn (mut ctx Context) parse_events() {
else { KeyCode(ascii) }
}
mut modifiers := u32(0)
if e.dwControlKeyState & (0x1 | 0x2) != 0 { modifiers |= alt }
if e.dwControlKeyState & (0x4 | 0x8) != 0 { modifiers |= ctrl }
if e.dwControlKeyState & 0x10 != 0 { modifiers |= shift }
mut modifiers := Modifiers{}
if e.dwControlKeyState & (0x1 | 0x2) != 0 { modifiers.set(.alt) }
if e.dwControlKeyState & (0x4 | 0x8) != 0 { modifiers.set(.ctrl) }
if e.dwControlKeyState & 0x10 != 0 { modifiers.set(.shift) }
mut event := &Event{
typ: .key_down
@@ -188,10 +188,10 @@ fn (mut ctx Context) parse_events() {
}
x := e.dwMousePosition.X + 1
y := int(e.dwMousePosition.Y) - sb_info.srWindow.Top + 1
mut modifiers := u32(0)
if e.dwControlKeyState & (0x1 | 0x2) != 0 { modifiers |= alt }
if e.dwControlKeyState & (0x4 | 0x8) != 0 { modifiers |= ctrl }
if e.dwControlKeyState & 0x10 != 0 { modifiers |= shift }
mut modifiers := Modifiers{}
if e.dwControlKeyState & (0x1 | 0x2) != 0 { modifiers.set(.alt) }
if e.dwControlKeyState & (0x4 | 0x8) != 0 { modifiers.set(.ctrl) }
if e.dwControlKeyState & 0x10 != 0 { modifiers.set(.shift) }
// TODO: handle capslock/numlock/etc?? events exist for those keys
match int(e.dwEventFlags) {
C.MOUSE_MOVED {