summaryrefslogtreecommitdiff
path: root/test/kbtest.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-05-16 18:16:25 -0400
committerPietro Gagliardi <[email protected]>2014-05-16 18:16:25 -0400
commit13397f91ee57a41f54d13557cbf8097522cb8dc9 (patch)
tree37c935000c20c5e8f5d8e9be5327312f8b6f7518 /test/kbtest.go
parentda2bd70192933f190d9c2b9b140698655b4efcec (diff)
Changed the meaning of the Modifiers keys to be positional, added Super, and pinned down Meta vs. Alt. All but the Meta/Alt one were done after discussion in #go-nuts about how to handle differences in user expectation properly. This is the portable interface only; each platform implementation comes next.
Diffstat (limited to 'test/kbtest.go')
-rw-r--r--test/kbtest.go17
1 files changed, 11 insertions, 6 deletions
diff --git a/test/kbtest.go b/test/kbtest.go
index f206693..120a5fc 100644
--- a/test/kbtest.go
+++ b/test/kbtest.go
@@ -64,9 +64,9 @@ func (a *keyboardArea) Key(e KeyEvent) (handled bool, repaint bool) {
if (m & Shift) != 0 {
markkey(a.kbd, modpoints[Shift], m &^ Shift)
}
-// if (m & Super) != 0 {
-// markkey(a.kbd, modpoints[Super], m &^ Super)
-// }
+ if (m & Super) != 0 {
+ markkey(a.kbd, modpoints[Super], m &^ Super)
+ }
default:
return false, false
}
@@ -86,9 +86,9 @@ func kbTest() {
var (
keywid = 36
keyht = 24
- // 8 rects per key, 4x2 grid
+ // 16 rects per key, 4x4 grid
rectsperrow = 4
- rectspercol = 2
+ rectspercol = 4
keyrectwid = keywid / rectsperrow
keyrectht = keyht / rectspercol
_keyrect = image.Rect(0, 0, keyrectwid, keyrectht)
@@ -103,6 +103,11 @@ func modcolor(m Modifiers) *image.Uniform {
r := (m & 1) * 255; m >>= 1
g := (m & 1) * 255; m >>= 1
b := (m & 1) * 255; m >>= 1
+ if (m & 1) == 1 { // Super
+ r /= 2
+ g /= 2
+ b /= 2
+ }
return image.NewUniform(color.NRGBA{byte(r), byte(g), byte(b), 255})
}
@@ -206,7 +211,7 @@ var modpoints = map[Modifiers]image.Point{
Ctrl: image.Pt(4, 199),
Alt: image.Pt(113, 199),
Shift: image.Pt(4, 159),
-// Super: image.Pt(61, 199),
+ Super: image.Pt(61, 199),
}
// source: http://openclipart.org/image/800px/svg_to_png/154537/1312973798.png (medium image) via http://openclipart.org/detail/154537/us-english-keyboard-layout-v0.1-by-nitiraseem