diff options
| author | Pietro Gagliardi <[email protected]> | 2014-05-29 12:17:02 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-05-29 12:17:02 -0400 |
| commit | 055cd36b20d9ab9d002e867bf31f0a64782c3789 (patch) | |
| tree | f828b0ca564975b841ff950eefe48e9ef8282fc7 /area_windows.go | |
| parent | 20a7e4fb62a39d4e9d251dd7b6bc283fe2c061f8 (diff) | |
Added the new Modifiers handling to the Windows backend.
Diffstat (limited to 'area_windows.go')
| -rw-r--r-- | area_windows.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/area_windows.go b/area_windows.go index 5664ffa..6269002 100644 --- a/area_windows.go +++ b/area_windows.go @@ -513,6 +513,10 @@ func areaKeyEvent(s *sysData, up bool, wparam _WPARAM, lparam _LPARAM) bool { ke.ExtKey = NEnter } else if extkey, ok := extkeys[wparam]; ok { ke.ExtKey = extkey + } else if mod, ok := modonlykeys[wparam]; ok { + ke.Modifier = mod + // don't include the modifier in ke.Modifiers + ke.Modifiers &^= mod } else if xke, ok := fromScancode(uintptr(scancode)); ok { // one of these will be nonzero ke.Key = xke.Key @@ -580,6 +584,22 @@ func init() { } } +var modonlykeys = map[_WPARAM]Modifiers{ + // TODO except for Super, are the separate left/right necessary? + _VK_CONTROL: Ctrl, + _VK_LCONTROL: Ctrl, + _VK_RCONTROL: Ctrl, + _VK_MENU: Alt, + _VK_LMENU: Alt, + _VK_RMENU: Alt, + _VK_SHIFT: Shift, + _VK_LSHIFT: Shift, + _VK_RSHIFT: Shift, + // there's no combined Windows key virtual-key code as there is with the others + _VK_LWIN: Super, + _VK_RWIN: Super, +} + var ( _setFocus = user32.NewProc("SetFocus") ) |
