summaryrefslogtreecommitdiff
path: root/click.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-01-29 07:31:26 -0600
committerJeff Carr <[email protected]>2025-01-29 12:27:10 -0600
commitce11f999f9282e9489e77eb1f9d6c08ae9c9b725 (patch)
tree33ae6c702d91c5eddfe4ecd0be68bf907733a394 /click.go
parenta16b53c2895669f7f21728334371ab79680699bf (diff)
start moving to protobuf. fix mouse clicks (kinda)
Diffstat (limited to 'click.go')
-rw-r--r--click.go22
1 files changed, 18 insertions, 4 deletions
diff --git a/click.go b/click.go
index 33e753c..919ed87 100644
--- a/click.go
+++ b/click.go
@@ -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
}