diff options
| author | Pietro Gagliardi <[email protected]> | 2014-06-07 12:29:38 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-06-07 12:29:38 -0400 |
| commit | 7a22f0e073f11f365a71dd716307dfc342a33647 (patch) | |
| tree | b702e0443569d660d43ff45bd6c16fbdf1c2254f /area_windows.go | |
| parent | c34f2c234c4ae74b3b6e5ba195d10d9c4564ea48 (diff) | |
Fixed a regression in the Windows Area code: when I fixed numpad behavior, I broke NEnter. Fixed. Also more TODOs.
Diffstat (limited to 'area_windows.go')
| -rw-r--r-- | area_windows.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/area_windows.go b/area_windows.go index 273b25e..5f41790 100644 --- a/area_windows.go +++ b/area_windows.go @@ -497,12 +497,17 @@ func areaMouseEvent(s *sysData, button uint, up bool, wparam _WPARAM, lparam _LP func areaKeyEvent(s *sysData, up bool, wparam _WPARAM, lparam _LPARAM) { var ke KeyEvent + // the numeric keypad keys when Num Lock is off are considered left-hand keys as the separate navigation buttons were added later + // the numeric keypad enter, however, is a right-hand key because it has the same virtual-key code as the typewriter enter + righthand := (lparam & 0x01000000) != 0 + scancode := byte((lparam >> 16) & 0xFF) ke.Modifiers = getModifiers() - if extkey, ok := numpadextkeys[wparam]; (lparam & 0x01000000) == 0 && ok { + if extkey, ok := numpadextkeys[wparam]; ok && !righthand { // the above is special handling for numpad keys to ignore the state of Num Lock and Shift; see http://blogs.msdn.com/b/oldnewthing/archive/2004/09/06/226045.aspx and https://github.com/glfw/glfw/blob/master/src/win32_window.c#L152 - // bit 24 of LPARAM (0x01000000) indicates right-hand keys; in our case "right-hand keys" means the separate buttons, so 0 means numpad ke.ExtKey = extkey + } else if wparam == _VK_RETURN && righthand { + ke.ExtKey = NEnter } else if extkey, ok := extkeys[wparam]; ok { ke.ExtKey = extkey } else if mod, ok := modonlykeys[wparam]; ok { @@ -524,7 +529,7 @@ func areaKeyEvent(s *sysData, up bool, wparam _WPARAM, lparam _LPARAM) { } } -// all mappings except the VK_RETURN one come from GLFW - https://github.com/glfw/glfw/blob/master/src/win32_window.c#L152 +// all mappings come from GLFW - https://github.com/glfw/glfw/blob/master/src/win32_window.c#L152 var numpadextkeys = map[_WPARAM]ExtKey{ _VK_HOME: N7, _VK_UP: N8, @@ -537,7 +542,6 @@ var numpadextkeys = map[_WPARAM]ExtKey{ _VK_NEXT: N3, _VK_INSERT: N0, _VK_DELETE: NDot, - _VK_RETURN: NEnter, } var extkeys = map[_WPARAM]ExtKey{ |
