diff options
Diffstat (limited to 'toolkit/gocui/main.go')
| -rw-r--r-- | toolkit/gocui/main.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/toolkit/gocui/main.go b/toolkit/gocui/main.go index b115786..2365f6f 100644 --- a/toolkit/gocui/main.go +++ b/toolkit/gocui/main.go @@ -33,6 +33,23 @@ func Callback(guiCallback chan toolkit.Action) { me.callback = guiCallback } +func PluginChannel() chan toolkit.Action { + return me.pluginChan +} + +func catchActionChannel() { + log(logNow, "makeCallback() START") + for { + log(logNow, "makeCallback() for loop") + select { + case a := <-me.pluginChan: + log(logNow, "makeCallback() SELECT widget id =", a.WidgetId, a.Name) + Action(&a) + sleep(.1) + } + } +} + func Exit() { // TODO: send exit to the plugin me.baseGui.Close() @@ -50,6 +67,10 @@ func Main(f func()) { setOutput(outf) log("This is a test log entry") + if (me.pluginChan == nil) { + me.pluginChan = make(chan toolkit.Action) + } + go catchActionChannel() MouseMain() me.baseGui.Close() } |
