[windows] ignore mouse events

This commit is contained in:
Lea Anthony
2023-10-23 20:58:55 +11:00
parent e661052c89
commit 3422c40e19
3 changed files with 32 additions and 0 deletions
+26
View File
@@ -5,6 +5,7 @@ import (
"fmt"
"log"
"math/rand"
"os"
"runtime"
"strconv"
"time"
@@ -100,6 +101,21 @@ func main() {
}).Show()
windowCounter++
})
myMenu.Add("New WebviewWindow (ignores mouse events").
SetAccelerator("CmdOrCtrl+F").
OnClick(func(ctx *application.Context) {
app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
HTML: "<div style='width: 100%; height: 95%; border: 3px solid red; background-color: \"0000\";'></div>",
X: rand.Intn(1000),
Y: rand.Intn(800),
IgnoreMouseEvents: true,
BackgroundType: application.BackgroundTypeTransparent,
Mac: application.MacWindow{
InvisibleTitleBarHeight: 50,
},
}).Show()
windowCounter++
})
if runtime.GOOS == "darwin" {
myMenu.Add("New WebviewWindow (MacTitleBarHiddenInset)").
OnClick(func(ctx *application.Context) {
@@ -384,6 +400,16 @@ func main() {
_ = w.Print()
})
})
printMenu.Add("Capture PNG").OnClick(func(ctx *application.Context) {
currentWindow(func(w *application.WebviewWindow) {
img, err := w.CapturePNG()
if err != nil {
application.ErrorDialog().SetTitle("Error").SetMessage(err.Error()).Show()
return
}
os.WriteFile("capture.png", img, 0644)
})
})
app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
BackgroundColour: application.NewRGB(33, 37, 41),