removed old var

This commit is contained in:
Jeff Carr 2025-02-08 08:47:55 -06:00
parent 1010db44a6
commit a6c1864f43
3 changed files with 61 additions and 56 deletions

View File

@ -21,7 +21,7 @@ func mouseUp(g *gocui.Gui, v *gocui.View) error {
*/ */
me.mouse.mouseUp = true me.mouse.mouseUp = true
me.mouse.globalMouseDown = false // me.mouse.globalMouseDown = false
me.mouse.currentDrag = nil me.mouse.currentDrag = nil
if me.mouse.double && (time.Since(me.mouse.down) < me.mouse.doubletime) { if me.mouse.double && (time.Since(me.mouse.down) < me.mouse.doubletime) {
@ -45,7 +45,7 @@ func mouseDown(g *gocui.Gui, v *gocui.View) error {
if time.Since(me.mouse.down) < me.mouse.doubletime { if time.Since(me.mouse.down) < me.mouse.doubletime {
me.mouse.double = true me.mouse.double = true
} }
me.mouse.globalMouseDown = true // me.mouse.globalMouseDown = true
me.mouse.mouseUp = false me.mouse.mouseUp = false
me.mouse.down = time.Now() me.mouse.down = time.Now()
w, h := g.MousePosition() w, h := g.MousePosition()

View File

@ -42,6 +42,8 @@ func mouseMove(g *gocui.Gui) {
// can't drag or do anything when dropdown or textbox are visible // can't drag or do anything when dropdown or textbox are visible
return return
} }
// okay, the mouse is down and it has been long enough
// the user is trying to drag something. let's figure out what
w, h := g.MousePosition() w, h := g.MousePosition()
// toggle off all highlight vies except for whatever is under the mouse // toggle off all highlight vies except for whatever is under the mouse
@ -61,12 +63,17 @@ func mouseMove(g *gocui.Gui) {
return return
} }
/*
if me.mouse.globalMouseDown && (me.dropdown.active || me.textbox.active) { if me.mouse.globalMouseDown && (me.dropdown.active || me.textbox.active) {
log.Info("can't drag while dropdown or textbox are active", w, h) log.Info("can't drag while dropdown or textbox are active", w, h)
return return
} }
*/
if me.mouse.mouseUp {
return
}
if me.mouse.globalMouseDown { // if me.mouse.globalMouseDown {
// log.Info("msgMouseDown == true") // log.Info("msgMouseDown == true")
// plugin will segfault if you don't keep this inside a check for msgMouseDown // plugin will segfault if you don't keep this inside a check for msgMouseDown
// don't move this code out of here // don't move this code out of here
@ -116,7 +123,6 @@ func mouseMove(g *gocui.Gui) {
log.Info(fmt.Sprintf("findByXY() empty. nothing to move at (%d,%d)", w, h)) log.Info(fmt.Sprintf("findByXY() empty. nothing to move at (%d,%d)", w, h))
} }
} }
}
// this is how the window gets dragged around // this is how the window gets dragged around
func (tk *guiWidget) moveNew() { func (tk *guiWidget) moveNew() {

View File

@ -85,7 +85,6 @@ type mouse struct {
downW int // where the mouse was pressed down downW int // where the mouse was pressed down
downH int // where the mouse was pressed down downH int // where the mouse was pressed down
currentDrag *guiWidget // what widget is currently being moved around currentDrag *guiWidget // what widget is currently being moved around
globalMouseDown bool // yep, mouse is pressed
} }
// settings for the stdout window // settings for the stdout window