Migrated the keyboard test to the new API.
This commit is contained in:
parent
98e701cd3b
commit
cb10c0fc17
|
@ -73,13 +73,19 @@ func (a *keyboardArea) Key(e KeyEvent) (repaint bool) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type kbhandler struct{}
|
||||||
|
func (kbhandler) Handle(e Event, d interface{}) {
|
||||||
|
if e == Closing {
|
||||||
|
*(d.(*bool)) = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var doKeyboard = flag.Bool("kb", false, "run keyboard test (overrides -areabounds)")
|
var doKeyboard = flag.Bool("kb", false, "run keyboard test (overrides -areabounds)")
|
||||||
func kbTest() {
|
func kbTest() {
|
||||||
wid, ht, ah := mkkbArea()
|
wid, ht, ah := mkkbArea()
|
||||||
a := NewArea(wid, ht, ah)
|
a := NewArea(wid, ht, ah)
|
||||||
w := NewWindow("Hi", wid, ht)
|
w := NewWindow("Hi", wid, ht, kbhandler{})
|
||||||
w.Open(a)
|
w.Open(a)
|
||||||
<-w.Closing
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -213,6 +219,8 @@ var modpoints = map[Modifiers]image.Point{
|
||||||
Super: image.Pt(61, 199),
|
Super: image.Pt(61, 199),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO move the following to its own file
|
||||||
|
|
||||||
// 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
|
// 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
|
||||||
var kbpic = []byte{
|
var kbpic = []byte{
|
||||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
|
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
|
||||||
|
|
Loading…
Reference in New Issue