5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-03 05:30:52 +08:00
Commit Graph

121 Commits

Author SHA1 Message Date
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
Lea Anthony
b93cdcd942
Releasetest/release workflow (#1869)
* Test release workflow

* Update release.yml

* Update release.yml

* add linux deps

* Update release.yml

* Update release.yml

* Update release.yml

* Update release.yml

* Update release.yml

* Update release.yml

* Update release.yml

* Update release.yml

* Update release.yml

* Fix: Misc tests

* Fix: Misc tests + linux build tags

* Fix: Bindings tests + move templates to pkg. Add json schema for templates

* Fix: template tests

* Add tests to release workflow. Test for go 1.18 + go 1.19
Fix: ignore .m files for non darwin builds. Fix watcher test. Fix warning in clilogger.

* Fix release pipeline

* Matrix for tests

* Rename templates to make tests work

* Update template test

* Debug template test

* Debug template test

* Debug template test

* Fix gitignore

* Update release.yml
2022-09-18 08:55:21 +10:00
Lea Anthony
052b9222c1
Add garble support (#1793)
Co-authored-by: AlbinoDrought <sean@albinodrought.com>
Co-authored-by: stffabi <stffabi@users.noreply.github.com>
2022-09-13 10:05:37 +10:00
Lea Anthony
d23108a49e
Make draggable CSS property customisable (#1828)
Co-authored-by: stffabi <stffabi@users.noreply.github.com>
2022-09-10 14:33:35 +10:00
Kevin MacMartin
27f36a8edd
Only set GDK_BACKEND to "x11" if GDK_BACKEND is unset and XDG_SESSION_TYPE is not "wayland" (#1811)
* Only set GDK_BACKEND to "x11" if GDK_BACKEND is unset and XDG_SESSION_TYPE is not "wayland"

* GDK_BACKEND should only be set if XDG_SESSION_TYPE is unset, "unspecified" or "x11"
2022-08-31 17:31:52 +10:00
ZanderCodes
70c484f603
Add Some WindowState (#1349)
* Add Check for WindowState IsMaximised, IsMinimized, IsNormal and IsFullscreen

Solve conflicts

# Conflicts:
#	v2/internal/frontend/desktop/darwin/WailsContext.m
#	v2/internal/frontend/desktop/darwin/frontend.go
#	v2/internal/frontend/desktop/linux/window.go
#	v2/internal/frontend/desktop/windows/window.go

* Add Check for WindowState IsMaximised, IsMinimized, IsNormal and IsFullscreen

Solve conflict
# Conflicts:
#	v2/pkg/runtime/window.go

* Forgot some function to use it

# Conflicts:
#	v2/internal/frontend/desktop/darwin/WailsContext.h
#	v2/internal/frontend/desktop/windows/win32/consts.go
#	v2/internal/frontend/desktop/windows/win32/window.go

* Modify the instructions

# Conflicts:
#	v2/internal/frontend/devserver/devserver.go

* Add Functions to DevServer

# Conflicts:
#	v2/internal/frontend/dispatcher/systemcalls.go
#	v2/internal/frontend/runtime/desktop/window.js
#	v2/internal/frontend/runtime/package-lock.json
#	v2/internal/frontend/runtime/runtime_prod_desktop.js
#	v2/internal/frontend/runtime/wrapper/runtime.d.ts
#	v2/internal/frontend/runtime/wrapper/runtime.js

* Add Callback and JavaScript Functions

# Conflicts:
#	v2/cmd/wails/internal/commands/initialise/templates/generate/assets/common/frontend/wailsjs/runtime/runtime.js
#	v2/internal/frontend/runtime/package-lock.json
#	v2/internal/frontend/runtime/runtime_dev_desktop.js

* Remove Merge lines

* Fix IsMaximised

* Add WindowState Docs

* Update docs

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2022-08-30 06:52:01 +10:00
Lea Anthony
f2568f1899
Experimental support for CSS Drag detection (#1750)
* Support CSS Drag

* Support CSS Drag as experimental option
2022-08-18 20:39:05 +10:00
Lea Anthony
baff28bb20
Bugfix/linux warnings (#1656)
* Use scaling when setting min/max window

* Fix compile issue. Add debug

* Fix scaling issue

* Fix window widget warnings & shutdown issue. Remove debug lines for linux

* Update dev build with shutdown fix
2022-08-03 21:17:38 +10:00
Lea Anthony
224f7c0c56
Move SetMin/Max calls to main thread (#1684)
* Move SetMin/MAx calls to main thread

* Move setsize back to original location

* Remove debug
2022-08-02 06:51:20 +10:00
stffabi
229d36207c
[v2] Fix formatting of some error messages (#1665) 2022-07-27 19:20:30 +10:00
Lea Anthony
8e21061e78
Remove debug info for linux 2022-07-26 08:29:00 +10:00
Lea Anthony
ae756a8409
Use scaling when setting min/max window (#1557)
* Use scaling when setting min/max window

* Fix compile issue. Add debug

* Fix scaling issue
2022-07-23 17:15:22 +10:00
Lea Anthony
29912785fa
Add Show() and Hide() to runtime to show/hide application (#1599)
* Add Show() and Hide() to runtime to show/hide application

* Fix devserver

* Update API docs
2022-07-20 20:59:49 +10:00
skamensky
04d35410de
Expose screen dimensions (#1519)
* get dimensions working for linux

* Cleaning up some GTK code

I was getting the following errors due to some bad casts.

Gdk-CRITICAL **: 18:58:51.943: gdk_monitor_get_geometry: assertion 'GDK_IS_MONITOR (monitor)' failed
Gdk-CRITICAL **: 18:58:51.943: gdk_display_get_monitor_at_window: assertion 'GDK_IS_DISPLAY (display)' failed

This commit fixes these errors

* Adding Screen namespace along with linux implementation

* moving ScreenGetAll into a more appropriate place

* Fixing typescript definition mistake, documentation, ordering of functions, and formatting

* add ScreenGetAll to more templates

* moving screen into its own javascript file

* fixing bug where screen objects are not returned from the runtime function

* rebuilding frontend wrapper package

* adding windows implementation of ScreenGetAll

* adding screen get all implementation for darwin

* reverting a change that is unrelated to the work on expose-dimensions

* removing duplicate comparison

* changing GetNthScreen in screen API on macos

To use frame instead of visibleframe to keep into account the space the the dock takes up
We want to include that space in the calculation in order to keep the sizes of screens consistent across platforms

* Correcting screen jsdoc

It used to say it returned a single screen object. Now it says that it returns an array of screen objects

* Fixing typo in function name

* reverting pointless spacing change

* reverting pointless spacing change

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
Co-authored-by: shmuel.kamensky <shmuel.kamensky@shutterfly.com>
2022-07-16 12:33:37 +10:00
Lea Anthony
69016c6c6f
Fix OnBeforeClose code for Mac (#1558)
* Fix OnBeforeClose code for Mac

* Fix OnBeforeClose for linux
2022-07-14 21:04:45 +10:00
Lea Anthony
cd35536a79
[linux] Fix SetBackgroundColour 2022-07-04 22:29:51 +10:00
Lea Anthony
3e42d2da05
Rename WindowSetRGBA -> WindowSetBackgroundColour (#1506)
* Rename WindowSetRGBA -> WindowSetBackgroundColour

* Fix Typos
2022-06-29 22:31:49 +10:00
Lea Anthony
7141c972fd
Move WindowGet* to main thread (#1464) 2022-06-29 20:07:16 +10:00
chenxiao
072929689c
feature: add runtime func WindowSetAlwaysOnTop (#1442)
* feature: add runtime func WindowSetAlwaysOnTop

* add runtime WindowSetUnalwaysOnTop

* add  JavaScript runtime method  ,  docs update

* WindowSetAlwaysOnTop(b bool)

* Add AlwaysOnTop for MacOS

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2022-06-22 20:55:02 +10:00
Lea Anthony
c477100374
Add BackgroundColour and deprecate RGBA (#1475) 2022-06-21 19:47:05 +10:00
stffabi
2a0673f99f
[v2, linux] Improve switching to main thread for callbacks (#1392)
Make sure no pointers to the stack are passed to g_idle_add,
because at the time the callback gets executed on the
main thread, the pointer might be invalid.
Go might have reused the stack or grown the stack and the
pointer is invalid.

The concept used on Windows has been ported to Linux.
2022-05-31 20:28:37 +10:00
Zámbó, Levente
794a8ce19f
feature - support linux/arm (#1427) 2022-05-27 19:09:50 -10:00
stffabi
c97e1c50af
[v2, linux] Make sure to execute the menu callbacks on a new goroutine (#1403)
* Make sure to execute the menu callbacks on a new goroutine
* Fix assertion message when opening file dialogs by passing the correct parent window
2022-05-17 20:45:48 +10:00
stffabi
524411964f
[v2] WindowReloadApp should use the startURL of the frontend to support reloading when a frontend dev server is used (#1347) 2022-04-23 07:09:53 +10:00
Lea Anthony
f6257d3d31 Add Environment and WindowReloadApp calls to runtime. Updated default templates. 2022-04-20 20:28:41 +10:00
stffabi
6d09a45a30
[v2] Add support for AssetsHandler (#1325)
* [website] Fix devserver default value doc

* [v2] Add support for AssetsHandler

AssetsHandler is a http.Handler delegate, which gets called
as a fallback for all Non-GET requests and for GET requests
for which the Assets didn’t find the file.

Known Limitations on Linux:
- All requests are GET requests
- No request headers
- No request body
- No response status code, only StatusOK will be returned
- No response headers

Known Limitations on Windows:
-  Request body is leaking memory. Seems to be a bug in
    WebView2, investigation angoing.

Most of these limitations on Linux will be fixed in the future with
adding support for Webkit2Gtk 2.36.0+.

* [v2, linux] Add response streaming support

The complete response won’t be held anymore in memory and will
be streamed to WebKit2.

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2022-04-12 20:18:27 +10:00