summaryrefslogtreecommitdiff
path: root/test/kbtest.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-03-27 20:31:23 -0400
committerPietro Gagliardi <[email protected]>2014-03-27 20:31:23 -0400
commitab6e7121e47e7339822aa3e0180285b2a1c38c7c (patch)
treef3be96564689b259d72b12d6f279369d3995c478 /test/kbtest.go
parent9dc4f8694c39304140df92a5466be862ed22f912 (diff)
Added a flag to AreaHandler.Key()/Mouse() to indicate that a repaint is needed after that event has been handled. (Having Repaint() as a method deadlocked for the same reason resizing deadlocked before.)
Diffstat (limited to 'test/kbtest.go')
-rw-r--r--test/kbtest.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/test/kbtest.go b/test/kbtest.go
index 0a21954..d6fa7c1 100644
--- a/test/kbtest.go
+++ b/test/kbtest.go
@@ -34,7 +34,9 @@ func (a *keyboardArea) Paint(cliprect image.Rectangle) *image.NRGBA {
return a.kbd.SubImage(cliprect).(*image.NRGBA)
}
-func (a *keyboardArea) Mouse(MouseEvent) {}
+func (a *keyboardArea) Mouse(MouseEvent) (repaint bool) {
+ return false
+}
func markkey(dest *image.NRGBA, keypt image.Point, m Modifiers) {
xr := keyrect(m).Add(keypt)
@@ -42,7 +44,7 @@ func markkey(dest *image.NRGBA, keypt image.Point, m Modifiers) {
draw.Draw(dest, xr, xi, image.ZP, draw.Over)
}
-func (a *keyboardArea) Key(e KeyEvent) bool {
+func (a *keyboardArea) Key(e KeyEvent) (handled bool, repaint bool) {
a.lock.Lock()
defer a.lock.Unlock()
@@ -68,9 +70,9 @@ func (a *keyboardArea) Key(e KeyEvent) bool {
// markkey(a.kbd, modpoints[Super], m &^ Super)
// }
default:
- return false
+ return false, false
}
- return true
+ return true, true
}
var doKeyboard = flag.Bool("kb", false, "run keyboard test")