add some keypress debugging

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-17 13:19:46 -07:00
parent 9a49f56147
commit 904cd2a221
2 changed files with 10 additions and 6 deletions

View File

@ -1,7 +1,7 @@
package main
// import "time"
// import "log"
import "log"
// import "fmt"
// import "runtime"
@ -71,18 +71,20 @@ func (areaHandler) Draw(a *ui.Area, p *ui.AreaDrawParams) {
}
func (areaHandler) MouseEvent(a *ui.Area, me *ui.AreaMouseEvent) {
// do nothing
log.Println("GOT MouseEvent()")
spew.Dump(me)
}
func (areaHandler) MouseCrossed(a *ui.Area, left bool) {
// do nothing
log.Println("GOT MouseCrossed()")
}
func (areaHandler) DragBroken(a *ui.Area) {
// do nothing
log.Println("GOT DragBroken()")
}
func (areaHandler) KeyEvent(a *ui.Area, ke *ui.AreaKeyEvent) (handled bool) {
// reject all keys
log.Println("GOT KeyEvent()")
spew.Dump(ke)
return false
}

View File

@ -3,6 +3,7 @@ package main
import "time"
import "log"
import "fmt"
import "os"
import "github.com/andlabs/ui"
import _ "github.com/andlabs/ui/winmanifest"
@ -46,6 +47,7 @@ func setupUI() {
mainwin := ui.NewWindow("gui-example1", 300, 200, false)
mainwin.OnClosing(func(*ui.Window) bool {
ui.Quit()
os.Exit(0)
return true
})
ui.OnShouldQuit(func() bool {
@ -66,7 +68,7 @@ func setupUI() {
func main() {
ui.Main(showSplash)
ui.Main(setupUI)
go ui.Main(setupUI)
// locks up GTK after a while (50 times)
time.Sleep(1000 * time.Millisecond)