5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 04:59:38 +08:00
Commit Graph

68 Commits

Author SHA1 Message Date
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
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
0a32c1124e
Add common text clipboard support (#2228) 2023-01-05 16:41:07 +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
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
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
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
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
stffabi
229d36207c
[v2] Fix formatting of some error messages (#1665) 2022-07-27 19:20:30 +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
3e42d2da05
Rename WindowSetRGBA -> WindowSetBackgroundColour (#1506)
* Rename WindowSetRGBA -> WindowSetBackgroundColour

* Fix Typos
2022-06-29 22:31:49 +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
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
Florent
c3a98b058e
ensure webkit/gtk callbacks run on main thread (#1320)
prevent close event being propagated when handled in app
closes #1268
closes #1288
2022-04-08 06:42:17 +10:00
Sebastian Bauer
7dd3f96915 [Feature/1149] Dark mode: functions for manually switching theme (#1291)
* [Feature/1149] Dark mode: functions for manually switching theme
2022-04-01 08:21:37 +11:00
stffabi
65fb42d9e7
[v2] Add support for external frontend dev servers (#1290)
* [v2] Consolidate AssetServers

* [v2] Support starturl for webview on linux and darwin

* [v2] Add support for frontend DevServer

* [v2] Activate frontend DevServer in svelte template

* [website] Add bleeding edge guide for PRs

* DoNotMerge: Bump Version for testing

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2022-03-31 00:40:44 +11:00
Florent
d9e5cce2b2
add support for 'DomReady' callback on linux (#1249)
* add support for 'DomReady' callback on linux
cosmetic: use bodyLen instead of len() in processRequest()

* reformat webViewLoadChanged() for consistency

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2022-03-14 18:42:38 +11:00
Lea Anthony
1048782eb4
Initial commit (#1241) 2022-03-10 21:20:41 +11:00
Florent
622c4adad6
ensure binary resources can be served (#1240)
* ensure binary resources can be served
fixes #1235

* use free instead of g_free
check that C.malloc does not fail before using C.memcpy
2022-03-10 21:17:24 +11:00
stffabi
c63b1f1981
[v2] Consolidate processRequest, improve logging and error handling (#1158) 2022-02-28 19:14:03 +11:00
Lea Anthony
93491eb2eb
Feature/align api (#1161)
* Fix WindowSetRGBA API

* Change WindowUnFullscreen -> WindowUnfullscreen for consistency
RGBA bugfix
2022-02-19 20:29:55 +11:00
Lea Anthony
f059c35d9e
Feature: WindowToggleMaximise (#1159)
* [windows] Add WindowToggleMaximise

* Add mac support

* Update docs

* [linux] Toggle Maximise
2022-02-18 20:28:16 +11:00
Lea Anthony
30a4f47cba
[linux] Fix min/max size 2022-02-08 06:51:52 +11:00
Lea Anthony
322aad166b
[linux] Fix fullscreen 2022-02-08 05:29:26 +11:00
Lea Anthony
0971857e7e
Fix position runtime (#1123)
* [linux] Move SetTitle and startDrag to main thread

* [linux] Move SetPosition, Center, Fullscreen and UnFullscreen to main thread

* Fix runtime Window Get/Set Position signatures

* Fix vanilla template keyboard handling
2022-02-03 21:42:14 +11:00
Lea Anthony
db9e0fd0d3
[linux] Remove Go based dispatcher 2022-01-31 21:22:17 +11:00
Lea Anthony
a624ee5e35
[linux] better error handling 2022-01-30 21:03:39 +11:00
Lea Anthony
be15644b96
Ignore setenv error 2022-01-29 11:42:17 +11:00
Lea Anthony
f3783c9800
Fix fullscreen drag 2022-01-29 11:41:50 +11:00
Lea Anthony
ac3808f9c3
Support RGBA, fix compilation error 2022-01-29 11:38:25 +11:00
Travis McLane
e713c439f0
ensure data doesn't get garbage collected too soon (#1113)
* ensure data doesn't get garbage collected too soon

* Update v2/internal/frontend/desktop/linux/frontend.go

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

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
Co-authored-by: stffabi <stffabi@users.noreply.github.com>
2022-01-28 07:37:17 +11:00
Travis McLane
ac69577182
remove unused import (#1107) 2022-01-27 07:01:29 +11:00
Lea Anthony
c5036187c2
Merge branch 'master' into feature/fix-linux-dialogs 2022-01-26 14:18:12 +11:00
Lea Anthony
7ede3ed08a
[linux] 404 handling 2022-01-26 14:01:31 +11:00