summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-03-29 13:09:27 -0400
committerPietro Gagliardi <[email protected]>2014-03-29 13:09:27 -0400
commit5190c7c7637eada7e4a1aeaa6be4db3989524396 (patch)
tree5b927677da5354f434a6b6f77fd9e88a0f47d267
parent75acdfd9adb1f62411c17e32949dbd24aa98833f (diff)
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...
-rw-r--r--area_unix.go11
-rw-r--r--events_notdarwin.go6
2 files changed, 12 insertions, 5 deletions
diff --git a/area_unix.go b/area_unix.go
index 9e1370d..08dd48d 100644
--- a/area_unix.go
+++ b/area_unix.go
@@ -281,8 +281,12 @@ 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
+ // numpad numeric keys and . are handled in events_notdarwin.go
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
@@ -292,7 +296,10 @@ func init() {
included[v] = true
}
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
}
if !included[i] {
diff --git a/events_notdarwin.go b/events_notdarwin.go
index 56a8951..dc407e0 100644
--- a/events_notdarwin.go
+++ b/events_notdarwin.go
@@ -73,8 +73,8 @@ var scancodeKeys = map[uintptr]byte{
0x39: ' ',
}
-type scancodeExtKeys = map[uintptr]ExtKey{
-/* 0x47: N7,
+var scancodeExtKeys = map[uintptr]ExtKey{
+ 0x47: N7,
0x48: N8,
0x49: N9,
0x4B: N4,
@@ -85,7 +85,7 @@ type scancodeExtKeys = map[uintptr]ExtKey{
0x51: N3,
0x52: N0,
0x53: NDot,
-*/}
+}
func fromScancode(scancode uintptr) (ke KeyEvent, ok bool) {
if key, ok := scancodeKeys[scancode]; ok {