From 75acdfd9adb1f62411c17e32949dbd24aa98833f Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sat, 29 Mar 2014 13:01:42 -0400 Subject: Re-added the numeric keypad keys to ExtKey and removed predefkeys in area_unix.go since all are now being handled. --- area_unix.go | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'area_unix.go') diff --git a/area_unix.go b/area_unix.go index f20b467..9e1370d 100644 --- a/area_unix.go +++ b/area_unix.go @@ -184,8 +184,6 @@ func doKeyEvent(widget *C.GtkWidget, event *C.GdkEvent, data C.gpointer, up bool keyval := e.keyval if extkey, ok := extkeys[keyval]; ok { ke.ExtKey = extkey -// } else if predef, ok := predefkeys[keyval]; ok { -// ke.ASCII = predef } else if mod, ok := modonlykeys[keyval]; ok { // modifier keys don't seem to be set on their initial keypress; set them here ke.Modifiers |= mod @@ -283,6 +281,8 @@ var extkeys = map[C.guint]ExtKey{ C.GDK_KEY_F10: F10, C.GDK_KEY_F11: F11, C.GDK_KEY_F12: F12, + // numpad numeric keys are handled in events_notdarwin.go + C.GDK_KEY_KP_Enter: NEnter, } // sanity check @@ -292,25 +292,15 @@ func init() { included[v] = true } for i := 1; i < int(_nextkeys); i++ { + if i >= int(_N0) && i <= int(_N9) { // skip numpad numbers + continue + } if !included[i] { panic(fmt.Errorf("error: not all ExtKeys defined on Unix (missing %d)", i)) } } } -var predefkeys = map[C.guint]byte{ - C.GDK_KEY_Return: '\n', - // TODO C.GDK_KEY_Linefeed too? What key is this? - C.GDK_KEY_Tab: '\t', - C.GDK_KEY_BackSpace: '\b', - // tests indicate that this is sent on Shift+Tab - C.GDK_KEY_ISO_Left_Tab: '\t', - // numeric keypad equivalents: - C.GDK_KEY_KP_Enter: '\n', - // all other numeric keypad equivalents are handled by gdk_keymap_to_unicode() as mentioned above - // no space; handled by the code above -} - var modonlykeys = map[C.guint]Modifiers{ C.GDK_KEY_Shift_L: Shift, C.GDK_KEY_Shift_R: Shift, -- cgit v1.2.3