Skip to content

Commit

Permalink
linux: workaround for #2977 (#3027)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
db47h authored Nov 4, 2023
1 parent 0a63215 commit 08e12de
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions v2/internal/frontend/desktop/linux/window.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/wailsapp/wails/v2/internal/frontend"
"github.com/wailsapp/wails/v2/pkg/menu"
"github.com/wailsapp/wails/v2/pkg/options"
"github.com/wailsapp/wails/v2/pkg/options/linux"
)

func gtkBool(input bool) C.gboolean {
Expand Down Expand Up @@ -90,6 +91,9 @@ func NewWindow(appoptions *options.App, debug bool, devtoolsEnabled bool) *Windo
var webviewGpuPolicy int
if appoptions.Linux != nil {
webviewGpuPolicy = int(appoptions.Linux.WebviewGpuPolicy)
} else {
// workaround for https://github.com/wailsapp/wails/issues/2977
webviewGpuPolicy = int(linux.WebviewGpuPolicyNever)
}

webview := C.SetupWebview(
Expand Down
5 changes: 5 additions & 0 deletions v2/pkg/options/linux/linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ type Options struct {
// - WebviewGpuPolicyAlways
// - WebviewGpuPolicyOnDemand
// - 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

// ProgramName is used to set the program's name for the window manager via GTK's g_set_prgname().
Expand Down

0 comments on commit 08e12de

Please sign in to comment.