summaryrefslogtreecommitdiff
path: root/window.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-02-09 03:00:10 -0600
committerJeff Carr <[email protected]>2025-02-09 03:00:10 -0600
commit8d8fc22745e8e5497e3db0a3389c17c3030a230f (patch)
tree15c30353e6651217f37ab8e890099c6890d76d7a /window.go
parenteba5ea8cc072e950df19ad5b97e3c99794ab790e (diff)
detect an attempt to close a window
Diffstat (limited to 'window.go')
-rw-r--r--window.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/window.go b/window.go
index 21d6cd8..c5be97f 100644
--- a/window.go
+++ b/window.go
@@ -7,6 +7,7 @@ import (
"fmt"
"strings"
+ log "go.wit.com/log"
"go.wit.com/toolkits/tree"
"go.wit.com/widget"
)
@@ -237,3 +238,17 @@ func (tk *guiWidget) makeTK(ddItems []string) {
*/
tk.Show()
}
+
+func (win *guiWidget) checkWindowClose(w int, h int) bool {
+ s := fmt.Sprintf("mouse(%d,%d) ", w, h)
+ offW := win.full.w1 - w
+ offH := h - win.full.h0
+ s += fmt.Sprintf("offset(%d,%d)", offW, offH)
+ if (offW < 2) && (offH < 2) {
+ log.Info("attempting close on ", s, win.cuiName)
+ // store the stdout corner for computing the drag size
+ return true
+ }
+ log.Info("not attempting close on ", s, win.cuiName)
+ return false
+}