diff options
| author | Jeff Carr <[email protected]> | 2025-02-06 01:42:40 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-02-06 01:42:40 -0600 |
| commit | 31c130045d903b3c874dbf8728589a6a909704ae (patch) | |
| tree | 0abb0bdedd03b7556c08ca86ef1137dc759e4d8a /eventMouseMove.go | |
| parent | 70a742c98acfe8979bb3c040abd6030388e61542 (diff) | |
add a goroutine and channel to trigger window redraw
Diffstat (limited to 'eventMouseMove.go')
| -rw-r--r-- | eventMouseMove.go | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/eventMouseMove.go b/eventMouseMove.go index e7c8b46..629c35f 100644 --- a/eventMouseMove.go +++ b/eventMouseMove.go @@ -42,12 +42,15 @@ func mouseMove(g *gocui.Gui) { currentDrag.moveNew() return } + // first look for windows for _, tk := range findByXY(w, h) { if tk.node.WidgetType == widget.Window { currentDrag = tk return } } + + // now look for the STDOUT window for _, tk := range findByXY(w, h) { if tk.node.WidgetType == widget.Flag { currentDrag = tk @@ -61,11 +64,13 @@ func mouseMove(g *gocui.Gui) { // tk.moveNew() return } - if tk.node.WidgetType == widget.Label { - currentDrag = tk - // tk.moveNew() - return - } + /* + if tk.node.WidgetType == widget.Label { + currentDrag = tk + // tk.moveNew() + return + } + */ found = true } if !found { @@ -92,9 +97,8 @@ func mouseMove(g *gocui.Gui) { func (tk *guiWidget) moveNew() { w, h := me.baseGui.MousePosition() if tk.node.WidgetType == widget.Window { - tk.DrawAt(w, h) tk.redrawWindow(w-tk.dragW, h-tk.dragH) // TODO: fix these hard coded things with offsets - // tk.dumpWidget(fmt.Sprintf("move(%dx%d) %s WIN", w, h, tk.cuiName)) + helpTop() // sets the help window as the top view return } if tk.node.WidgetType == widget.Flag { @@ -108,11 +112,36 @@ func (tk *guiWidget) moveNew() { // tk.dumpWidget("moveNew() MSG" + tk.cuiName) outputW := 180 outputH := 40 - me.baseGui.SetView("msg", w-xOffset, h-yOffset, w-xOffset+outputW, h-yOffset+outputH+me.FramePadH, 0) + w0 := w - xOffset + h0 := h - yOffset + w1 := w - xOffset + outputW + h1 := h - yOffset + outputH + me.FramePadH + me.baseGui.SetView("msg", w0, h0, w1, h1, 0) + me.startOutputW = w - xOffset me.startOutputH = h - yOffset me.baseGui.SetViewOnBottom("msg") + + tk.gocuiSize.w0 = w0 + tk.gocuiSize.w1 = w1 + tk.gocuiSize.h0 = h0 + tk.gocuiSize.h1 = h1 + + tk.full.w0 = w0 + tk.full.w1 = w1 + tk.full.h0 = h0 + tk.full.h1 = h1 + + /* this totally fucks up stdout + me.logStdout.full.w0 = w - xOffset + me.logStdout.full.h0 = h - xOffset + me.logStdout.full.w1 = me.logStdout.full.w0 + 120 + me.logStdout.gocuiSize.Width() + me.logStdout.full.h1 = me.logStdout.full.h0 + 40 + me.logStdout.gocuiSize.Height() + me.logStdout.DrawAt(me.logStdout.full.w0, me.logStdout.full.h0) + */ } + // always place the help menu on top + helpTop() // sets the help window as the top view } func createStdout(g *gocui.Gui) bool { |
