From 7a22f0e073f11f365a71dd716307dfc342a33647 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sat, 7 Jun 2014 12:29:38 -0400 Subject: [PATCH] Fixed a regression in the Windows Area code: when I fixed numpad behavior, I broke NEnter. Fixed. Also more TODOs. --- area_windows.go | 12 ++++++++---- todo.md | 4 ++-- 2 files changed, 10 insertions(+), 6 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{ diff --git a/todo.md b/todo.md index 313824c..d7f2bb3 100644 --- a/todo.md +++ b/todo.md @@ -17,6 +17,7 @@ WINDOWS: - set progress to 100, indeterminate, inc - frozen indetemrinate animation - need to see if this is a wine bug or not - check all uses of RECT.right/.bottom in Windows that don't have an accompanying -RECT.left/.top to make sure they're correct +- when adding IsDialogMessage() find out if that make sthe area in the area bounds test automatically focused UNIX: - double-check to make sure MouseEvent.Held[] is sorted on Unix after we figure out how to detect buttons above button 5 @@ -26,12 +27,11 @@ UNIX: - resizing seems to be completely and totally broken in the Wayland backend - TODO find out if this is a problem on the GTK+/Wayland side (no initial window-configure event?) - [12:55] pietro10: I meant to mention: 1073): Gtk-WARNING **: Theme parsing error: gtk.css:72:20: Not using units is deprecated. Assuming 'px'. twice. +- figure out why Page Up/Page Down does tab stops ALL PLATFORMS: - make sure MouseEvent's documentation has dragging described correctly (both Windows and GTK+ do) - make sure the preferred size of a Listbox is the minimum size needed to display everything on all platforms (capped at the screen height, of course?) - make sure the image drawn on an Area looks correct on all platforms (is not cropped incorrectly or blurred) -- make sure keyboard events on numpad off on all platforms don't switch between controls - - TODO remember what this means - make all widths and heights parameters in constructors in the same place (or drop the ones in Window entirely?) - Message boxes that belong to agiven parent are still application-modal on all platforms except Mac OS X because the whole system waits... we'll need to use a channel for this, I guess :S