diff options
Diffstat (limited to 'eventMouseMove.go')
| -rw-r--r-- | eventMouseMove.go | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/eventMouseMove.go b/eventMouseMove.go index b6c43ae..e928265 100644 --- a/eventMouseMove.go +++ b/eventMouseMove.go @@ -38,6 +38,11 @@ func mouseMove(g *gocui.Gui) { return } + if me.dropdown.active || me.textbox.active { + // can't drag or do anything when dropdown or textbox are visible + return + } + w, h := g.MousePosition() // toggle off all highlight vies except for whatever is under the mouse for _, view := range g.Views() { @@ -56,30 +61,30 @@ func mouseMove(g *gocui.Gui) { return } - if me.globalMouseDown && (me.dropdown.active || me.textbox.active) { + if me.mouse.globalMouseDown && (me.dropdown.active || me.textbox.active) { log.Info("can't drag while dropdown or textbox are active", w, h) return } - if me.globalMouseDown { + if me.mouse.globalMouseDown { // log.Info("msgMouseDown == true") // plugin will segfault if you don't keep this inside a check for msgMouseDown // don't move this code out of here var found bool = false - if me.currentDrag != nil { - // me.currentDrag.dumpWidget(fmt.Sprintf("MM (%3d,%3d)", w, h)) - me.currentDrag.moveNew() + if me.mouse.currentDrag != nil { + // me.mouse.currentDrag.dumpWidget(fmt.Sprintf("MM (%3d,%3d)", w, h)) + me.mouse.currentDrag.moveNew() return } // new function that is smarter if tk := findWindowUnderMouse(); tk != nil { - me.currentDrag = tk + me.mouse.currentDrag = tk return } // first look for windows for _, tk := range findByXY(w, h) { if tk.node.WidgetType == widget.Window { - me.currentDrag = tk + me.mouse.currentDrag = tk return } } @@ -87,20 +92,20 @@ func mouseMove(g *gocui.Gui) { // now look for the STDOUT window for _, tk := range findByXY(w, h) { if tk.node.WidgetType == widget.Flag { - me.currentDrag = tk + me.mouse.currentDrag = tk // tk.moveNew() return } } for _, tk := range findByXY(w, h) { if tk.node.WidgetType == widget.Stdout { - me.currentDrag = tk + me.mouse.currentDrag = tk // tk.moveNew() return } /* if tk.node.WidgetType == widget.Label { - me.currentDrag = tk + me.mouse.currentDrag = tk // tk.moveNew() return } @@ -130,7 +135,7 @@ func (tk *guiWidget) moveNew() { return } if tk.node.WidgetType == widget.Stdout { - if me.stdout.resize { + if me.mouse.resize { newW := w - me.stdout.lastW newH := h - me.stdout.lastH me.stdout.w = newW |
