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

116 Commits

Author SHA1 Message Date
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
Carl Seleborg
b5406cb13e
Add missing runtime.UnlockOSThread() (#2994)
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2023-10-21 16:30:48 +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
stffabi
d370f72ede
[v2, windows] Support async request processing on AssetServer (#2926) 2023-09-20 19:28:18 +02:00
Lea Anthony
3369327ad2
[v2] Support Enabling/Disabling swipe gestures (#2878)
* [v2] Support Enabling/Disabling swipe gestures

* [v2] Update change log

* [v2] Remove old call to PutIsSwipeNavigationEnabled

* Use latest webview2

* Update go-webview2 mod version
2023-09-20 08:23:38 +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
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
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
Lea Anthony
f2ab205415
[chore] Use webview2 package (#2687)
* [v2 windows] Use external webview2 package

* Update CHANGELOG
2023-06-10 17:04:31 +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
stffabi
3853d2d1bf
[v2, windows] Handle webview2 process crashes and add DisableWebViewRendererCodeIntegrity flag (#2627)
* Add flag to disable webview RendererCodeIntegrity checks
* Handle webview2 process crashes
2023-04-27 23:03:26 +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
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
stffabi
8e4606d104
[windows] Improve fullscreen mode for frameless windows (#2279)
* Improve fullscreen mode for frameless windows
* Set Window background color in addition to WebView2 background color
2023-01-09 12:15:43 +01:00
Lea Anthony
54ca6c7059
Refactor assetserver into pkg (#2260) 2023-01-08 11:25:21 +01:00
stffabi
284e20a290
Add EnableFraudulentWebsiteDetection to options (#2269)
This allows to explicitly opt-in to scan services for fraudulent
content, such as malware or phishing attempts.
2023-01-06 00:06:26 +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
ea6aee91f1
Refactored build command (#2123)
* Refactored build command

* Update v2/cmd/wails/build.go

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

* WIP

* Refactor `wails doctor`

* Refactor `wails dev`

* Refactor `wails dev`

* Fix merge conflict

* Fix test

* Update build_and_test.yml

Co-authored-by: stffabi <stffabi@users.noreply.github.com>
2022-12-01 18:18:02 +11:00
stffabi
72aef804ef
[windows] Prevent a thin white line at the bottom of a frameless window (#2111)
This seems to be only a problem on some Windows versions.
2022-11-22 20:37:45 +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
Pierre Joye
f4adff1cb3
#1057 expose ZoomFactor get/set and add the respective windows only options (#1463)
* #1057 expose ZoomFactor get/set and add the respective windows only options

* Remove debug log, use IsZoomControlEnabled as well

* use math.float to/from 64bits functions instead

* Add new windows options ZoomFactor and IsZoomControlEnabled doc

* Grammar

* Update options.mdx

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2022-10-14 08:46:14 +11: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
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
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
b6dee773c5
Attempted fix for both drag and doubleclick (#1704)
* Attempted fix for both drag and doubleclick

* Shameful hack for windows doubleclick events

* Handle end of drag

* Remove dbClickInterval
2022-08-08 17:27:23 +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
3e42d2da05
Rename WindowSetRGBA -> WindowSetBackgroundColour (#1506)
* Rename WindowSetRGBA -> WindowSetBackgroundColour

* Fix Typos
2022-06-29 22:31:49 +10:00
Nan0
2065600096
Feature: set browser path (#1448)
* Added option to specify webview2 path

* Added `manual` webview strategy

* Update documentation

* Fixed build with manual tag

* Check for browser directory existence

* Added version check for manually specified webview, removed fallback for installed webview in manual strategy

* Update WebviewBrowserPath documentation

* Replaced deprecated StringToUTF16Ptr

* Return on error

* Removed manual strategy, return error in wv2installer for fixed runtime

* Removed manual strategy from CLI
2022-06-25 07:49:00 +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
1687906376
Improve theme change at runtime (#1473)
* Improve theme change at runtime

* Handle change to dark mode

* Refactor theme calculation

* Ensure theme is updated for WM_ACTIVATE and WM_SETTINGCHANGE events
2022-06-22 08:34:41 +10:00
Lea Anthony
c477100374
Add BackgroundColour and deprecate RGBA (#1475) 2022-06-21 19:47:05 +10:00
Lea Anthony
cb169611b1
Set Window Background colour if provided + debounce redraw option (#1466)
* Set Window Background colour if provided. Added debounce option for Webview2 redraw on resize

* [windows] Workaround resize flickering in frameless mode

Co-authored-by: stffabi <stffabi@users.noreply.github.com>
2022-06-20 17:47:13 +10:00
Lea Anthony
a7f1ea21ef Bugfix: Better support for showing window 2022-06-19 13:32:48 +10:00
Lea Anthony
e4f2bfe699 Bugfix: Windows start maximised
Fixes #1462
2022-06-18 16:21:32 +10:00
stffabi
664f6a952c
[v2, windows] Unlock OSThread after native calls have been finished (#1441)
* [v2, windows] Remove unnecessary LockOSThread

Form.Invoke makes sure the call is on the correct thread and does
lock the OSThread during the call.

* [v2, windows] Unlock OSThread after native calls have been finished

This makes sure the OSThread can be reused by other go
routines after a native call has been finished. Otherwise the
OSThread will be destroyed as soon as the goroutine has
finished.
2022-06-08 20:56:07 +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
Lea Anthony
4e9eda8e1f Fix bug in WindowSet*Theme 2022-04-19 17:44:40 +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
stffabi
c70d93b482
Suppress resizing during minimize of a frameless window (#1322)
If the window is frameless and we are minimizing, then we need to suppress
the Resize on the WebView2. If we don't do this, restoring does not work as
expected and first restores with some wrong size during the restore animation
and only fully renders when the animation is done.
This highly depends on the content in the WebView.
Possible fix for #1319
2022-04-10 18:45:09 +10:00
Lea Anthony
073f8202e5 Fix windows/frontend compile error 2022-04-01 09:59:33 +11:00