5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 23:51:44 +08:00

linux: workaround for #2977 (#3027)

In NewWindow, set options.Linux.WebviewGpuPolicy to WebviewGpuPolicyNever
if options.Linux is nil, disabling GPU acceleration by default on linux
until the upstream bugs https://bugs.webkit.org/show_bug.cgi?id=228268
and https://bugs.webkit.org/show_bug.cgi?id=261874 are fixed.
This commit is contained in:
Denis Bernard 2023-11-04 08:03:12 +01:00 committed by GitHub
parent 0a63215cde
commit 08e12de2a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -25,6 +25,7 @@ import (
"github.com/wailsapp/wails/v2/internal/frontend" "github.com/wailsapp/wails/v2/internal/frontend"
"github.com/wailsapp/wails/v2/pkg/menu" "github.com/wailsapp/wails/v2/pkg/menu"
"github.com/wailsapp/wails/v2/pkg/options" "github.com/wailsapp/wails/v2/pkg/options"
"github.com/wailsapp/wails/v2/pkg/options/linux"
) )
func gtkBool(input bool) C.gboolean { func gtkBool(input bool) C.gboolean {
@ -90,6 +91,9 @@ func NewWindow(appoptions *options.App, debug bool, devtoolsEnabled bool) *Windo
var webviewGpuPolicy int var webviewGpuPolicy int
if appoptions.Linux != nil { if appoptions.Linux != nil {
webviewGpuPolicy = int(appoptions.Linux.WebviewGpuPolicy) webviewGpuPolicy = int(appoptions.Linux.WebviewGpuPolicy)
} else {
// workaround for https://github.com/wailsapp/wails/issues/2977
webviewGpuPolicy = int(linux.WebviewGpuPolicyNever)
} }
webview := C.SetupWebview( webview := C.SetupWebview(

View File

@ -28,6 +28,11 @@ type Options struct {
// - WebviewGpuPolicyAlways // - WebviewGpuPolicyAlways
// - WebviewGpuPolicyOnDemand // - WebviewGpuPolicyOnDemand
// - WebviewGpuPolicyNever // - WebviewGpuPolicyNever
//
// Due to https://github.com/wailsapp/wails/issues/2977, if options.Linux is nil
// in the call to wails.Run(), WebviewGpuPolicy is set by default to WebviewGpuPolicyNever.
// Client code may override this behavior by passing a non-nil Options and set
// WebviewGpuPolicy as needed.
WebviewGpuPolicy WebviewGpuPolicy WebviewGpuPolicy WebviewGpuPolicy
// ProgramName is used to set the program's name for the window manager via GTK's g_set_prgname(). // ProgramName is used to set the program's name for the window manager via GTK's g_set_prgname().