ttk.go
func initKeyHandler() {
	for {
		switch ev := termbox.PollEvent(); ev.Type {
		case termbox.EventKey:
			e := ev
			Queue(func() {
				var (
					widget Widgeter
					window Windower
				)
				if focus != nil {
					var used bool
					used, window, widget = focus.keyHandler(e)
					if used {
						flush()
						return
					}
				}

				// forward to global application handler
				keyC <- Key{
					Mod:    e.Mod,
					Key:    e.Key,
					Ch:     e.Ch,
					Window: window,
					Widget: widget,
				}
				// XXX this is a terrible workaround!!
				// the app is racing this channel
				// we need to somehow block here before doing
				// anything else
				//time.Sleep(25 * time.Millisecond)
			})

		case termbox.EventResize:
			Queue(func() {
				resizeAndRender(focus)
			})
		case termbox.EventMouse:
		case termbox.EventError:
			return
		}
	}
}
func initKeyHandler() {
	for {
		switch ev := termbox.PollEvent(); ev.Type {
		case termbox.EventKey:
			e := ev
			Queue(func() {
				var (
					widget Widgeter
					window Windower
				)
				if focus != nil {
					var used bool
					used, window, widget = focus.keyHandler(e)
					if used {
						flush()
						return
					}
				}

				// forward to global application handler
				keyC <- Key{
					Mod:    e.Mod,
					Key:    e.Key,
					Ch:     e.Ch,
					Window: window,
					Widget: widget,
				}
				// XXX this is a terrible workaround!!
				// the app is racing this channel
				// we need to somehow block here before doing
				// anything else
				//time.Sleep(25 * time.Millisecond)
			})

		case termbox.EventResize:
			Queue(func() {
				resizeAndRender(focus)
			})
		case termbox.EventMouse:
		case termbox.EventError:
			return
		}
	}
}
// initKeyHandler starts the internal key handler.
// Must be called with mutex held and as a go routine.