5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 06:01:48 +08:00
Commit Graph

146 Commits

Author SHA1 Message Date
Lea Anthony
de29a0bd6f
Revert "Make calls thread safe"
This reverts commit 347d8cf861.
2025-04-18 16:36:46 +10:00
Lea Anthony
347d8cf861
Make calls thread safe 2025-02-08 10:37:58 +11:00
Zámbó, Levente
8d1e5188ad fix typo 2025-02-05 16:07:42 +01:00
Zámbó, Levente
f07ead3fb2 add comments 2025-02-05 16:04:49 +01:00
Zámbó, Levente
d04fd9a35f change ifdef to function 2025-02-05 15:49:11 +01:00
Zámbó, Levente
bed3ec4163 add decorator diff to window max values 2025-02-05 15:13:11 +01:00
Lea Anthony
b40fd93edb
Fix build for Linux/v2.9.0 (#3545)
* Fix #3542

* Pipeline updates

* More Pipeline updates

* Test against 1.21

* Add build tag for 24.04

* Update test for 24.04

* Update test for 24.04

* Update test for 24.04

* Update build for 24.04

* Cache apt packages

* Fix test in PR pipeline
2024-06-17 21:52:57 +10:00
Jakub Peleška
022a5ffec4
Fix Drag & Drop JS runtime (#3516)
* Feature/1090 native drag and drop for file and folder (#3203)

* implement basic dnd for linux

* implemented windows

* progress changed linux handling and added coordinates to drop

* progress fix drop coordinates on windows

* progress remove log from windows

* progress move js

* update js after merge

* fix event listener registration

* fix segfault on non file drag

* remove logs, fix coordinates

* minor changes, simplify to drop only

* rename EnableWails -> EnableFileDrop

* add documentation (PR id missing)

* add PR id to changelog

* fix remove casting from malloc

* fix nil check for OnFileDrop's callback

* fix nil check for OnFileDrop skip event when nil

* add error message for nil callback in OnFileDrop

---------

Co-authored-by: lyimmi <lelvente.zambo@gmail.com>
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>

* implement native drag and drop for macOS (#3250)

* implement native drag and drop for macOS

* update docs

* add to changelog

* update docs (macOS is supported)

* Fix windows DragAndDrop options

* Fix class unset on dragleave for full frame elements

* improve class unset (nested elements and borders case)

* Fix runtime drop target detection and CSS class assignment

* Edit changelog

* Fix drag-and-drop options in references

* Update v2/internal/frontend/desktop/darwin/WailsWebView.m

* Update v2/internal/frontend/desktop/darwin/WailsWebView.m

---------

Co-authored-by: Zámbó, Levente <levente.zambo@gmail.com>
Co-authored-by: lyimmi <lelvente.zambo@gmail.com>
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
Co-authored-by: Andrey Pshenkin <andrey.pshenkin@gmail.com>
Co-authored-by: Pavel Binar <pavel@beamtransfer.io>
2024-06-10 15:15:28 +10:00
Atterpac
05bdeb0844
allow builds for webkit2gtk-4.1 (#3465) 2024-05-08 19:26:27 -05:00
reallylowest
e7756e9274
chore: fix some typos in comments (#3357)
Signed-off-by: reallylowest <sunjinping@outlook.com>
2024-03-31 16:23:18 +11:00
Sean
9cafd85cda
fix: fallback to hardcoded Edge/Chrome/Firefox Windows browser paths if user's default browser no longer exists (#3262)
To reproduce:

- Use Windows
- Set your default browser to Firefox (Settings -> Apps -> Default Apps -> Web Browser)
- Rename your firefox.exe to something.else

The BrowserOpenURL before this commit silently fails.

The BrowserOpenURL after this commit tries to use a hardcoded fallback browser.
If successful, a warning message is logged.
If unsuccessful (default browser and fallback browsers fail), an error message is logged.

Co-authored-by: Sean <sean@malonetuning.com>
2024-03-24 17:09:27 +11:00
Vladimir
f7c19469a7
v2 [#3133] SingleInstanceData: Fill missing WD as is (#3154)
* [#3133] SingleInstanceData: Fill missing WD as is

* Apply suggestions from code review

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Fix: missing `import` for AI suggestions

* Add changelog entry

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2024-01-04 05:26:24 +11:00
Denis Bernard
08e12de2a0
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.
2023-11-04 18:03:12 +11:00
Andrey Pshenkin
c24bd5e3e8
Implement Single instance lock feature with passing arguments to initial instance (#2951)
* implement MacOS openFile/openFiles events

* wip: windows file association

* fix macro import

* add file icon copy

* try copy icon

* keep only required part of scripts

* update config schema

* fix json

* set fileAssociation for mac via config

* proper iconName handling

* add fileAssociation icon generator

* fix file association icons bundle

* don't break compatibility

* remove mimeType as not supported linux for now

* add documentation

* adjust config schema

* restore formatting

* try implement single instance lock with params passing

* fix focusing

* fix focusing

* formatting

* use channel buffer for second instance events

* handle errors

* add comment

* remove unused option in file association

* wip: linux single instance lock

* wip: linux single instance

* some experiments with making window active

* try to use unminimise

* remove unused

* try present for window

* try present for window

* fix build

* cleanup

* cleanup

* implement single instance lock on mac os

* implement proper show for windows

* proper unmimimise

* get rid of openFiles mac os. change configuration structure

* remove unused channel

* remove unused function

* add documentation for single instance lock

* add PR link

* changes after review

* update docs

* changes after review

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2023-10-23 21:31:56 +11:00
Mohamed Gharib
3f9067c815
[v2] Devtools tag doesn't enable default context-menu (#2923)
* Devtools tag doesn't enable default context-menu

* Update changelog
2023-09-26 07:43:18 +10:00
Mohamed Gharib
34c725231c
[v2] Refactor devtools (better naming to remove confusion) (#2921) 2023-09-19 20:56:49 +10:00
Lea Anthony
6aa6762f12
Devtools hotkey (#2915)
* Add Ctrl/Cmd+Shift+F12 Hotkey to open devtools when `-devtools` flag used.
2023-09-19 05:56:14 +10:00
Zámbó, Levente
647bc87600
[v2, Linux] fix menu background color (#2873)
* fix menu background color

* remove commented line

* handle transparent window and background color

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2023-09-07 21:25:02 +10:00
Andreas Christou
886bcc7b47
Add print functionality to v2 (#2822)
* Add print functionality to v2

* Update changelog

* Update runtime docs

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2023-09-06 07:55:36 +10:00
Zámbó, Levente
427e41f190
fix disable window resize (#2863)
* fix disable window resize

* change issue number in changelog

* change pull request number in changelog
2023-08-28 08:40:28 +10:00
stffabi
761efed84d
[v2] Introduce size and physical size of screens (#2856) 2023-08-26 10:11:01 +10:00
Phil Richards
427fe7e8d3
Init GTK in NewFrontend, not init (#2841)
* Init GTK in `NewFrontend`, not `init`

So apps that have a headless / non-gui mode will be able to run, since
they needn't call `NewFrontend` (which is called by `CreateApp`).
Previously, `init` would call `C.gtk_init` regardless of whether
CreateApp was called.

Also change to call `C.gtk_init_check` with a panic, instead of
`C.gtk_init`, since `gtk_init` just exits the process if it fails,
without a sensible error message.

Fixes #2628.

* Update changelog
2023-08-26 06:41:53 +10:00
Zámbó, Levente
5a4eae968f
set the background color for window (#2853)
* set the background color for window

* update changelog for #2853
2023-08-25 08:27:52 +10:00
Zámbó, Levente
9085e1edbb
Bugfix/2848 window set position timing (#2850)
* run WindowSetPosition on main thread

* remove wait group from SetPosition it is not neaded

* update changelog
2023-08-25 05:50:26 +10:00
Zámbó, Levente
e72e4aa179
add new programName option to linux options (#2817)
* add new programName option to linux options

* modify changelog

* free program name string
2023-08-10 07:48:09 +10:00
Mohamed Gharib
4162f097f1
[v2, options] Add EnableDefaultContextMenu option (#2733)
* [v2, options] Add EnableDefaultContextMenu option

* Update changelog & docs

* go mod tidy (./v2)

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2023-06-20 06:31:47 +10:00
Mohamed Gharib
fa851f29c5
[v2] Add -devtools production build flag (#2725)
* [v2] Add devtools production build flag

* Update changelog

* Fix changelog spacing

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2023-06-19 06:45:01 +10:00
Amin Yahyaabadi
35eb1e0160
fix: avoid app crashing when the Linux GTK key is empty (#2672)
* fix: avoid app crash when the Linux GTK key is empty

Fixes this error:

```
DEBUG | Log dir is: /root/.config/surrealdb_explorer/log.txt

Overriding existing handler for signal 10. Set JSC_SIGNAL_FOR_GC if you want WebKit to use a different signal
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running, locked to thread]:
github.com/wailsapp/wails/v2/internal/frontend/desktop/linux.parseKey({0x0, 0x0})
        /home/aminya/go/pkg/mod/github.com/wailsapp/wails/v2@v2.5.1/internal/frontend/desktop/linux/keys.go:87 +0xa5
github.com/wailsapp/wails/v2/internal/frontend/desktop/linux.acceleratorToGTK(0xc0001c5f20)
        /home/aminya/go/pkg/mod/github.com/wailsapp/wails/v2@v2.5.1/internal/frontend/desktop/linux/keys.go:72 +0x2c
github.com/wailsapp/wails/v2/internal/frontend/desktop/linux.processMenuItem(0x866bc0?, 0xc0001c8a80, 0xc0001c8a80?)
        /home/aminya/go/pkg/mod/github.com/wailsapp/wails/v2@v2.5.1/internal/frontend/desktop/linux/menu.go:159 +0x40b
github.com/wailsapp/wails/v2/internal/frontend/desktop/linux.processSubmenu(0xc0001c8a20, 0x79a2a9?)
        /home/aminya/go/pkg/mod/github.com/wailsapp/wails/v2@v2.5.1/internal/frontend/desktop/linux/menu.go:99 +0xdc
github.com/wailsapp/wails/v2/internal/frontend/desktop/linux.processMenu(0xc00021f6c0, 0x12?)
        /home/aminya/go/pkg/mod/github.com/wailsapp/wails/v2@v2.5.1/internal/frontend/desktop/linux/menu.go:82 +0x46
github.com/wailsapp/wails/v2/internal/frontend/desktop/linux.(*Window).SetApplicationMenu(0xc00021f6c0, 0xc000128dc8)
        /home/aminya/go/pkg/mod/github.com/wailsapp/wails/v2@v2.5.1/internal/frontend/desktop/linux/menu.go:75 +0x1b6
github.com/wailsapp/wails/v2/internal/frontend/desktop/linux.NewWindow(0xc00011ba40, 0x0)
        /home/aminya/go/pkg/mod/github.com/wailsapp/wails/v2@v2.5.1/internal/frontend/desktop/linux/window.go:126 +0x37b
github.com/wailsapp/wails/v2/internal/frontend/desktop/linux.NewFrontend({0x1cea4e8?, 0xc00023b890}, 0xc00011ba40, 0xc000128e40, 0xc0001c8b40, {0x1ce7480?, 0xc000139840})
        /home/aminya/go/pkg/mod/github.com/wailsapp/wails/v2@v2.5.1/internal/frontend/desktop/linux/frontend.go:182 +0x5c5
github.com/wailsapp/wails/v2/internal/frontend/desktop.NewFrontend(...)
        /home/aminya/go/pkg/mod/github.com/wailsapp/wails/v2@v2.5.1/internal/frontend/desktop/desktop_linux.go:16
github.com/wailsapp/wails/v2/internal/app.CreateApp(0xc00011ba40)
        /home/aminya/go/pkg/mod/github.com/wailsapp/wails/v2@v2.5.1/internal/app/app_production.go:84 +0x5a5
github.com/wailsapp/wails/v2/pkg/application.(*Application).Run(0xc000131940)
        /home/aminya/go/pkg/mod/github.com/wailsapp/wails/v2@v2.5.1/pkg/application/application.go:57 +0x29
wails_vue/backend.BootApplication(0xc000131640, 0xc000138a40, 0xc0001c5320, 0xc0001c55c0, 0xc000128b40, 0xc00012ec30, 0xc000131880)
        /home/aminya/Documents/GitHub/teamnoon/SurrealDB-Explorer/backend/Application.go:103 +0x718
reflect.Value.call({0x874160?, 0x1c761f0?, 0xc000138a00?}, {0x8e263d, 0x4}, {0xc0001584d0, 0x7, 0x1c761f0?})
        /usr/local/go/src/reflect/value.go:586 +0xb0b
reflect.Value.Call({0x874160?, 0x1c761f0?, 0x1c761f0?}, {0xc0001584d0?, 0x0?, 0x1c761f0?})
        /usr/local/go/src/reflect/value.go:370 +0xbc
github.com/Envuso/go-ioc-container.(*Invocable).CallMethodWith(0xc000138a00, 0x1c761f0?, {0x0?, 0x1cef290?, 0x8bd180?})
        /home/aminya/go/pkg/mod/github.com/!envuso/go-ioc-container@v0.0.5/invocable.go:149 +0xad
github.com/Envuso/go-ioc-container.(*ContainerInstance).Call(0xc00011c630?, {0x874160?, 0x1c761f0?}, {0x0, 0x0, 0x0})
        /home/aminya/go/pkg/mod/github.com/!envuso/go-ioc-container@v0.0.5/container_invocation.go:30 +0x6c
main.main()
        /home/aminya/Documents/GitHub/teamnoon/SurrealDB-Explorer/main.go:34 +0x112
```

* fix: merge the key length comparison
2023-05-25 18:40:37 +10:00
stffabi
496461920f
[v2] DevServer improvements and fixes (#2664)
* [assetserver, darwin] Fix copying request headers by using strdup

* [assetserver, linux] Fake some basic http headers for legacy webkit2 versions to support proxying requests to other servers

This fixes the devserver on v2 for newer vite versions that use the custom
scheme.

* [v2, windows] 304 responses are going to hang the WebView2 so prevent them by removing cache related headers in the request.

* [v2, dev] Now uses the custom schemes `wails://` on macOS and Linux for all Vite versions.

Prevent missing reload after fast multiple savings on Linux and Windows.
2023-05-16 09:35:48 +02:00
LGiki
832d6bc4d3
[v2, linux] Fix StartHidden option not working on Linux (#2624)
* fix: StartHidden option not working on Linux

* chore: add an entry to the changelog
2023-04-30 01:20:39 +10:00
stffabi
7c1490a8b1
[assetServer] Improve release/close handling of webview requests (#2612) 2023-04-20 12:06:37 +02:00
Joshua Hull
489689b477
Use json.Marshal instead of strconv.Quote to correctly support unicode (#2509)
* Use json.Marshal instead of strconv.Quote to correctly support unicode

* Add fix to changelog

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2023-04-16 10:19:40 +10:00
stffabi
db527c0fc2
[assetserver] Add linux platform implementation (#2543) 2023-03-31 10:08:31 +02:00
stffabi
caa0b6c804
[assetServer, darwin] Use AssetServer native WKWebView request handling (#2283) 2023-01-16 13:02:18 +01:00
stffabi
0a98efeea9
[runtime] Improve —wails-draggable by starting a drag immediately but only for the first click in a series (#2302)
This removes the sometime lagging experience when
starting to drag on Windows. But it's still possible to use
double-click events for adding e.g. a WindowToggleMaximise.
2023-01-16 20:56:13 +11:00
Lea Anthony
54ca6c7059
Refactor assetserver into pkg (#2260) 2023-01-08 11:25:21 +01:00
Zámbó, Levente
c3011813b0
linux separate window c and go file (#2275) 2023-01-07 16:20:11 +11:00
Zámbó, Levente
0a32c1124e
Add common text clipboard support (#2228) 2023-01-05 16:41:07 +11:00
Zámbó, Levente
ef5f547d27
Support GPU acceleration settings on Windows & Linux (#2266)
* support GPU acceleration settings Window & Linux

* fix linux empty option crash

* fix change linux gpu policy switch case

* add PR to changelog
2023-01-02 09:38:53 +11:00
Lea Anthony
d3b4105f75
Chore/refactor assetserver (#2250)
* Remove context from API calls

* Remove logger dependency

* Remove fs dependency

* Remove runtime dependency

* Update Windows/Linux calls to NewAssetServerMainPage

* Add missing imports

* fix runtime import clash
2022-12-31 10:36:07 +11:00
Lea Anthony
e57bfe002a
Fix right mouse button event (#2190) 2022-12-13 07:09:45 +11:00
stffabi
5418b879c4
[linux] Add support for WebKit2GTK 2.36+ features (#2151) 2022-11-30 11:04:12 +01:00
Lea Anthony
7f8952ebe5
Fix signal handler (#2152)
* Fix signal handler

* Update changelog
2022-11-30 20:37:55 +11:00
stffabi
f6e46ac1c3
[debug] Introducing debug options for debug builds to allow opening the inspector on startup (#2080) 2022-11-12 19:51:54 +11:00
stffabi
638caf72f0
[assetserver] Introduce middleware and extract options (#2016)
* [assetserver] Add support for HTTP Middlewares

* [dev] Disable frontend DevServer if no Assets has been defined and inform user

* [dev] Consistent WebSocket behaviour in dev and prod mode for assets handler and middleware

In prod mode we can't support WebSockets so make sure the
assets handler and middleware never see WebSockets in dev mode.

* [templates] Migrate to new AssetServer option

* [docs] Add assetserver.Options to the reference
2022-10-29 23:15:15 +02:00
Lea Anthony
eee6797907
Add WindowExecJS method (#1927)
* Add WindowExecJS

* [devserver] Embed the base frontend into the DevServer struct

* Update docs

Co-authored-by: stffabi <stffabi@users.noreply.github.com>
2022-10-05 08:44:23 +11:00
Zámbó, Levente
de49b1f125
fix gtk_window_begin_resize_drag's mouse button (#1920)
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2022-10-01 15:45:37 +10:00
Zámbó, Levente
2690250378
Add window transparency for linux (#1926) 2022-10-01 15:44:38 +10:00
Zámbó, Levente
13532e00a0
add missing resize for framless window on linux (#1918)
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2022-09-30 08:51:08 +10:00
Lea Anthony
b2069c871d
Refactor app (#1909)
* Application refactor

* [windows] refactor out main loop. Create new application struct. Refactor assethandler/assetserver signatures.

* Refactor darwin app

* Refactor app for linux

* Update v2/internal/frontend/assetserver/assethandler.go

Co-authored-by: stffabi <stffabi@users.noreply.github.com>

* Update v2/internal/frontend/assetserver/assethandler.go

Co-authored-by: stffabi <stffabi@users.noreply.github.com>

* Update v2/internal/frontend/assetserver/assetserver.go

Co-authored-by: stffabi <stffabi@users.noreply.github.com>

* Update v2/internal/frontend/assetserver/assetserver.go

Co-authored-by: stffabi <stffabi@users.noreply.github.com>

Co-authored-by: stffabi <stffabi@users.noreply.github.com>
2022-09-29 18:43:35 +10:00