windows kinda move around

This commit is contained in:
Jeff Carr 2025-02-03 18:50:17 -06:00
parent acb0e43945
commit d2c681f573
2 changed files with 21 additions and 9 deletions

View File

@ -52,11 +52,6 @@ func mouseDown(g *gocui.Gui, v *gocui.View) error {
var found bool = false
for _, tk := range findByXY(mx, my) {
tk.dumpWidget("mouseDown()")
if tk.node.WidgetType == widget.Window {
log.Info("SENDING CLICK TO WINDOW")
tk.doWidgetClick(mx, my)
return nil
}
if tk.node.WidgetType == widget.Button {
log.Info("SENDING CLICK TO Button")
tk.doWidgetClick(mx, my)
@ -67,6 +62,14 @@ func mouseDown(g *gocui.Gui, v *gocui.View) error {
tk.doWidgetClick(mx, my)
return nil
}
found = true
}
for _, tk := range findByXY(mx, my) {
if tk.node.WidgetType == widget.Window {
log.Info("SENDING CLICK TO WINDOW")
tk.doWidgetClick(mx, my)
return nil
}
if tk.node.WidgetType == widget.Label {
log.Info("IGNORE LABLE")
found = false

View File

@ -27,10 +27,6 @@ func (tk *guiWidget) doWidgetClick(w int, h int) {
me.currentWindow.isCurrent = true
tk.active = false
full := tk.getFullSize()
tk.gocuiSize.w1 = full.w1
tk.gocuiSize.h1 = full.h1
// draw the current window
w := tk.gocuiSize.w0 + 4
h := tk.gocuiSize.h0 + 4
@ -38,6 +34,11 @@ func (tk *guiWidget) doWidgetClick(w int, h int) {
tk.setColor(&colorActiveW)
tk.showWidgets()
tk.placeWidgets(w, h) // compute the sizes & places for each widget
full := tk.getFullSize()
tk.gocuiSize.w1 = full.w1
tk.gocuiSize.h1 = full.h1
me.baseGui.SetView(tk.cuiName, tk.gocuiSize.w0, tk.gocuiSize.h0, tk.gocuiSize.w1, tk.gocuiSize.h1, 0)
case widget.Group:
if tk.active {
tk.active = false
@ -116,6 +117,14 @@ func click(g *gocui.Gui, v *gocui.View) error {
}
}
// Button widgets
for _, tk := range findByXY(w, h) {
if tk.node.WidgetType == widget.Button {
tk.doWidgetClick(w, h)
return nil
}
}
for _, tk := range findByXY(w, h) {
// will show you everything found on a mouse click. great for debugging!
// tk.dumpWidget("click()")