Finished re-adding the numeric keypad keys and fixing up the GTK+ Area implementation to handle the new KeyEvent. Everything seems to work on this end...

This commit is contained in:
Pietro Gagliardi 2014-03-29 13:09:27 -04:00
parent 75acdfd9ad
commit 5190c7c763
2 changed files with 12 additions and 5 deletions

View File

@ -281,8 +281,12 @@ var extkeys = map[C.guint]ExtKey{
C.GDK_KEY_F10: F10, C.GDK_KEY_F10: F10,
C.GDK_KEY_F11: F11, C.GDK_KEY_F11: F11,
C.GDK_KEY_F12: F12, C.GDK_KEY_F12: F12,
// numpad numeric keys are handled in events_notdarwin.go // numpad numeric keys and . are handled in events_notdarwin.go
C.GDK_KEY_KP_Enter: NEnter, C.GDK_KEY_KP_Enter: NEnter,
C.GDK_KEY_KP_Add: NAdd,
C.GDK_KEY_KP_Subtract: NSubtract,
C.GDK_KEY_KP_Multiply: NMultiply,
C.GDK_KEY_KP_Divide: NDivide,
} }
// sanity check // sanity check
@ -292,7 +296,10 @@ func init() {
included[v] = true included[v] = true
} }
for i := 1; i < int(_nextkeys); i++ { for i := 1; i < int(_nextkeys); i++ {
if i >= int(_N0) && i <= int(_N9) { // skip numpad numbers if i >= int(N0) && i <= int(N9) { // skip numpad numbers and .
continue
}
if i == int(NDot) {
continue continue
} }
if !included[i] { if !included[i] {

View File

@ -73,8 +73,8 @@ var scancodeKeys = map[uintptr]byte{
0x39: ' ', 0x39: ' ',
} }
type scancodeExtKeys = map[uintptr]ExtKey{ var scancodeExtKeys = map[uintptr]ExtKey{
/* 0x47: N7, 0x47: N7,
0x48: N8, 0x48: N8,
0x49: N9, 0x49: N9,
0x4B: N4, 0x4B: N4,
@ -85,7 +85,7 @@ type scancodeExtKeys = map[uintptr]ExtKey{
0x51: N3, 0x51: N3,
0x52: N0, 0x52: N0,
0x53: NDot, 0x53: NDot,
*/} }
func fromScancode(scancode uintptr) (ke KeyEvent, ok bool) { func fromScancode(scancode uintptr) (ke KeyEvent, ok bool) {
if key, ok := scancodeKeys[scancode]; ok { if key, ok := scancodeKeys[scancode]; ok {