Diffusion KWin e9d20b80e9a7

[tabbox] Intercept QWheelEvents on QQuickWindow for scrolling

Authored by graesslin on Oct 6 2016, 6:06 AM.

Description

[tabbox] Intercept QWheelEvents on QQuickWindow for scrolling

Summary:
The TabBox performs the scrolling of the items by itself in order to
support wheel events even if the mouse is not on the TabBox. For that
KWin grabs pointer events on X11 (on Wayland an input filter is used)
and forwards them to the TabBox.

Qt uses Xinput2 for scrolling on the QQuickWindow. Due to that KWin
does not get any xcb core button press/release events when scrolling
inside the QQuickWindow and thus scrolling doesn't work.

There are three possible approaches to fix this:

  1. Implement scrolling support in each of the QML switchers
  2. Add an xinput2 filter to TabBox
  3. Intercept the QWheelEvents on the QQuickWindow

The first approach has the disadvantage that all themes need
adjustment and that there might be behaviorial difference whether one
scrolls on the TabBox window or outside the window.

The second approach would be most in line with the other filters, but
is difficult due to the nature of xinput2 (no xcb bindings, etc).

Thus the third approach might be the best solution. Wheel events are
only delivered to the QQuickWindow if the native events were not already
intercepted, thus we know it won't have side effects for the case that
Wayland is used or xinput2 is not supported.

The implementation installs an event filter on the QQuickWindow which
gets created when showing the TabBox and inside the filter waits till
there is an angleDelta of +/-120 and scrolls by one per every 120 angle
delta as described in the QWheelEvent documentation.

BUG: 369661
FIXED-IN: 5.8.2

Test Plan: Scrolled with touchpad and mouse wheel.

Reviewers: KWin, Plasma, broulik

Subscribers: plasma-devel, kwin

Tags: KWin

Differential Revision: https://phabricator.kde.org/D2953

Details

Committed
graesslinOct 17 2016, 6:23 AM
Differential Revision
D2953: [tabbox] Intercept QWheelEvents on QQuickWindow for scrolling
Parents
R108:78a2732a9a42: Fix shortcut triggering with shift+letter
Branches
Unknown
Tags
Unknown