5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-03 00:09:56 +08:00

[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
This commit is contained in:
Lea Anthony 2023-09-20 08:23:38 +10:00 committed by GitHub
parent eca6afc18c
commit 3369327ad2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 23 additions and 9 deletions

View File

@ -33,7 +33,7 @@ require (
github.com/tc-hib/winres v0.1.5
github.com/tidwall/sjson v1.1.7
github.com/tkrajina/go-reflector v0.5.6
github.com/wailsapp/go-webview2 v1.0.1
github.com/wailsapp/go-webview2 v1.0.6
github.com/wailsapp/mimetype v1.4.1
github.com/wzshiming/ctc v1.2.3
golang.org/x/mod v0.12.0

View File

@ -214,8 +214,8 @@ github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyC
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
github.com/wailsapp/go-webview2 v1.0.1 h1:dEJIeEApW/MhO2tTMISZBFZPuW7kwrFA1NtgFB1z1II=
github.com/wailsapp/go-webview2 v1.0.1/go.mod h1:Uk2BePfCRzttBBjFrBmqKGJd41P6QIHeV9kTgIeOZNo=
github.com/wailsapp/go-webview2 v1.0.6 h1:7qW+wVcepvlLh8yIFI52tLMAl1Le9jdeQBu+Pej+MKY=
github.com/wailsapp/go-webview2 v1.0.6/go.mod h1:Uk2BePfCRzttBBjFrBmqKGJd41P6QIHeV9kTgIeOZNo=
github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs=
github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o=
github.com/wzshiming/ctc v1.2.3 h1:q+hW3IQNsjIlOFBTGZZZeIXTElFM4grF4spW/errh/c=

View File

@ -506,6 +506,14 @@ func (f *Frontend) setupChromium() {
}
chromium.Embed(f.mainWindow.Handle())
if chromium.HasCapability(edge.SwipeNavigation) {
swipeGesturesEnabled := f.frontendOptions.Windows != nil && f.frontendOptions.Windows.EnableSwipeGestures
err := chromium.PutIsSwipeNavigationEnabled(swipeGesturesEnabled)
if err != nil {
log.Fatal(err)
}
}
chromium.Resize()
settings, err := chromium.GetSettings()
if err != nil {
@ -538,10 +546,6 @@ func (f *Frontend) setupChromium() {
if err != nil {
log.Fatal(err)
}
err = settings.PutIsSwipeNavigationEnabled(false)
if err != nil {
log.Fatal(err)
}
if f.debug && f.frontendOptions.Debug.OpenInspectorOnStartup {
chromium.OpenDevToolsWindow()

View File

@ -113,6 +113,9 @@ type Options struct {
//
// !! Please keep in mind when disabling this feature, this also allows malicious software to inject into the WebView2 !!
WebviewDisableRendererCodeIntegrity bool
// Configure whether swipe gestures should be enabled
EnableSwipeGestures bool
}
func DefaultMessages() *Messages {

View File

@ -687,6 +687,13 @@ Setting this to `true` will disable GPU hardware acceleration for the webview.
Name: WebviewGpuIsDisabled<br/>
Type: `bool`
#### EnableSwipeGestures
Setting this to `true` will enable swipe gestures for the webview.
Name: EnableSwipeGestures<br/>
Type: `bool`
### Mac
This defines [Mac specific options](#mac).

View File

@ -14,15 +14,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
- Added support for enabling/disabling swipe gestures for Windows WebView2. Added by @leaanthony in [PR](https://github.com/wailsapp/wails/pull/2878)
- When building with `-devtools` flag, CMD/CTRL+SHIFT+F12 can be used to open the devtools. Added by @leaanthony in [PR](https://github.com/wailsapp/wails/pull/2915)
#### Fixed
- Fixed typo on docs/reference/options page. Added by [@pylotlight](https://github.com/pylotlight) in [PR](https://github.com/wailsapp/wails/pull/2887)
## v2.6.0 - 2023-09-06
### Breaking Changes