summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eventMouse.go13
-rw-r--r--eventMouseClick.go17
2 files changed, 21 insertions, 9 deletions
diff --git a/eventMouse.go b/eventMouse.go
index 4ecfa57..8d88b01 100644
--- a/eventMouse.go
+++ b/eventMouse.go
@@ -52,11 +52,6 @@ func mouseDown(g *gocui.Gui, v *gocui.View) error {
var found bool = false
for _, tk := range findByXY(mx, my) {
tk.dumpWidget("mouseDown()")
- if tk.node.WidgetType == widget.Window {
- log.Info("SENDING CLICK TO WINDOW")
- tk.doWidgetClick(mx, my)
- return nil
- }
if tk.node.WidgetType == widget.Button {
log.Info("SENDING CLICK TO Button")
tk.doWidgetClick(mx, my)
@@ -67,6 +62,14 @@ func mouseDown(g *gocui.Gui, v *gocui.View) error {
tk.doWidgetClick(mx, my)
return nil
}
+ found = true
+ }
+ for _, tk := range findByXY(mx, my) {
+ if tk.node.WidgetType == widget.Window {
+ log.Info("SENDING CLICK TO WINDOW")
+ tk.doWidgetClick(mx, my)
+ return nil
+ }
if tk.node.WidgetType == widget.Label {
log.Info("IGNORE LABLE")
found = false
diff --git a/eventMouseClick.go b/eventMouseClick.go
index 526cbbe..8d33800 100644
--- a/eventMouseClick.go
+++ b/eventMouseClick.go
@@ -27,10 +27,6 @@ func (tk *guiWidget) doWidgetClick(w int, h int) {
me.currentWindow.isCurrent = true
tk.active = false
- full := tk.getFullSize()
- tk.gocuiSize.w1 = full.w1
- tk.gocuiSize.h1 = full.h1
-
// draw the current window
w := tk.gocuiSize.w0 + 4
h := tk.gocuiSize.h0 + 4
@@ -38,6 +34,11 @@ func (tk *guiWidget) doWidgetClick(w int, h int) {
tk.setColor(&colorActiveW)
tk.showWidgets()
tk.placeWidgets(w, h) // compute the sizes & places for each widget
+
+ full := tk.getFullSize()
+ tk.gocuiSize.w1 = full.w1
+ tk.gocuiSize.h1 = full.h1
+ me.baseGui.SetView(tk.cuiName, tk.gocuiSize.w0, tk.gocuiSize.h0, tk.gocuiSize.w1, tk.gocuiSize.h1, 0)
case widget.Group:
if tk.active {
tk.active = false
@@ -116,6 +117,14 @@ func click(g *gocui.Gui, v *gocui.View) error {
}
}
+ // Button widgets
+ for _, tk := range findByXY(w, h) {
+ if tk.node.WidgetType == widget.Button {
+ tk.doWidgetClick(w, h)
+ return nil
+ }
+ }
+
for _, tk := range findByXY(w, h) {
// will show you everything found on a mouse click. great for debugging!
// tk.dumpWidget("click()")