From 8d8fc22745e8e5497e3db0a3389c17c3030a230f Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 9 Feb 2025 03:00:10 -0600 Subject: detect an attempt to close a window --- init.go | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'init.go') diff --git a/init.go b/init.go index a743f74..8a90270 100644 --- a/init.go +++ b/init.go @@ -9,6 +9,7 @@ package main import ( "errors" + "fmt" "os" "runtime" "runtime/debug" @@ -51,6 +52,10 @@ func init() { me.stdout.wId = -4 me.clock.wId = -5 + Set(&me.dropdown, "default") + s := fmt.Sprintln("fake default check =", me.FakeW, "dropdown.Id", me.dropdown.Id) + me.stdout.Write([]byte(s)) + me.mouse.mouseUp = true me.mouse.clicktime = time.Millisecond * 200 me.mouse.doubletime = time.Millisecond * 400 @@ -101,7 +106,7 @@ func standardExit() { log.Log(NOW, "standardExit() doing baseGui.Close()") me.baseGui.Close() log.Log(NOW, "standardExit() doing outf.Close()") - outf.Close() + me.outf.Close() // log(true, "standardExit() setOutput(os.Stdout)") // setOutput(os.Stdout) log.Log(NOW, "standardExit() send back Quit()") @@ -116,15 +121,13 @@ func standardClose() { log.Log(NOW, "standardExit() doing baseGui.Close()") me.baseGui.Close() log.Log(NOW, "standardExit() doing outf.Close()") - outf.Close() + me.outf.Close() // os.Stdin = os.Stdin // os.Stdout = os.Stdout // os.Stderr = os.Stderr log.Log(NOW, "standardExit() send back Quit()") } -var outf *os.File - func main() { } @@ -148,16 +151,16 @@ func mainGogui() { var err error - outf, err = os.OpenFile("/tmp/captureMode.log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666) + me.outf, err = os.OpenFile("/tmp/captureMode.log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666) if err != nil { log.Info("error opening file:", err) os.Exit(0) } origStdout = os.Stdout - os.Stdout = outf - defer outf.Close() + os.Stdout = me.outf + defer me.outf.Close() - log.CaptureMode(outf) + log.CaptureMode(me.outf) gocuiMain() } @@ -293,7 +296,7 @@ func newWindowTrigger() { // log.Log(NOW, "newWindowTrigger() got new window", tk.cuiName) time.Sleep(200 * time.Millisecond) waitOK() - redoWindows(1, -1) + redoWindows(3, 3) if !me.stdout.init { me.stdout.init = true relocateStdoutOffscreen() -- cgit v1.2.3