diff --git a/eventBindings.go b/eventBindings.go index 8b377c6..3235867 100644 --- a/eventBindings.go +++ b/eventBindings.go @@ -71,7 +71,7 @@ func (tk *guiWidget) verifyRect() bool { } vw0, vh0, vw1, vh1, err := me.baseGui.ViewPosition(tk.cuiName) if err != nil { - log.Printf("verifyRect() gocui err=%v cuiName=%s v.Name=%s", err, tk.cuiName, tk.v.Name()) + // log.Printf("verifyRect() gocui err=%v cuiName=%s v.Name=%s", err, tk.cuiName, tk.v.Name()) vw0, vh0, vw1, vh1, err = me.baseGui.ViewPosition(tk.v.Name()) if err != nil { log.Printf("verifyRect() ACTUAL FAIL gocui err=%v cuiName=%s v.Name=%s", err, tk.cuiName, tk.v.Name()) diff --git a/eventMouseMove.go b/eventMouseMove.go index f7c5454..991bd62 100644 --- a/eventMouseMove.go +++ b/eventMouseMove.go @@ -42,6 +42,12 @@ func mouseMove(g *gocui.Gui) { currentDrag.moveNew(g) return } + for _, tk := range findByXY(w, h) { + if tk.node.WidgetType == widget.Window { + currentDrag = tk + return + } + } for _, tk := range findByXY(w, h) { if tk.node.WidgetType == widget.Flag { currentDrag = tk @@ -85,6 +91,14 @@ func mouseMove(g *gocui.Gui) { // this is how the window gets dragged around func (tk *guiWidget) moveNew(g *gocui.Gui) { w, h := g.MousePosition() + if tk.node.WidgetType == widget.Window { + w1, h1 := tk.Size() + g.SetView(tk.cuiName, w, h, w+w1, h+h1, 0) + tk.verifyRect() + s := fmt.Sprintf("move(%dx%d) %s ###", w, h, tk.cuiName) + tk.dumpWidget(s) + return + } if tk.node.WidgetType == widget.Flag { // outputW, outputH := tk.Size() // g.SetView(tk.cuiName, w-xOffset, h-yOffset, w-xOffset+outputW+20, h-yOffset+outputH+me.FramePadH+20, 0)