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

            Bug ID: 526317
           Summary: WheelHandler: Alt+wheel scrolls vertically on Wayland
                    because Qt now swaps the axes too
    Classification: Frameworks and Libraries
           Product: frameworks-kirigami
      Version First unspecified
       Reported In:
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
  Target Milestone: Not decided

On Wayland, Alt+wheel over a Kirigami-handled scroll view scrolls vertically
instead of horizontally. This affects any Qt Quick Controls ScrollView in the
org.kde.desktop style, whose Kirigami.WheelHandler scrolls the flickable.
Shift+wheel pages vertically, as intended.

The axes are swapped twice:

1. Since QTBUG-124807 (qtwayland commit a1452b95f7, "Make wheel operations
compatible with xcb"; in Qt 6.8 and backported to 6.7.2, 6.5.6, 6.2.13 and
5.15.18), Qt's Wayland platform plugin swaps angleDelta and pixelDelta when Alt
is held, as the xcb plugin always has.
2. WheelHandler::scrollFlickable (src/wheelhandler.cpp, around line 538 in
6.30.0) swaps them again when Alt is held. It only skips that on xcb:

// HACK: Only transpose deltas when not using xcb in order to not conflict with
xcb's own delta transposing
if (modifiers & m_defaultHorizontalScrollModifiers && qGuiApp->platformName()
!= QLatin1String("xcb")) {

On Wayland the event arrives already sideways, and the handler turns it back to
vertical.

Steps to reproduce:

1. In a Wayland session, run this with QT_QUICK_CONTROLS_STYLE=org.kde.desktop
qml6 test.qml:

import QtQuick
import QtQuick.Controls

ApplicationWindow {
    width: 400; height: 300; visible: true
    ScrollView {
        anchors.fill: parent
        Flickable {
            contentWidth: 2000; contentHeight: 2000
            Grid {
                columns: 20
                Repeater { model: 400; Rectangle { width: 100; height: 100;
color: index % 2 ? "steelblue" : "lightgray" } }
            }
        }
    }
}

2. Scroll with the wheel while holding Alt.

Observed: the content scrolls vertically.
Expected: it scrolls horizontally, as it does with the xcb platform and in Qt
Widgets apps on Wayland.

Logging the QWheelEvents the window receives shows a plain notch arriving as
angleDelta (0, -180), and with Alt held as (-180, 0) with AltModifier set, so
Qt has already swapped it. I got the same result under a nested KWin (input
sent through org_kde_kwin_fake_input) and under sway, so it doesn't depend on
the compositor.

Suggested fix: also skip the swap on Wayland (platformName() starting with
"wayland") when running on a Qt that has the QTBUG-124807 fix.

Versions: Kirigami 6.30.0, qqc2-desktop-style 6.30.0, Qt 6.11.2, KWin (nested,
--virtual) and sway 1.x, Arch Linux.

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

Reply via email to