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

            Bug ID: 524810
           Summary: On a Surface Pro 7+ using KDE Plasma on Wayland, an
                    absolute stylus shows the normal mouse cursor whenever
                    the pen enters proximity.  I traced this to KWin's
                    HideCursorSpy::tabletToolProximityEvent() logic and
                    have a small working patch.
    Classification: Plasma
           Product: kwin
      Version First 6.6.4
       Reported In:
          Platform: Fedora RPMs
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: input
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
  Target Milestone: ---

Created attachment 195506
  --> https://bugs.kde.org/attachment.cgi?id=195506&action=edit
Patch to hide the mouse cursor when an absolute tablet/stylus enters proximity,
while preserving normal cursor behaviour for relative tablet tools and real
mice. Tested successfully on a Surface Pro 7

Environment
Microsoft Surface Pro 7+
Fedora 44
KDE Plasma / Wayland
KWin 6.6.4
linux-surface kernel 6.19.8-3.surface.fc43.x86_64
IPTSD 3.1.0-1.fc43.x86_64
Current KWin behaviour

In src/hide_cursor_spy.cpp:

void HideCursorSpy::tabletToolProximityEvent(TabletToolProximityEvent *event)
{
    if (event->type == TabletToolProximityEvent::Type::LeaveProximity) {
        if (!event->device->tabletToolIsRelative()) {
            hideCursor();
        }
    } else {
        showCursor();
    }
}

Entering proximity therefore always calls showCursor(), including for an
absolute tablet/stylus device.

Proposed behaviour

Absolute tablet tools should hide the mouse cursor while in proximity, while
relative tablet tools should retain the current mouse-cursor behaviour.

I changed the function to:

void HideCursorSpy::tabletToolProximityEvent(TabletToolProximityEvent *event)
{
    if (event->type == TabletToolProximityEvent::Type::LeaveProximity) {
        if (!event->device->tabletToolIsRelative()) {
            hideCursor();
        }
    } else {
        if (!event->device->tabletToolIsRelative()) {
            hideCursor();
        } else {
            showCursor();
        }
    }
}
Test result

I rebuilt KWin with this change and tested it on the Surface Pro 7+.

The resulting behaviour is:

Absolute stylus enters proximity → cursor hidden
Pen tip works normally
Pen button/right-click works normally
Moving a real mouse restores the normal mouse cursor
Bringing the stylus back into proximity hides the cursor again
Reapplying KDE Drawing Tablet mappings does not restore the unwanted cursor
Behaviour works both with and without an external keyboard/mouse attached

I have attached the source patch:

0001-hide-absolute-tablet-cursor.patch

The change has been stable in normal use.

I initially reported this to linux-surface because Surface users using IPTSD
are likely to encounter it, but the behaviour itself appears to be implemented
entirely in KWin.

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

Reply via email to