https://bugs.kde.org/show_bug.cgi?id=454428

            Bug ID: 454428
           Summary: Touchpad based kinetic scrolling in gtk applications
                    does not work
           Product: kwin
           Version: 5.24.5
          Platform: Manjaro
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: input
          Assignee: kwin-bugs-n...@kde.org
          Reporter: marcus.gur...@gmail.com
  Target Milestone: ---

SUMMARY

Touchpad based kinetic scrolling in gtk applications does not work when using
kwin (wayland). After doing some digging and testing I found that the reason is
the way wl_pointer.axis_stop events are sent to application windows. kwin
(actually kwayland-server before it was merged in kwin) currently sends the
stop event for each axis in its own frame:

```
[13:      wl_pointer] frame
[13:      wl_pointer] axis_source: 1 (finger)
[13:      wl_pointer] axis_stop: time: 1054759; axis: 0 (vertical)
[13:      wl_pointer] frame
[13:      wl_pointer] axis_source: 1 (finger)
[13:      wl_pointer] axis_stop: time: 1054759; axis: 1 (horizontal)
[13:      wl_pointer] frame
```

In other compositors (weston, wlroots based like sway, mutter) the stop events
for both axes are bundled in a single frame:

```
[13:      wl_pointer] frame
[13:      wl_pointer] axis_source: 1 (finger)
[13:      wl_pointer] axis_stop: time: 1054759; axis: 0 (vertical)
[13:      wl_pointer] axis_stop: time: 1054759; axis: 1 (horizontal)
[13:      wl_pointer] frame
```

After patching kwayland-server to behave like sway etc kinetic scrolling works.
The patch needs more work obviously and is only intended to show the bare
minimum of changes to "make it work":

```
diff --git a/src/server/pointer_interface.cpp
b/src/server/pointer_interface.cpp
index b552ac4..128c6d9 100644
--- a/src/server/pointer_interface.cpp
+++ b/src/server/pointer_interface.cpp
@@ -236,7 +236,11 @@ void PointerInterface::sendAxis(Qt::Orientation
orientation, qreal delta, qint32
             }
             d->send_axis(resource->handle, d->seat->timestamp(),
wlOrientation, wl_fixed_from_double(delta));
         } else if (version >= WL_POINTER_AXIS_STOP_SINCE_VERSION) {
-            d->send_axis_stop(resource->handle, d->seat->timestamp(),
wlOrientation);
+            if (wlOrientation == 0)
+            {
+                d->send_axis_stop(resource->handle, d->seat->timestamp(), 0);
+                d->send_axis_stop(resource->handle, d->seat->timestamp(), 1);
+            }
         }
     }
 }
```

STEPS TO REPRODUCE
1. Open some gtk application, e.g. use gedit to display a large text file. 
2. Scroll using touchpad and lift fingers while they are moving.

OBSERVED RESULT

The scrolling stops immediately after lifting the fingers.

EXPECTED RESULT

The scrolling goes on after lifting the fingers up.

SOFTWARE/OS VERSIONS
OS: Manjaro 21.2.6
uname -a: Linux marcus-surface 5.17.9-arch1-2-surface #1 SMP PREEMPT Wed, 25
May 2022 15:31:19 +0000 x86_64 GNU/Linux
KDE Plasma Version: KDE Plasma 5.24.5
KDE Frameworks Version: 5.94.0
Qt Version: 5.15.4

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to