From 16886945edc879548719c10ad9a9a79de83cd75e Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 6 Feb 2025 22:17:05 -0600 Subject: [PATCH] init was the problem for window placement --- eventBindings.go | 9 +++++---- eventMouseMove.go | 1 + init.go | 2 +- window.go | 2 ++ 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/eventBindings.go b/eventBindings.go index d51e061..98e0b1a 100644 --- a/eventBindings.go +++ b/eventBindings.go @@ -141,10 +141,11 @@ func tabCycleWindows(g *gocui.Gui, v *gocui.View) error { return nil } tk.makeWindowActive() - w, h := g.MousePosition() - me.downW = w - me.downH = h - tk.doWindowClick() + // w, h := g.MousePosition() + // me.downW = tk.gocuiSize.w0 + // me.downH = tk.gocuiSize.h0 + tk.redrawWindow(tk.gocuiSize.w0, tk.gocuiSize.h0) + setThingsOnTop() // sets help, Stdout, etc on the top after windows have been redrawn return nil } diff --git a/eventMouseMove.go b/eventMouseMove.go index adce6ed..16dee6c 100644 --- a/eventMouseMove.go +++ b/eventMouseMove.go @@ -42,6 +42,7 @@ func mouseMove(g *gocui.Gui) { // don't move this code out of here var found bool = false if me.currentDrag != nil { + me.currentDrag.dumpWidget(fmt.Sprintf("MM (%3d,%3d)", w, h)) me.currentDrag.moveNew() return } diff --git a/init.go b/init.go index 60f3871..8439097 100644 --- a/init.go +++ b/init.go @@ -209,7 +209,7 @@ func newWindowTrigger() { relocateStdoutOffscreen() } 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 log.Log(NOW, "newWindowTrigger() after sleep") } diff --git a/window.go b/window.go index 57950a1..cf3499e 100644 --- a/window.go +++ b/window.go @@ -15,6 +15,7 @@ func (tk *guiWidget) redrawWindow(w int, h int) { if tk.node.WidgetType != widget.Window { return } + tk.dumpWidget(fmt.Sprintf("redrawWindow(%d,%d)", w, h)) if tk.full.Height() > 40 { tk.window.dense = true } @@ -97,6 +98,7 @@ func redoWindows(nextW int, nextH int) { if tk.window.wasDragged { // don't move windows around the user has dragged to a certain location tk.redrawWindow(tk.gocuiSize.w0, tk.gocuiSize.h0) + setThingsOnTop() // sets help, Stdout, etc on the top after windows have been redrawn } else { w, _ := me.baseGui.Size() if nextW > w-20 {