Repository: tauri-apps/wry (language: rust)

Issue:
Request to Disable Swipe Navigation by Default
**Is your feature request related to a problem? Please describe.**
I've noticed that the wry library enables swipe navigation by default, which can make the user interface unpredictable and difficult to control in certain situations.

**Describe the solution you'd like**
I would like to request that the wry library be updated to disable the ```SetIsSwipeNavigationEnabled``` option by default. This will ensure that the behavior of the application is always predictable and prevent unintended navigation or actions when the user is scrolling or swiping on the screen.

**Describe alternatives you've considered**
One alternative that could be considered is to provide an option in the library's settings to enable or disable swipe navigation, allowing developers to customize the behavior of the application as needed. However, I believe that disabling this feature by default is the safest and most predictable approach.

**Would you want to assign yourself to implement this feature?**
- [ ] Yes
- [x] No

**Additional context**
tauri-apps/tauri#5958


Request to Disable Swipe Navigation by Default
**Is your feature request related to a problem? Please describe.**
I've noticed that the wry library enables swipe navigation by default, which can make the user interface unpredictable and difficult to control in certain situations.

**Describe the solution you'd like**
I would like to request that the wry library be updated to disable the ```SetIsSwipeNavigationEnabled``` option by default. This will ensure that the behavior of the application is always predictable and prevent unintended navigation or actions when the user is scrolling or swiping on the screen.

**Describe alternatives you've considered**
One alternative that could be considered is to provide an option in the library's settings to enable or disable swipe navigation, allowing developers to customize the behavior of the application as needed. However, I believe that disabling this feature by default is the safest and most predictable approach.

**Would you want to assign yourself to implement this feature?**
- [ ] Yes
- [x] No

**Additional context**
tauri-apps/tauri#5958




Discussion / hints:

Fix patch:
diff --git a/.changes/win-linux-backwards-navigation.md b/.changes/win-linux-backwards-navigation.md
new file mode 100644
index 000000000..41b39d1f7
--- /dev/null
+++ b/.changes/win-linux-backwards-navigation.md
@@ -0,0 +1,5 @@
+---
+"wry": "patch"
+---
+
+On Windows and Linux, implement `WebviewBuilder::with_back_forward_navigation_gestures` and `WebviewAttributes::back_forward_navigation_gestures` to control swipe navigation. Disabled by default.
diff --git a/src/webview/mod.rs b/src/webview/mod.rs
index c5f6e1621..a15ecac72 100644
--- a/src/webview/mod.rs
+++ b/src/webview/mod.rs
@@ -220,10 +220,9 @@ pub struct WebViewAttributes {
 
   /// Indicates whether horizontal swipe gestures trigger backward and forward page navigation.
   ///
-  /// ## Platform-specific
+  /// ## Platform-specific:
   ///
-  /// This configuration only impacts macOS.
-  /// [Documentation](https://developer.apple.com/documentation/webkit/wkwebview/1414995-allowsbackforwardnavigationgestu).
+  /// - **Android / iOS:** Unsupported.
   pub back_forward_navigation_gestures: bool,
 
   /// Set a handler closure to process the change of the webview's document title.
@@ -339,10 +338,9 @@ impl<'a> WebViewBuilder<'a> {
 
   /// Indicates whether horizontal swipe gestures trigger backward and forward page navigation.
   ///
-  /// ## Platform-specific
+  /// ## Platform-specific:
   ///
-  /// This configuration only impacts macOS.
-  /// [Documentation](https://developer.apple.com/documentation/webkit/wkwebview/1414995-allowsbackforwardnavigationgestu).
+  /// - **Android / iOS:** Unsupported.
   pub fn with_back_forward_navigation_gestures(mut self, gesture: bool) -> Self {
     self.webview.back_forward_navigation_gestures = gesture;
     self
diff --git a/src/webview/webkitgtk/mod.rs b/src/webview/webkitgtk/mod.rs
index c2903291f..1f3c87f8f 100644
--- a/src/webview/webkitgtk/mod.rs
+++ b/src/webview/webkitgtk/mod.rs
@@ -270,6 +270,8 @@ impl InnerWebView {
     if let Some(settings) = WebViewExt::settings(&*webview) {
       settings.set_enable_webgl(true);
       settings.set_enable_webaudio(true);
+      settings
+        .set_enable_back_forward_navigation_gestures(attributes.back_forward_navigation_gestures);
 
       // Enable clipboard
       if attributes.clipboard {
diff --git a/src/webview/webview2/mod.rs b/src/webview/webview2/mod.rs
index 147de2d18..2d708a65e 100644
--- a/src/webview/webview2/mod.rs
+++ b/src/webview/webview2/mod.rs
@@ -249,13 +249,8 @@ impl InnerWebView {
         .SetIsZoomControlEnabled(attributes.zoom_hotkeys_enabled)
         .map_err(webview2_com::Error::WindowsError)?;
       settings
-        .SetAreDevToolsEnabled(false)
+        .SetAreDevToolsEnabled(attributes.devtools)
         .map_err(webview2_com::Error::WindowsError)?;
-      if attributes.devtools {
-        settings
-          .SetAreDevToolsEnabled(true)
-          .map_err(webview2_com::Error::WindowsError)?;
-      }
       if !pl_attrs.browser_accelerator_keys {
         if let Ok(settings3) = settings.cast::<ICoreWebView2Settings3>() {
           settings3
@@ -265,7 +260,14 @@ impl InnerWebView {
       }
 
       let settings5 = settings.cast::<ICoreWebView2Settings5>()?;
-      let _ = settings5.SetIsPinchZoomEnabled(attributes.zoom_hotkeys_enabled);
+      settings5
+        .SetIsPinchZoomEnabled(attributes.zoom_hotkeys_enabled)
+        .map_err(webview2_com::Error::WindowsError)?;
+
+      let settings6 = settings.cast::<ICoreWebView2Settings6>()?;
+      settings6
+        .SetIsSwipeNavigationEnabled(attributes.back_forward_navigation_gestures)
+        .map_err(webview2_com::Error::WindowsError)?;
 
       let mut rect = RECT::default();
       win32wm::GetClientRect(hwnd, &mut rect);


Test patch: