summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eventBindings.go1
-rw-r--r--eventMouseMove.go1
-rw-r--r--find.go6
-rw-r--r--init.go6
-rw-r--r--plugin.go6
-rw-r--r--stdoutShow.go2
-rw-r--r--structs.go4
-rw-r--r--treeAdd.go17
8 files changed, 37 insertions, 6 deletions
diff --git a/eventBindings.go b/eventBindings.go
index b309142..e17d9b6 100644
--- a/eventBindings.go
+++ b/eventBindings.go
@@ -77,6 +77,7 @@ func theNotsure(g *gocui.Gui, v *gocui.View) error {
me.dark = true
}
log.Info("got keypress 2. now what? dark =", me.dark)
+ // findBG()
return nil
}
diff --git a/eventMouseMove.go b/eventMouseMove.go
index b73c013..eb6c2ee 100644
--- a/eventMouseMove.go
+++ b/eventMouseMove.go
@@ -23,6 +23,7 @@ import (
// this is run every time the user moves the mouse over the terminal window
func mouseMove(g *gocui.Gui) {
w, h := g.MousePosition()
+ me.ok = true // this tells init() it's okay to work with gocui
if me.supermouse {
for _, tk := range findByXY(w, h) {
diff --git a/find.go b/find.go
index 0cdfbfb..795f7ee 100644
--- a/find.go
+++ b/find.go
@@ -99,8 +99,10 @@ func (tk *guiWidget) findWindows() []*guiWidget {
// gocui seems to not return mouse events unless there is something there
func (tk *guiWidget) findBG() *guiWidget {
if tk.node.WidgetType == widget.Stdout {
- tk.isBG = true
- return tk
+ if tk.node.WidgetId != me.stdout.wId {
+ tk.isBG = true
+ return tk
+ }
}
for _, child := range tk.children {
diff --git a/init.go b/init.go
index 000e6f0..713ad84 100644
--- a/init.go
+++ b/init.go
@@ -47,6 +47,7 @@ func init() {
// just make up unique values for these
me.dropdown.wId = -77
me.textbox.wId = -55
+ me.stdout.wId = -4
// Set(&me, "dense")
@@ -66,9 +67,9 @@ func init() {
go newWindowTrigger()
log.Log(NOW, "Init() start pluginChan")
- log.Sleep(.1) // probably not needed, but in here for now under development
+ // log.Sleep(.1) // probably not needed, but in here for now under development
go mainGogui()
- log.Sleep(.1) // probably not needed, but in here for now under development
+ // log.Sleep(.1) // probably not needed, but in here for now under development
}
func standardExit() {
@@ -207,6 +208,7 @@ func newWindowTrigger() {
case tk := <-me.newWindowTrigger:
// log.Log(NOW, "newWindowTrigger() got new window", tk.cuiName)
time.Sleep(200 * time.Millisecond)
+ waitOK()
redoWindows(1, -1)
if !me.stdout.init {
me.stdout.init = true
diff --git a/plugin.go b/plugin.go
index 90c84fe..e7782cc 100644
--- a/plugin.go
+++ b/plugin.go
@@ -80,6 +80,12 @@ func newAddText(n *tree.Node, s string) {
func newaction(n *tree.Node, atype widget.ActionType) {
log.Log(INFO, "newaction() START", atype)
+ if !me.ok {
+ log.Log(INFO, "newaction() START NOT OKAY", atype)
+ log.Log(INFO, "newaction() START NOT OKAY", atype)
+ log.Log(INFO, "newaction() START NOT OKAY", atype)
+ waitOK()
+ }
if n == nil {
log.Warn("Tree Error: Add() sent n == nil")
return
diff --git a/stdoutShow.go b/stdoutShow.go
index 41c7bcf..b8767ac 100644
--- a/stdoutShow.go
+++ b/stdoutShow.go
@@ -45,7 +45,7 @@ func makeOutputWidget(g *gocui.Gui, stringFromMouseClick string) *gocui.View {
a := new(widget.Action)
a.ProgName = "2stdout2"
a.WidgetType = widget.Stdout
- a.WidgetId = -3
+ a.WidgetId = me.stdout.wId
a.ParentId = 0
// n := addNode(a)
n := me.myTree.AddNode(a)
diff --git a/structs.go b/structs.go
index b32c059..3e10910 100644
--- a/structs.go
+++ b/structs.go
@@ -31,8 +31,9 @@ type config struct {
baseGui *gocui.Gui // the main gocui handle
treeRoot *tree.Node // the base of the binary tree. it should have id == 0
myTree *tree.TreeInfo // ?
- ctrlDown *tree.Node // shown if you click the mouse when the ctrl key is pressed
currentWindow *guiWidget // this is the current tab or window to show
+ ok bool // if the user doesn't hit a key or move the mouse, gocui doesn't really start
+ ctrlDown *tree.Node // shown if you click the mouse when the ctrl key is pressed
helpLabel *gocui.View // ?
showHelp bool // toggle boolean for the help menu (deprecate?)
FramePadW int `default:"1" dense:"0"` // When the widget has a frame, like a button, it adds 2 lines runes on each side
@@ -77,6 +78,7 @@ type config struct {
// settings for the stdout window
type stdout struct {
tk *guiWidget // where to show STDOUT
+ wId int // the widget id
w int // the width
h int // the height
outputOnTop bool // is the STDOUT window on top?
diff --git a/treeAdd.go b/treeAdd.go
index be80499..9b975ad 100644
--- a/treeAdd.go
+++ b/treeAdd.go
@@ -4,6 +4,8 @@
package main
import (
+ "time"
+
log "go.wit.com/log"
"go.wit.com/toolkits/tree"
"go.wit.com/widget"
@@ -28,9 +30,24 @@ func setFake(n *tree.Node) {
}
}
+func waitOK() {
+ for {
+ if me.ok {
+ return
+ }
+ time.Sleep(10 * time.Millisecond)
+ }
+}
+
// set the widget start width & height
// func (n *node) addWidget(n *tree.Node) {
func addWidget(n *tree.Node) {
+ if !me.ok {
+ log.Log(INFO, "addWidget() START NOT OKAY")
+ log.Log(INFO, "addWidget() START NOT OKAY")
+ log.Log(INFO, "addWidget() START NOT OKAY")
+ waitOK()
+ }
var tk *guiWidget
tk = n.TK.(*guiWidget)
log.Log(INFO, "setStartWH() w.id =", n.WidgetId, "n.name", n.String())