summaryrefslogtreecommitdiff
path: root/find.go
diff options
context:
space:
mode:
Diffstat (limited to 'find.go')
-rw-r--r--find.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/find.go b/find.go
index a248a09..434a42d 100644
--- a/find.go
+++ b/find.go
@@ -4,6 +4,8 @@
package main
import (
+ "fmt"
+
"github.com/awesome-gocui/gocui"
log "go.wit.com/log"
"go.wit.com/widget"
@@ -133,9 +135,14 @@ func findNextWindow() *guiWidget {
func findWindowUnderMouse() *guiWidget {
w, h := me.baseGui.MousePosition()
+ if len(me.allwin) != len(findWindows()) {
+ me.allwin = findWindows()
+ }
+
// if the stdout window is on top, check it first
if me.stdout.outputOnTop {
if me.stdout.tk.full.inRect(w, h) {
+ log.Info(fmt.Sprintf("findWindowUnderMouse() found %s stdout on top (%dx%d)", me.stdout.tk.cuiName, w, h))
return me.stdout.tk
}
}
@@ -144,6 +151,7 @@ func findWindowUnderMouse() *guiWidget {
for _, win := range me.allwin {
if win.activeWindow {
if win.full.inRect(w, h) {
+ log.Info(fmt.Sprintf("findWindowUnderMouse() found %s active window (%dx%d)", win.cuiName, w, h))
return win
}
}
@@ -152,17 +160,19 @@ func findWindowUnderMouse() *guiWidget {
// well, just find any window then
for _, win := range me.allwin {
if win.full.inRect(w, h) {
+ log.Info(fmt.Sprintf("findWindowUnderMouse() found %s window (%dx%d)", win.cuiName, w, h))
return win
}
}
// okay, no window. maybe the stdout is there?
if me.stdout.tk.full.inRect(w, h) {
+ log.Info(fmt.Sprintf("findWindowUnderMouse() found %s stdout (%dx%d)", me.stdout.tk.cuiName, w, h))
return me.stdout.tk
}
// geez. nothing! maybe auto return stdout?
- log.Info("no window found at", w, h)
+ log.Info("findWindowUnderMouse() no window found at", w, h)
return nil
}