summaryrefslogtreecommitdiff
path: root/find.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-02-08 17:19:41 -0600
committerJeff Carr <[email protected]>2025-02-08 17:19:41 -0600
commit5a84456c7aa416ed228a809be28137802f35b6e0 (patch)
tree0cf5b698401b2e82f1a2204698624e95362638a3 /find.go
parentf8b7c603a12513c3865bb3166f11133a444b89c7 (diff)
more usability cleanups
Diffstat (limited to 'find.go')
-rw-r--r--find.go65
1 files changed, 3 insertions, 62 deletions
diff --git a/find.go b/find.go
index 189d84b..7ab3a4e 100644
--- a/find.go
+++ b/find.go
@@ -132,6 +132,7 @@ func findNextWindow() *guiWidget {
return me.allwin[0]
}
+// find the window under the mouse and only the window under the mouse
func findWindowUnderMouse() *guiWidget {
w, h := me.baseGui.MousePosition()
@@ -194,68 +195,8 @@ func findWindowUnderMouse() *guiWidget {
return nil
}
-// returns the "highest priority widget under the mouse
-func findUnderMouse() *guiWidget {
- w, h := me.baseGui.MousePosition()
-
- widgets := findByXY(w, h)
-
- // search through all the widgets that were below the mouse click
- var found *guiWidget
- for _, w := range widgets {
- // prioritize window buttons. This means if some code covers
- // up the window widgets, then it will ignore everything else
- // and allow the user (hopefully) to redraw or switch windows
- // TODO: display the window widgets on top
- if w.node.WidgetType == widget.Window {
- return w
- }
- }
-
- // return anything else that is interactive
- for _, w := range widgets {
- if w.node.WidgetType == widget.Button {
- return w
- }
- if w.node.WidgetType == widget.Combobox {
- return w
- }
- if w.node.WidgetType == widget.Checkbox {
- return w
- }
- w.dumpWidget("findUnderMouse() found something unknown")
- found = w
- }
- // maybe something else was found
- return found
-}
-
-// panics. todo: fix ctrl-mouse click?
-// find the widget under the mouse click
+// todo: use this?
func ctrlDown(g *gocui.Gui, v *gocui.View) error {
- var found *guiWidget
- // var widgets []*node
- // var f func (n *node)
- found = findUnderMouse()
- if me.ctrlDown == nil {
- setupCtrlDownWidget()
-
- var tk *guiWidget
- tk = me.ctrlDown.TK.(*guiWidget)
- tk.labelN = found.String()
- tk.cuiName = "ctrlDown"
- // me.ctrlDown.parent = me.rootNode
- }
- var tk *guiWidget
- tk = me.ctrlDown.TK.(*guiWidget)
- if found == nil {
- found = me.treeRoot.TK.(*guiWidget)
- }
- tk.labelN = found.String()
- newR := found.realGocuiSize()
- tk.gocuiSize.w0 = newR.w0
- tk.gocuiSize.h0 = newR.h0
- tk.gocuiSize.w1 = newR.w1
- tk.gocuiSize.h1 = newR.h1
+ log.Info("todo: clicked with ctrlDown")
return nil
}