init was the problem for window placement

This commit is contained in:
Jeff Carr 2025-02-06 22:17:05 -06:00
parent 3d104d5b4a
commit 16886945ed
4 changed files with 9 additions and 5 deletions

View File

@ -141,10 +141,11 @@ func tabCycleWindows(g *gocui.Gui, v *gocui.View) error {
return nil return nil
} }
tk.makeWindowActive() tk.makeWindowActive()
w, h := g.MousePosition() // w, h := g.MousePosition()
me.downW = w // me.downW = tk.gocuiSize.w0
me.downH = h // me.downH = tk.gocuiSize.h0
tk.doWindowClick() tk.redrawWindow(tk.gocuiSize.w0, tk.gocuiSize.h0)
setThingsOnTop() // sets help, Stdout, etc on the top after windows have been redrawn
return nil return nil
} }

View File

@ -42,6 +42,7 @@ func mouseMove(g *gocui.Gui) {
// don't move this code out of here // don't move this code out of here
var found bool = false var found bool = false
if me.currentDrag != nil { if me.currentDrag != nil {
me.currentDrag.dumpWidget(fmt.Sprintf("MM (%3d,%3d)", w, h))
me.currentDrag.moveNew() me.currentDrag.moveNew()
return return
} }

View File

@ -209,7 +209,7 @@ func newWindowTrigger() {
relocateStdoutOffscreen() relocateStdoutOffscreen()
} }
tk.makeWindowActive() tk.makeWindowActive()
tk.doWidgetClick(tk.gocuiSize.w0, tk.gocuiSize.h0) tk.redrawWindow(tk.gocuiSize.w0, tk.gocuiSize.h0)
setThingsOnTop() // sets help, Stdout, etc on the top after windows have been redrawn setThingsOnTop() // sets help, Stdout, etc on the top after windows have been redrawn
log.Log(NOW, "newWindowTrigger() after sleep") log.Log(NOW, "newWindowTrigger() after sleep")
} }

View File

@ -15,6 +15,7 @@ func (tk *guiWidget) redrawWindow(w int, h int) {
if tk.node.WidgetType != widget.Window { if tk.node.WidgetType != widget.Window {
return return
} }
tk.dumpWidget(fmt.Sprintf("redrawWindow(%d,%d)", w, h))
if tk.full.Height() > 40 { if tk.full.Height() > 40 {
tk.window.dense = true tk.window.dense = true
} }
@ -97,6 +98,7 @@ func redoWindows(nextW int, nextH int) {
if tk.window.wasDragged { if tk.window.wasDragged {
// don't move windows around the user has dragged to a certain location // don't move windows around the user has dragged to a certain location
tk.redrawWindow(tk.gocuiSize.w0, tk.gocuiSize.h0) tk.redrawWindow(tk.gocuiSize.w0, tk.gocuiSize.h0)
setThingsOnTop() // sets help, Stdout, etc on the top after windows have been redrawn
} else { } else {
w, _ := me.baseGui.Size() w, _ := me.baseGui.Size()
if nextW > w-20 { if nextW > w-20 {