summaryrefslogtreecommitdiff
path: root/eventMouseMove.go
diff options
context:
space:
mode:
Diffstat (limited to 'eventMouseMove.go')
-rw-r--r--eventMouseMove.go88
1 files changed, 47 insertions, 41 deletions
diff --git a/eventMouseMove.go b/eventMouseMove.go
index e928265..01d1d18 100644
--- a/eventMouseMove.go
+++ b/eventMouseMove.go
@@ -42,6 +42,8 @@ func mouseMove(g *gocui.Gui) {
// can't drag or do anything when dropdown or textbox are visible
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()
// toggle off all highlight vies except for whatever is under the mouse
@@ -61,60 +63,64 @@ func mouseMove(g *gocui.Gui) {
return
}
- if me.mouse.globalMouseDown && (me.dropdown.active || me.textbox.active) {
- log.Info("can't drag while dropdown or textbox are active", w, h)
+ /*
+ if me.mouse.globalMouseDown && (me.dropdown.active || me.textbox.active) {
+ log.Info("can't drag while dropdown or textbox are active", w, h)
+ return
+ }
+ */
+ if me.mouse.mouseUp {
return
}
- if me.mouse.globalMouseDown {
- // log.Info("msgMouseDown == true")
- // plugin will segfault if you don't keep this inside a check for msgMouseDown
- // don't move this code out of here
- var found bool = false
- if me.mouse.currentDrag != nil {
- // me.mouse.currentDrag.dumpWidget(fmt.Sprintf("MM (%3d,%3d)", w, h))
- me.mouse.currentDrag.moveNew()
+ // if me.mouse.globalMouseDown {
+ // log.Info("msgMouseDown == true")
+ // plugin will segfault if you don't keep this inside a check for msgMouseDown
+ // don't move this code out of here
+ var found bool = false
+ if me.mouse.currentDrag != nil {
+ // me.mouse.currentDrag.dumpWidget(fmt.Sprintf("MM (%3d,%3d)", w, h))
+ me.mouse.currentDrag.moveNew()
+ return
+ }
+ // new function that is smarter
+ if tk := findWindowUnderMouse(); tk != nil {
+ me.mouse.currentDrag = tk
+ return
+ }
+ // first look for windows
+ for _, tk := range findByXY(w, h) {
+ if tk.node.WidgetType == widget.Window {
+ me.mouse.currentDrag = tk
return
}
- // new function that is smarter
- if tk := findWindowUnderMouse(); tk != nil {
+ }
+
+ // now look for the STDOUT window
+ for _, tk := range findByXY(w, h) {
+ if tk.node.WidgetType == widget.Flag {
me.mouse.currentDrag = tk
+ // tk.moveNew()
return
}
- // first look for windows
- for _, tk := range findByXY(w, h) {
- if tk.node.WidgetType == widget.Window {
- me.mouse.currentDrag = tk
- return
- }
- }
-
- // now look for the STDOUT window
- for _, tk := range findByXY(w, h) {
- if tk.node.WidgetType == widget.Flag {
- me.mouse.currentDrag = tk
- // tk.moveNew()
- return
- }
+ }
+ for _, tk := range findByXY(w, h) {
+ if tk.node.WidgetType == widget.Stdout {
+ me.mouse.currentDrag = tk
+ // tk.moveNew()
+ return
}
- for _, tk := range findByXY(w, h) {
- if tk.node.WidgetType == widget.Stdout {
+ /*
+ if tk.node.WidgetType == widget.Label {
me.mouse.currentDrag = tk
// tk.moveNew()
return
}
- /*
- if tk.node.WidgetType == widget.Label {
- me.mouse.currentDrag = tk
- // tk.moveNew()
- return
- }
- */
- found = true
- }
- if !found {
- log.Info(fmt.Sprintf("findByXY() empty. nothing to move at (%d,%d)", w, h))
- }
+ */
+ found = true
+ }
+ if !found {
+ log.Info(fmt.Sprintf("findByXY() empty. nothing to move at (%d,%d)", w, h))
}
}