From 8b5c15cf3387fbe4e93dcc6805f353b945d2a712 Mon Sep 17 00:00:00 2001 From: Jacalz Date: Tue, 26 Dec 2023 11:40:45 +0100 Subject: [PATCH] Remove support for GopherJS to unblock newer Go versions The leaves the GopherJS support in cmd/fyne intact given that the plan is to move that tool out of the repository for this release. --- .github/workflows/web_tests.yml | 8 +------- app/app_openurl_js.go | 20 ------------------- app/app_theme_js.go | 29 ---------------------------- go.mod | 4 ++-- go.sum | 2 -- internal/driver/glfw/shortcuts_js.go | 15 -------------- internal/driver/glfw/window_js.go | 11 ----------- 7 files changed, 3 insertions(+), 86 deletions(-) delete mode 100644 app/app_openurl_js.go delete mode 100644 app/app_theme_js.go delete mode 100644 internal/driver/glfw/shortcuts_js.go delete mode 100644 internal/driver/glfw/window_js.go diff --git a/.github/workflows/web_tests.yml b/.github/workflows/web_tests.yml index d47da136aa..a451f7ffcb 100644 --- a/.github/workflows/web_tests.yml +++ b/.github/workflows/web_tests.yml @@ -15,7 +15,7 @@ jobs: persist-credentials: false - uses: WillAbides/setup-go-faster@v1.8.0 with: - go-version: '1.17.x' + go-version: '1.19.x' - name: Get dependencies run: sudo apt-get update && sudo apt-get install gcc libgl1-mesa-dev libegl1-mesa-dev libgles2-mesa-dev libx11-dev xorg-dev @@ -26,9 +26,3 @@ jobs: GOARCH: wasm working-directory: cmd/fyne_demo run: go build - - - name: Build GopherJS and Wasm full website - run: | - go install github.com/gopherjs/gopherjs@latest - go install ./cmd/fyne - cd cmd/fyne_demo && fyne package --target=web \ No newline at end of file diff --git a/app/app_openurl_js.go b/app/app_openurl_js.go deleted file mode 100644 index 35af69b0a9..0000000000 --- a/app/app_openurl_js.go +++ /dev/null @@ -1,20 +0,0 @@ -//go:build !ci && js && !wasm -// +build !ci,js,!wasm - -package app - -import ( - "fmt" - "net/url" - - "honnef.co/go/js/dom" -) - -func (app *fyneApp) OpenURL(url *url.URL) error { - window := dom.GetWindow().Open(url.String(), "_blank", "") - if window == nil { - return fmt.Errorf("Unable to open a new window/tab for URL: %v.", url) - } - window.Focus() - return nil -} diff --git a/app/app_theme_js.go b/app/app_theme_js.go deleted file mode 100644 index 479cb9f425..0000000000 --- a/app/app_theme_js.go +++ /dev/null @@ -1,29 +0,0 @@ -//go:build !ci && js && !wasm -// +build !ci,js,!wasm - -package app - -import ( - "fyne.io/fyne/v2" - "fyne.io/fyne/v2/theme" - - "github.com/gopherjs/gopherjs/js" -) - -func defaultVariant() fyne.ThemeVariant { - if matchMedia := js.Global.Call("matchMedia", "(prefers-color-scheme: dark)"); matchMedia != js.Undefined { - if matches := matchMedia.Get("matches"); matches != js.Undefined && matches.Bool() { - return theme.VariantDark - } - return theme.VariantLight - } - return theme.VariantDark -} - -func init() { - if matchMedia := js.Global.Call("matchMedia", "(prefers-color-scheme: dark)"); matchMedia != js.Undefined { - matchMedia.Call("addEventListener", "change", func(o *js.Object) { - fyne.CurrentApp().Settings().(*settings).setupTheme() - }) - } -} diff --git a/go.mod b/go.mod index 7ec8fd9500..c590cf6416 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,6 @@ require ( github.com/go-text/render v0.0.0-20230619120952-35bccb6164b8 github.com/go-text/typesetting v0.0.0-20230616162802-9c17dd34aa4a github.com/godbus/dbus/v5 v5.1.0 - github.com/gopherjs/gopherjs v1.17.2 github.com/jackmordaunt/icns/v2 v2.2.6 github.com/josephspurrier/goversioninfo v1.4.0 github.com/lucor/goinfo v0.9.0 @@ -34,7 +33,6 @@ require ( golang.org/x/mod v0.12.0 golang.org/x/sys v0.13.0 golang.org/x/tools v0.12.0 - honnef.co/go/js/dom v0.0.0-20210725211120-f030747120f2 ) require ( @@ -42,6 +40,7 @@ require ( github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect + github.com/gopherjs/gopherjs v1.17.2 // indirect github.com/jsummers/gobmp v0.0.0-20151104160322-e2ba15ffa76e // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect @@ -49,4 +48,5 @@ require ( golang.org/x/net v0.17.0 // indirect golang.org/x/text v0.13.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect + honnef.co/go/js/dom v0.0.0-20210725211120-f030747120f2 // indirect ) diff --git a/go.sum b/go.sum index f070772353..7041263d55 100644 --- a/go.sum +++ b/go.sum @@ -84,8 +84,6 @@ github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nos github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/fyne-io/gl-js v0.0.0-20220119005834-d2da28d9ccfe h1:A/wiwvQ0CAjPkuJytaD+SsXkPU0asQ+guQEIg1BJGX4= github.com/fyne-io/gl-js v0.0.0-20220119005834-d2da28d9ccfe/go.mod h1:d4clgH0/GrRwWjRzJJQXxT/h1TyuNSfF/X64zb/3Ggg= -github.com/fyne-io/glfw-js v0.0.0-20220120001248-ee7290d23504 h1:+31CdF/okdokeFNoy9L/2PccG3JFidQT3ev64/r4pYU= -github.com/fyne-io/glfw-js v0.0.0-20220120001248-ee7290d23504/go.mod h1:gLRWYfYnMA9TONeppRSikMdXlHQ97xVsPojddUv3b/E= github.com/fyne-io/glfw-js v0.0.0-20220517201726-bebc2019cd33 h1:0Ayg0/do/sqX2R7NonoLZvWxGrd9utTVf3A0QvCbC88= github.com/fyne-io/glfw-js v0.0.0-20220517201726-bebc2019cd33/go.mod h1:gLRWYfYnMA9TONeppRSikMdXlHQ97xVsPojddUv3b/E= github.com/fyne-io/image v0.0.0-20220602074514-4956b0afb3d2 h1:hnLq+55b7Zh7/2IRzWCpiTcAvjv/P8ERF+N7+xXbZhk= diff --git a/internal/driver/glfw/shortcuts_js.go b/internal/driver/glfw/shortcuts_js.go deleted file mode 100644 index cc18b8b9d9..0000000000 --- a/internal/driver/glfw/shortcuts_js.go +++ /dev/null @@ -1,15 +0,0 @@ -//go:build js && !wasm -// +build js,!wasm - -package glfw - -import ( - "strings" - - "github.com/gopherjs/gopherjs/js" -) - -// Checks if running on Mac OSX -func isMacOSRuntime() bool { - return strings.Contains(strings.ToLower(js.Global.Get("window").Get("navigator").Get("platform").String()), "mac") -} diff --git a/internal/driver/glfw/window_js.go b/internal/driver/glfw/window_js.go deleted file mode 100644 index c1516d57f7..0000000000 --- a/internal/driver/glfw/window_js.go +++ /dev/null @@ -1,11 +0,0 @@ -//go:build js && !wasm && !test_web_driver -// +build js,!wasm,!test_web_driver - -package glfw - -import "math" - -func (w *window) scaleInput(in float64) float64 { - return math.Ceil(in * float64(w.canvas.Scale())) - -}