summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-02-01 16:50:01 -0600
committerJeff Carr <[email protected]>2025-02-01 16:50:01 -0600
commit4dad2345323d2a3fce03cf8ce6d78a967856a22f (patch)
tree5962ecd8e1f641923707e5c5269d131ac3dcc032
parent3d5ee3f89b73dd5ba0d78a0b0d816fe96ed9f8a0 (diff)
start working on movingMsg
-rw-r--r--eventMouse.go4
-rw-r--r--eventMouseMove.go19
-rw-r--r--stdoutShow.go11
-rw-r--r--structs.go3
4 files changed, 17 insertions, 20 deletions
diff --git a/eventMouse.go b/eventMouse.go
index 052bc53..b14bd7e 100644
--- a/eventMouse.go
+++ b/eventMouse.go
@@ -50,8 +50,8 @@ func mouseUp(g *gocui.Gui, v *gocui.View) error {
if msgMouseDown {
msgMouseDown = false
- if movingMsg {
- movingMsg = false
+ if me.movingMsg {
+ me.movingMsg = false
return nil
} else {
g.DeleteView("msg")
diff --git a/eventMouseMove.go b/eventMouseMove.go
index 3972cb2..94a2041 100644
--- a/eventMouseMove.go
+++ b/eventMouseMove.go
@@ -44,17 +44,24 @@ func mouseMove(g *gocui.Gui) {
}
}
-/*
-func dragOutputWindow() {
- log.Log(GOCUI, "todo: make dragOutputWindow")
+// this is how the window gets dragged around
+func moveMsg(g *gocui.Gui) {
+ mx, my := g.MousePosition()
+ if !me.movingMsg && (mx != initialMouseX || my != initialMouseY) {
+ me.movingMsg = true
+ }
+ g.SetView("msg", mx-xOffset, my-yOffset, mx-xOffset+outputW, my-yOffset+outputH+me.FramePadH, 0)
+ me.startOutputW = mx - xOffset
+ me.startOutputH = my - yOffset
+ g.SetViewOnBottom("msg")
}
-*/
+// this somehow is letting me drag around the stdout window
func mouseMoveOld(g *gocui.Gui) bool {
me.ecount += 1
maxX, maxY := g.Size()
mx, my := g.MousePosition()
- log.Log(NOW, "handleEvent() START", maxX, maxY, mx, my, msgMouseDown)
+ // log.Log(NOW, "handleEvent() START", maxX, maxY, mx, my, msgMouseDown)
if _, err := g.View("msg"); msgMouseDown && err == nil {
moveMsg(g)
return true
@@ -75,6 +82,6 @@ func mouseMoveOld(g *gocui.Gui) bool {
} else {
log.Log(NOW, "output widget already exists", maxX, maxY, mx, my)
}
- log.Log(NOW, "handleEvent() END ", maxX, maxY, mx, my, msgMouseDown)
+ // log.Log(NOW, "handleEvent() END ", maxX, maxY, mx, my, msgMouseDown)
return false
}
diff --git a/stdoutShow.go b/stdoutShow.go
index 0d8b360..4ae6247 100644
--- a/stdoutShow.go
+++ b/stdoutShow.go
@@ -16,17 +16,6 @@ import (
var outputW int = 180
var outputH int = 40
-func moveMsg(g *gocui.Gui) {
- mx, my := g.MousePosition()
- if !movingMsg && (mx != initialMouseX || my != initialMouseY) {
- movingMsg = true
- }
- g.SetView("msg", mx-xOffset, my-yOffset, mx-xOffset+outputW, my-yOffset+outputH+me.FramePadH, 0)
- me.startOutputW = mx - xOffset
- me.startOutputH = my - yOffset
- g.SetViewOnBottom("msg")
-}
-
func showMsg(g *gocui.Gui, v *gocui.View) error {
var l string
var err error
diff --git a/structs.go b/structs.go
index 84b0a3a..c6d8c69 100644
--- a/structs.go
+++ b/structs.go
@@ -70,12 +70,13 @@ type config struct {
ecount int // counts how many mouse and keyboard events have occurred
supermouse bool // prints out every widget found while you move the mouse around
depth int // used for listWidgets() debugging
+ movingMsg bool // means the user id dragging something around with the mouse
}
// deprecate these
var (
initialMouseX, initialMouseY, xOffset, yOffset int
- globalMouseDown, msgMouseDown, movingMsg bool
+ globalMouseDown, msgMouseDown bool
)
// this is the gocui way