Bug 501215 - Mouse mark is not drawing smooth lines under X11
Summary: Mouse mark is not drawing smooth lines under X11
Status: RESOLVED NOT A BUG
Alias: None
Product: kwin
Classification: Plasma
Component: effects-various (other bugs)
Version First Reported In: 6.3.0
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: X11-only
Depends on:
Blocks:
 
Reported: 2025-03-08 07:18 UTC by A. Ismail
Modified: 2025-10-23 05:43 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Debian swirl drawn using mouse mark under Plasma 6 (12.38 KB, image/png)
2025-03-08 07:18 UTC, A. Ismail
Details

Note You need to log in before you can comment on or make changes to this bug.
Description A. Ismail 2025-03-08 07:18:19 UTC
Created attachment 179218 [details]
Debian swirl drawn using mouse mark under Plasma 6

SUMMARY

When using the mouse mark effect under X11, the line drawn is not smooth at all, as if the mouse position sample rate is too low to create a proper smooth line like it used to. This problem does not exist for Wayland.

I noticed also that the small icon that appears under the cursor when opening an application doesn't move around smoothly with the mouse, it is probably related to this bug.

STEPS TO REPRODUCE
1. Enable the mouse mark desktop effect
2. Try to draw anything with it relatively quickly and with curves

OBSERVED RESULT
The curve looks like a polyline with sharp edges

EXPECTED RESULT
The curve should be smooth.


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Debian 13 (trixie/testing)
KDE Plasma Version: 6.3.0
KDE Frameworks Version: 6.11.0
Qt Version: 6.7.2

ADDITIONAL INFORMATION

This issue didn't occur with Plasma 5, it started with the upgrade to Plasma 6.
Comment 1 A. Ismail 2025-10-12 10:41:28 UTC
After investigating the bug this weekend, I found the problem:

In file https://invent.kde.org/plasma/kwin-x11/-/blob/master/src/backends/x11/standalone/x11_standalone_cursor.cpp :
```
X11Cursor::X11Cursor(bool xInputSupport)
    : Cursor()
    , m_buttonMask(0)
    , m_hasXInput(xInputSupport)
{
    Cursors::self()->setMouse(this);
    if (!m_hasXInput) {
        // without XInput we don't get events about cursor movement, so we have to poll instead
        connect(&m_mousePollingTimer, &QTimer::timeout, this, &X11Cursor::pollMouse);
        m_mousePollingTimer.setSingleShot(false);
        m_mousePollingTimer.setInterval(50);
        m_mousePollingTimer.start();
    }
    if (Xcb::Extensions::self()->isFixesAvailable()) {
        xcb_xfixes_select_cursor_input(connection(), rootWindow(), XCB_XFIXES_CURSOR_NOTIFY_MASK_DISPLAY_CURSOR);
    }

#ifndef KCMRULES
    connect(kwinApp(), &Application::workspaceCreated, this, [this]() {
        if (Xcb::Extensions::self()->isFixesAvailable()) {
            m_xfixesFilter = std::make_unique<XFixesCursorEventFilter>(this);
        }
    });
#endif
}
```
From what I understood, if Xinput doesn't exist, the cursor position is polled regularly. I reduced the polling timeout to 20ms instead of 50ms and lines are now much smoother again. This implies that for some reason Xinput is not working/detected?

Can you as a workaround use a higher polling rate (like 8ms) to keep Plasma looking smooth? I found that this polling rate affects the mouseChanged() signal so it makes any compositor effect (like mouse mark, startup feedback...) relying on it appear laggy.
Comment 2 Zamundaaa 2025-10-17 10:21:46 UTC
Figuring out why Xinput isn't being detected for you would be better, but as a workaround I guess it wouldn't be too bad to reduce the interval. Feel free to make a MR changing it
Comment 3 A. Ismail 2025-10-17 10:36:48 UTC
(In reply to Zamundaaa from comment #2)
> Figuring out why Xinput isn't being detected for you would be better, but as
> a workaround I guess it wouldn't be too bad to reduce the interval. Feel
> free to make a MR changing it

I may try to investigate why Xinput isn't working, but it may take a while since I'm not familiar with GUI development in general, let alone X11.
Comment 4 A. Ismail 2025-10-22 18:10:24 UTC
I discovered(In reply to Zamundaaa from comment #2)
> Figuring out why Xinput isn't being detected for you would be better, but as
> a workaround I guess it wouldn't be too bad to reduce the interval. Feel
> free to make a MR changing it

While digging for the root cause, I found out that I can't place a breakpoint using GDB in the file https://invent.kde.org/plasma/kwin-x11/-/blob/master/src/backends/x11/standalone/x11_standalone_xinputintegration.cpp
But I can do in most other files (not a debug symbol issue). It turns out that CMake is the culprit. When investigating its logs I found the following message:

-- The following features have been disabled:

 * XInput, Required for poll-free mouse cursor updates

I'm not sure why CMake is failing to detect XInput, even when I'm sure it exists on my system. As a hack I forced CMake to act as if it detected XInput but now compilation fails due to some warnings: one of them is related to an uninitialized value when setting capsLock or numLock state, other warnings were about some QT functions being depreciated.
Comment 5 A. Ismail 2025-10-23 05:43:06 UTC
I will close this bug as it turned out to be a Debian specific issue.