From f79cf8917058b421a4f8dd4a854795720671c008 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 1 Feb 2025 18:05:39 -0600 Subject: [PATCH] part way to a generalized mouse move() --- eventMouse.go | 12 ------------ eventMouseMove.go | 18 ------------------ help.go | 2 +- structs.go | 1 - 4 files changed, 1 insertion(+), 32 deletions(-) diff --git a/eventMouse.go b/eventMouse.go index b14bd7e..63e0165 100644 --- a/eventMouse.go +++ b/eventMouse.go @@ -23,10 +23,6 @@ func msgDown(g *gocui.Gui, v *gocui.View) error { tk.dumpWidget("mouseDown()") } - // debugging output - // log.Log(GOCUI, "msgDown() X,Y", initialMouseX, initialMouseY) - - // vx, vy, _, _, err := g.ViewPosition("msg") if err == nil { xOffset = initialMouseX - vx @@ -50,12 +46,6 @@ func mouseUp(g *gocui.Gui, v *gocui.View) error { if msgMouseDown { msgMouseDown = false - if me.movingMsg { - me.movingMsg = false - return nil - } else { - g.DeleteView("msg") - } } else if globalMouseDown { globalMouseDown = false g.DeleteView("globalDown") @@ -63,8 +53,6 @@ func mouseUp(g *gocui.Gui, v *gocui.View) error { return nil } -// func isMouseInMsg - // this is where you have to figure out what // widget was underneath so you can active // the right response for the toolkit user's app diff --git a/eventMouseMove.go b/eventMouseMove.go index d67c3c3..a88f64c 100644 --- a/eventMouseMove.go +++ b/eventMouseMove.go @@ -59,30 +59,12 @@ func mouseMove(g *gocui.Gui) { // this is how the window gets dragged around func (tk *guiWidget) moveNew(g *gocui.Gui) { mx, my := g.MousePosition() - if !me.movingMsg && (mx != initialMouseX || my != initialMouseY) { - me.movingMsg = true - } - // tk.DrawAt(mx-xOffset, my-yOffset) 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 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") -} -*/ - func createStdout(g *gocui.Gui) bool { if widgetView, _ := g.View("msg"); widgetView == nil { makeOutputWidget(g, "this is a create before a mouse click") diff --git a/help.go b/help.go index 12e8c9b..10ae31c 100644 --- a/help.go +++ b/help.go @@ -24,7 +24,7 @@ import ( var helpText []string = []string{"KEYBINDINGS", "", - "?: toggle help", + "?: toggle zhelp", "S: super mouse", "M: list all widgets positions", "L: list all widgets in tree form", diff --git a/structs.go b/structs.go index 902c3fc..68c0c37 100644 --- a/structs.go +++ b/structs.go @@ -70,7 +70,6 @@ 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