From be7c723c470260ff1091040e979a264a88abfab7 Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Sun, 11 Feb 2024 09:07:46 +1100 Subject: [PATCH] Fix window close issues Update docs Make uri scheme registration thread safe --- mkdocs-website/docs/en/roadmap.md | 10 ++++++ mkdocs-website/shared/alpha1.csv | 32 +++++++++---------- .../shared/alpha3-bindings-callbyname.csv | 6 +--- mkdocs-website/shared/alpha5.csv | 16 ++++++++++ v3/pkg/application/linux_cgo.go | 19 +++++++---- 5 files changed, 55 insertions(+), 28 deletions(-) create mode 100644 mkdocs-website/shared/alpha5.csv diff --git a/mkdocs-website/docs/en/roadmap.md b/mkdocs-website/docs/en/roadmap.md index 875f46810..559d75508 100644 --- a/mkdocs-website/docs/en/roadmap.md +++ b/mkdocs-website/docs/en/roadmap.md @@ -23,6 +23,16 @@ Report any issues you find using [this guide](./getting-started/feedback.md). - Test all the things on Linux! +#### Status + +Linux examples: + +- :material-check-bold: - Working +- :material-minus: - Partially working +- :material-close: - Not working + +{{ read_csv("alpha5.csv") }} + ## Upcoming milestones ## Alpha 6 diff --git a/mkdocs-website/shared/alpha1.csv b/mkdocs-website/shared/alpha1.csv index f372dc65f..1f553d433 100644 --- a/mkdocs-website/shared/alpha1.csv +++ b/mkdocs-website/shared/alpha1.csv @@ -1,16 +1,16 @@ -" ",Mac,Windows,Linux -binding,:material-check-bold:,:material-check-bold:,:material-check-bold: -build,:material-check-bold:,:material-check-bold:,:material-check-bold: -clipboard,:material-check-bold:,:material-check-bold:,:material-check-bold: -context menus,:material-check-bold:,:material-check-bold:,:material-check-bold: -dialogs,:material-check-bold:,:material-check-bold:,:material-check-bold: -drag-n-drop,:material-check-bold:,:material-check-bold:,:material-check-bold: -events,:material-check-bold:,:material-check-bold:,:material-minus: -frameless,:material-check-bold:,:material-check-bold:,:material-check-bold: -keybindings,:material-check-bold:,:material-check-bold:,:material-minus: -plain,:material-check-bold:,:material-check-bold:,:material-check-bold: -screen,:material-check-bold:,:material-check-bold:,:material-check-bold: -systray,:material-check-bold:,:material-check-bold:,:material-check-bold: -video,:material-check-bold:,:material-check-bold:,:material-check-bold: -window,:material-check-bold:,:material-check-bold:,:material-minus: -wml,:material-check-bold:,:material-check-bold:,:material-check-bold: \ No newline at end of file +" ",Linux,Notes +binding," "," " +build," "," " +clipboard," "," " +context menus," "," " +dialogs," "," " +drag-n-drop," "," " +events,:material-check-bold:," " +frameless," "," " +keybindings," "," " +plain," "," " +screen," "," " +systray," "," " +video," "," " +window," "," " +wml," "," " \ No newline at end of file diff --git a/mkdocs-website/shared/alpha3-bindings-callbyname.csv b/mkdocs-website/shared/alpha3-bindings-callbyname.csv index dbbc00e5c..faa8b62d9 100644 --- a/mkdocs-website/shared/alpha3-bindings-callbyname.csv +++ b/mkdocs-website/shared/alpha3-bindings-callbyname.csv @@ -1,9 +1,5 @@ Scenario,Windows,Mac,Linux -Same package,: clipboardLock.RLock() - defer clipboardLock.RUnlock() - clipboardText := C.getClipboardText() - result := C.GoString(clipboardText) - return result, true:,:material-check-bold:,:material-check-bold: +Same package,:material-check-bold,:material-check-bold:,:material-check-bold: Different package,:material-check-bold:,:material-check-bold:,:material-check-bold: Different package with same name,"on hold","on hold","on hold" Containing another struct from same package,:material-check-bold:,:material-check-bold:,:material-check-bold: diff --git a/mkdocs-website/shared/alpha5.csv b/mkdocs-website/shared/alpha5.csv new file mode 100644 index 000000000..f372dc65f --- /dev/null +++ b/mkdocs-website/shared/alpha5.csv @@ -0,0 +1,16 @@ +" ",Mac,Windows,Linux +binding,:material-check-bold:,:material-check-bold:,:material-check-bold: +build,:material-check-bold:,:material-check-bold:,:material-check-bold: +clipboard,:material-check-bold:,:material-check-bold:,:material-check-bold: +context menus,:material-check-bold:,:material-check-bold:,:material-check-bold: +dialogs,:material-check-bold:,:material-check-bold:,:material-check-bold: +drag-n-drop,:material-check-bold:,:material-check-bold:,:material-check-bold: +events,:material-check-bold:,:material-check-bold:,:material-minus: +frameless,:material-check-bold:,:material-check-bold:,:material-check-bold: +keybindings,:material-check-bold:,:material-check-bold:,:material-minus: +plain,:material-check-bold:,:material-check-bold:,:material-check-bold: +screen,:material-check-bold:,:material-check-bold:,:material-check-bold: +systray,:material-check-bold:,:material-check-bold:,:material-check-bold: +video,:material-check-bold:,:material-check-bold:,:material-check-bold: +window,:material-check-bold:,:material-check-bold:,:material-minus: +wml,:material-check-bold:,:material-check-bold:,:material-check-bold: \ No newline at end of file diff --git a/v3/pkg/application/linux_cgo.go b/v3/pkg/application/linux_cgo.go index 7bf4362df..5d0c73fca 100644 --- a/v3/pkg/application/linux_cgo.go +++ b/v3/pkg/application/linux_cgo.go @@ -7,6 +7,7 @@ import ( "github.com/wailsapp/wails/v3/internal/assetserver/webview" "regexp" "strings" + "sync" "unsafe" "github.com/wailsapp/wails/v3/pkg/events" @@ -192,6 +193,8 @@ var ( mainThreadId *C.GThread ) +var registerURIScheme sync.Once + func init() { gtkSignalToMenuItem = map[uint]*MenuItem{} @@ -840,13 +843,15 @@ func windowNewWebview(parentId uint, gpuPolicy WebviewGpuPolicy) pointer { C.g_object_set_data((*C.GObject)(unsafe.Pointer(webView)), c.String("windowid"), C.gpointer(winID)) C.g_object_set_data((*C.GObject)(unsafe.Pointer(manager)), c.String("windowid"), C.gpointer(winID)) - context := C.webkit_web_view_get_context(C.webkit_web_view(webView)) - C.webkit_web_context_register_uri_scheme( - context, - c.String("wails"), - C.WebKitURISchemeRequestCallback(C.onProcessRequest), - nil, - nil) + registerURIScheme.Do(func() { + context := C.webkit_web_view_get_context(C.webkit_web_view(webView)) + C.webkit_web_context_register_uri_scheme( + context, + c.String("wails"), + C.WebKitURISchemeRequestCallback(C.onProcessRequest), + nil, + nil) + }) settings := C.webkit_web_view_get_settings((*C.WebKitWebView)(unsafe.Pointer(webView))) C.webkit_settings_set_user_agent_with_application_details(settings, c.String("wails.io"), c.String(""))