diff --git a/v3/examples/video/go.mod b/v3/examples/video/go.mod
index 0df4c1d9f..edfa98f91 100644
--- a/v3/examples/video/go.mod
+++ b/v3/examples/video/go.mod
@@ -4,10 +4,7 @@ go 1.21
toolchain go1.21.0
-require (
- github.com/wailsapp/go-webview2 v1.0.9
- github.com/wailsapp/wails/v3 v3.0.0-alpha.0
-)
+require github.com/wailsapp/wails/v3 v3.0.0-alpha.0
require (
github.com/Microsoft/go-winio v0.4.16 // indirect
@@ -37,6 +34,7 @@ require (
github.com/rivo/uniseg v0.4.4 // indirect
github.com/samber/lo v1.38.1 // indirect
github.com/sergi/go-diff v1.2.0 // indirect
+ github.com/wailsapp/go-webview2 v1.0.9 // indirect
github.com/wailsapp/mimetype v1.4.1 // indirect
github.com/xanzy/ssh-agent v0.3.0 // indirect
golang.org/x/crypto v0.9.0 // indirect
@@ -47,5 +45,3 @@ require (
)
replace github.com/wailsapp/wails/v3 => ../..
-
-replace github.com/wailsapp/go-webview2 => D:\GolandProjects\go-webview2
diff --git a/v3/examples/video/go.sum b/v3/examples/video/go.sum
index 85e9d1279..169c421b9 100644
--- a/v3/examples/video/go.sum
+++ b/v3/examples/video/go.sum
@@ -101,6 +101,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
+github.com/wailsapp/go-webview2 v1.0.9 h1:lrU+q0cf1wgLdR69rN+ZnRtMJNaJRrcQ4ELxoO7/xjs=
+github.com/wailsapp/go-webview2 v1.0.9/go.mod h1:Uk2BePfCRzttBBjFrBmqKGJd41P6QIHeV9kTgIeOZNo=
github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs=
github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o=
github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI=
diff --git a/v3/examples/video/main.go b/v3/examples/video/main.go
index adccb91a6..10990a24a 100644
--- a/v3/examples/video/main.go
+++ b/v3/examples/video/main.go
@@ -31,6 +31,9 @@ func main() {
BackgroundColour: application.NewRGB(33, 37, 41),
Mac: application.MacWindow{
DisableShadow: true,
+ WebviewPreferences: application.MacWebviewPreferences{
+ FullscreenEnabled: application.Enabled,
+ },
},
HTML: "",
})
diff --git a/v3/examples/window/main.go b/v3/examples/window/main.go
index bc8e5d132..ccf9e05c7 100644
--- a/v3/examples/window/main.go
+++ b/v3/examples/window/main.go
@@ -5,7 +5,6 @@ import (
"fmt"
"log"
"math/rand"
- "os"
"runtime"
"strconv"
"time"
@@ -400,16 +399,6 @@ 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),
diff --git a/v3/pkg/application/application_darwin_delegate.h b/v3/pkg/application/application_darwin_delegate.h
index 50ff8b6e9..9c11eb8a1 100644
--- a/v3/pkg/application/application_darwin_delegate.h
+++ b/v3/pkg/application/application_darwin_delegate.h
@@ -7,6 +7,7 @@
@interface AppDelegate : NSObject
@property bool shouldTerminateWhenLastWindowClosed;
+- (BOOL)applicationSupportsSecureRestorableState:(NSApplication *)app;
@end
#endif
diff --git a/v3/pkg/application/application_darwin_delegate.m b/v3/pkg/application/application_darwin_delegate.m
index e12858e35..99825c7db 100644
--- a/v3/pkg/application/application_darwin_delegate.m
+++ b/v3/pkg/application/application_darwin_delegate.m
@@ -17,7 +17,13 @@ extern bool hasListeners(unsigned int);
processApplicationEvent(EventApplicationDidChangeTheme, NULL);
}
}
-- (BOOL)applicationShouldHandleReopen:(NSNotification *)notification
+
+- (BOOL)applicationSupportsSecureRestorableState:(NSApplication *)app
+{
+ return YES;
+}
+
+- (BOOL)applicationShouldHandleReopen:(NSNotification *)notification
hasVisibleWindows:(BOOL)flag {
if( hasListeners(EventApplicationShouldHandleReopen) ) {
processApplicationEvent(EventApplicationShouldHandleReopen, @{@"hasVisibleWindows": @(flag)});
diff --git a/v3/pkg/application/webview_window_darwin.go b/v3/pkg/application/webview_window_darwin.go
index 3d50821af..681ffbe9a 100644
--- a/v3/pkg/application/webview_window_darwin.go
+++ b/v3/pkg/application/webview_window_darwin.go
@@ -649,7 +649,11 @@ static void windowShowMenu(void *window, void *menu, int x, int y) {
[nsMenu popUpMenuPositioningItem:nil atLocation:point inView:webView];
}
-
+// windowIgnoreMouseEvents makes the window ignore mouse events
+static void windowIgnoreMouseEvents(void *window, bool ignore) {
+ WebviewWindow* nsWindow = (WebviewWindow*)window;
+ [nsWindow setIgnoresMouseEvents:ignore];
+}
// Make the given window frameless
static void windowSetFrameless(void *window, bool frameless) {
@@ -1112,6 +1116,10 @@ func (w *macosWebviewWindow) run() {
C.webviewSetTransparent(w.nsWindow)
}
+ if options.IgnoreMouseEvents {
+ C.windowIgnoreMouseEvents(w.nsWindow, C.bool(true))
+ }
+
titleBarOptions := macOptions.TitleBar
if !w.parent.options.Frameless {
C.windowSetTitleBarAppearsTransparent(w.nsWindow, C.bool(titleBarOptions.AppearsTransparent))