diff options
Diffstat (limited to 'click.go')
| -rw-r--r-- | click.go | 22 |
1 files changed, 18 insertions, 4 deletions
@@ -112,10 +112,10 @@ func (w *guiWidget) doWidgetClick() { func click(g *gocui.Gui, v *gocui.View) error { mouseW, mouseH := me.baseGui.MousePosition() - log.Log(GOCUI, "click() START gocui name:", v.Name()) + log.Log(GOCUI, "click() START gocui name:", v.Name(), mouseW, mouseH) w := findUnderMouse() - // if the dropdown view is visable, process it no matter what + // if the dropdown view is visible, process it no matter what if me.dropdownV.Visible() { me.dropdownV.dropdownClicked(mouseW, mouseH) } @@ -183,8 +183,8 @@ func findUnderMouse() *guiWidget { rootW := me.treeRoot.TK.(*guiWidget) f(rootW) + // search through all the widgets that were below the mouse click var found *guiWidget - // widgets has everything that matches for _, w := range widgets { // prioritize window buttons. This means if some code covers // up the window widgets, then it will ignore everything else @@ -193,9 +193,23 @@ func findUnderMouse() *guiWidget { if w.WidgetType == widget.Window { return w } - // w.showWidgetPlacement("findUnderMouse() FOUND") + } + + // return anything else that is interactive + for _, w := range widgets { + if w.WidgetType == widget.Button { + return w + } + if w.WidgetType == widget.Combobox { + return w + } + if w.WidgetType == widget.Checkbox { + return w + } + w.showWidgetPlacement("findUnderMouse() found something unknown") found = w } + // maybe something else was found return found } |
