You are not logged in.

#1 2025-12-08 13:52:00

tomfi
Member
Registered: 2025-12-08
Posts: 11

[SOLVED] Stuck Cursor under Wayland - Surface Linux and stuck BTN_0

EDIT: the issue came from a problem related to the surface linux kernel. See https://github.com/linux-surface/linux- … ssues/1851

This is to reopen https://bbs.archlinux.org/viewtopic.php?id=293229

Short Summary:
under wayland, the mouse cursor sometimes acts on the "wrong window", i.e. not the window that is in the foreground, but some other window that might not even be visible (i.e. minimized or on another virtual desktop)

I also filed a Bug Report for wayland, as I suspect the issue stems from wayland, see https://gitlab.freedesktop.org/wayland/ … issues/575

If anyone has advice on debugging tools to find out where this issue might come from, I would appreciate it.

Last edited by tomfi (2025-12-10 12:31:29)

Offline

#2 2025-12-08 14:53:42

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,075

Re: [SOLVED] Stuck Cursor under Wayland - Surface Linux and stuck BTN_0

Wayland is a protocol, it defines how things are supposed to work in theory, not how they actually work, the issue will be up to the specific implementation, i.e. KDE's kwin or sway or... The thread linked was a very specific interaction with xwayland, which has gotten fixed.

Do you have a more concrete example? Which exact windows/programs in which exact case (which state, minimized/virtual desktop, xwayland/wayland native) behave how exactly, on which DE/WM? As listed in the old thread there was an actual issue with this back a year ago and FWIW KDE had some annoying focus bugs in 6.5.x up until 6.5.3 where most of those were fixed for me. Speaking of which have you played around with the window/activation/mouse focus options given in

kcmshell6 kwinoptions

whether a specific setting works better for you?

Last edited by V1del (2025-12-08 14:55:03)

Offline

#3 2025-12-08 15:40:23

tomfi
Member
Registered: 2025-12-08
Posts: 11

Re: [SOLVED] Stuck Cursor under Wayland - Surface Linux and stuck BTN_0

V1del wrote:

Wayland is a protocol, it defines how things are supposed to work in theory, not how they actually work, the issue will be up to the specific implementation, i.e. KDE's kwin or sway or... The thread linked was a very specific interaction with xwayland, which has gotten fixed.

Thanks for pointing this out, I am not familiar how all of the components work together and what they do. I assumed since I have the issue both in plasma (wayland) and sway, it's probably not coming from either of those.

V1del wrote:

Do you have a more concrete example? Which exact windows/programs in which exact case (which state, minimized/virtual desktop, xwayland/wayland native) behave how exactly, on which DE/WM?

So far, I had the issue with brave, okular, dolphin and alacritty. I set

for_window [shell=".*"] title_format "%title :: %shell"

in sway to find out if they are xwayland or wayland native, the all show as xdg-shell (wayland native)
I had this in all kinds of state. The cursor acts on a window that is on a different virtual desktop (plasma), the window is minimized (plasma) the window is opened beside the currently focused window (sway)

V1del wrote:

Speaking of which have you played around with the window/activation/mouse focus options given in

kcmshell6 kwinoptions

whether a specific setting works better for you?

I have, changing Window activation policy did not make a difference

Offline

#4 2025-12-08 16:22:04

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,675

Re: [SOLVED] Stuck Cursor under Wayland - Surface Linux and stuck BTN_0

So far, I had the issue with brave, okular, dolphin and alacritty.

Those being the ones that spuriously receive the event or the ones that should but did not get the event?

Online

#5 2025-12-08 16:28:49

tomfi
Member
Registered: 2025-12-08
Posts: 11

Re: [SOLVED] Stuck Cursor under Wayland - Surface Linux and stuck BTN_0

seth wrote:

Those being the ones that spuriously receive the event or the ones that should but did not get the event?

Both, it does not really matter. The mouse cursor "locks onto" one window (I could not so far determine when exactly this happens, I am running a sway session right now that has been fine for over an hour), and no matter what other window I bring into focus (alt tab in plasma or window switching in sway), the cursor still acts on the other window. Only when I touch into the focused into with the touchscreen does the mouse cursor act on the proper, focused window again. And, as I said, as far as I can tell it does not matter what program, at some point of the session the cursor just locks on to a window and does not "let go".

Offline

#6 2025-12-08 16:31:17

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,675

Re: [SOLVED] Stuck Cursor under Wayland - Surface Linux and stuck BTN_0

Only when I touch into the focused into with the touchscreen

Can you disable the touchscreen and test whether this happens w/o it?

Online

#7 2025-12-08 17:14:18

tomfi
Member
Registered: 2025-12-08
Posts: 11

Re: [SOLVED] Stuck Cursor under Wayland - Surface Linux and stuck BTN_0

seth wrote:

Can you disable the touchscreen and test whether this happens w/o it?

I disabled the touchscreen both with a udev rule and in the sway config. The cursor still acts on the wrong window, only now I dont have a way to force the cursor focus to another window anymore (which I did with the touchscreen before)

Offline

#8 2025-12-08 22:02:22

JonnyRobbie
Member
Registered: 2015-04-28
Posts: 172

Re: [SOLVED] Stuck Cursor under Wayland - Surface Linux and stuck BTN_0

I seem to have the same problem. Just updated, and it seems that kwin is extremely confused which window is in focus. Doesn't matter if its firefox, steam, dolphin, keepass, konsole, settings, etc. Mouse events dispatching to window in background, some context dialogs completely nonfunctioning, focus switching gone haywire.
It really feels like a compositor equivalent of videogame-like potion of confusion.
Almost like the window focus has been reversed somehow. Newly opened windows appearing behind blured ones. This completely breakes dropdowns and menus.
It's become completely unusable and extremely hard to multitask, and just pasting below code was a pain. This is a desktop, so no touchscreen or anything.

$ uname -roms;pacman -Qi kwin
Linux 6.17.9-arch1-1 x86_64 GNU/Linux
Name            : kwin
Version         : 6.5.3-2
Description     : An easy to use, but flexible, Wayland compositor
Architecture    : x86_64
URL             : https://kde.org/plasma-desktop/
Licenses        : LGPL-2.0-or-later
Groups          : plasma
Provides        : None
Depends On      : aurorae  breeze  gcc-libs  glibc  plasma-activities  kauth  kcmutils  kcolorscheme  kconfig  kcoreaddons  kcrash
                  kdbusaddons  kdeclarative  kdecoration  kglobalaccel  kglobalacceld  kguiaddons  ki18n  kidletime  kirigami
                  kitemmodels  knewstuff  knighttime  knotifications  kpackage  kquickcharts  kscreenlocker  kservice  ksvg
                  kwayland  kwidgetsaddons  kwindowsystem  kxmlgui  lcms2  libcanberra  libdisplay-info  libdrm  libei  libepoxy
                  libinput  libpipewire  libqaccessibilityclient-qt6  libxcb  libxcvt  libxkbcommon  mesa  pipewire-session-manager
                  libplasma  qt6-5compat  qt6-base  qt6-declarative  qt6-sensors  qt6-svg  qt6-tools  systemd-libs  wayland
                  xcb-util-keysyms  xcb-util-wm
Optional Deps   : plasma-keyboard: virtual keyboard
Required By     : kdeplasma-addons  plasma-workspace
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 29.71 MiB
Packager        : Antonio Rojas <arojas@archlinux.org>
Build Date      : Thu 20 Nov 2025 15:25:42 CET
Install Date    : Mon 08 Dec 2025 22:23:20 CET
Install Reason  : Explicitly installed
Install Script  : Yes
Validated By    : Signature

Last edited by JonnyRobbie (2025-12-08 22:10:29)

Offline

#9 2025-12-08 22:11:36

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,675

Re: [SOLVED] Stuck Cursor under Wayland - Surface Linux and stuck BTN_0

Do you also get this w/ eg. weston? (Apparently the OP faces it w/ kwin and sway)

Also, how to either of you log in? SDDM?
Do you use the X11 backend or some wayland compositor for that?
Do you get this when skipping any DM, boot the multi-user.target only (2nd link below) and the start https://wiki.archlinux.org/title/KDE#From_the_console

Online

#10 2025-12-08 22:18:44

JonnyRobbie
Member
Registered: 2015-04-28
Posts: 172

Re: [SOLVED] Stuck Cursor under Wayland - Surface Linux and stuck BTN_0

I can't try weston - I only have kwin with wayland. SDDM
I'm not sure if steam uses xwayland, but it happens with native wayland windows.
I have not tried skipping dm - I'll try it when I get to it.

EDIT: Weird. After trying to start plasma from command, it looked like that made the problem go away, but then I rebooted normally through SDDM and I still don't have the problem. Maybe it was there once after update? Maybe it's random somehow? I'm not sure. But for now after restart, I can no longer reproduce.

Last edited by JonnyRobbie (2025-12-08 22:27:09)

Offline

#11 2025-12-09 07:57:57

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,675

Re: [SOLVED] Stuck Cursor under Wayland - Surface Linux and stuck BTN_0

I'm not sure if steam uses xwayland, but it happens with native wayland windows.

I wasn't talking about steam, https://wiki.archlinux.org/title/SDDM#Wayland

I can't try weston - I only have kwin with wayland.

https://archlinux.org/packages/extra/x86_64/weston/

Online

#12 2025-12-09 12:04:59

tomfi
Member
Registered: 2025-12-08
Posts: 11

Re: [SOLVED] Stuck Cursor under Wayland - Surface Linux and stuck BTN_0

seth wrote:

Also, how to either of you log in? SDDM?

I use lightdm

seth wrote:

Do you use the X11 backend or some wayland compositor for that?

I have
`#xserver-command=X` in /etc/lightdm/lightdm.conf and `Seat seat0: Creating display server of type x` in /var/log/lightdm/lightdm.log so I suppose X11 backend?

seth wrote:

Do you get this when skipping any DM

I disabled the lightdm service, rebooted and started a sway session. Has been running for multiple hours without any issues, so that might have been it! Thanks!

Offline

#13 2025-12-09 14:50:48

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,675

Re: [SOLVED] Stuck Cursor under Wayland - Surface Linux and stuck BTN_0

lightdm only runs on X11 (SDDM defaults to it) - the problem might be in handing the input control over to the wayland compositor.
Iff you actually want to use a DM (it's not a god-given, you know…) you might want to test SDDM w/ the wayland backend - or GDM, but that will drag in half of gnome.
Alternatively consider a console DM, https://wiki.archlinux.org/title/Display_manager

Online

#14 2025-12-09 16:01:35

tomfi
Member
Registered: 2025-12-08
Posts: 11

Re: [SOLVED] Stuck Cursor under Wayland - Surface Linux and stuck BTN_0

seth wrote:

lightdm only runs on X11 (SDDM defaults to it) - the problem might be in handing the input control over to the wayland compositor.
Iff you actually want to use a DM (it's not a god-given, you know…) you might want to test SDDM w/ the wayland backend - or GDM, but that will drag in half of gnome.

Thanks, I'll maybe give them a try. For now I am really happy I can just use my system again.

Offline

#15 2025-12-09 16:31:38

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,675

Re: [SOLVED] Stuck Cursor under Wayland - Surface Linux and stuck BTN_0

I'm not gonna talk you into using a DM on what's likely a de-facto single user system anyway wink

In case and please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Online

#16 2025-12-09 20:35:55

tekstryder
Member
Registered: 2013-02-14
Posts: 504

Re: [SOLVED] Stuck Cursor under Wayland - Surface Linux and stuck BTN_0

seth wrote:

or GDM, but that will drag in half of gnome.

Hmm... how bad could it be??

~ ❯ sudo pacman -S gdm
resolving dependencies...
looking for conflicting packages...

Package (30)                    New Version  Net Change  Download Size

extra/accountsservice           23.13.9-2      0.97 MiB               
extra/colord                    1.4.8-1        5.12 MiB               
extra/egl-wayland               4:1.1.20-1     0.10 MiB               
extra/geoclue                   2.8.0-1        1.42 MiB       0.21 MiB
extra/gnome-session             49.2-1         1.20 MiB       0.27 MiB
extra/gnome-settings-daemon     49.1-1         5.80 MiB       0.91 MiB
extra/gnome-shell               1:49.2-1      13.91 MiB       1.77 MiB
extra/ibus                      1.5.33-1     113.92 MiB      11.58 MiB
extra/iio-sensor-proxy          3.8-1          0.11 MiB       0.04 MiB
extra/libei                     1.5.0-1        0.39 MiB               
extra/libfontenc                1.1.8-1        0.03 MiB               
extra/libgdm                    49.2-1         1.02 MiB       0.09 MiB
extra/libgusb                   0.4.9-2        0.35 MiB               
extra/libibus                   1.5.33-1       3.57 MiB       0.42 MiB
extra/libnma-common             1.10.6-3       1.07 MiB               
extra/libnma-gtk4               1.10.6-3       0.46 MiB               
extra/libxcvt                   0.1.3-1        0.04 MiB               
extra/libxfont2                 2.0.7-1        0.23 MiB               
extra/mutter                    49.2-1        14.23 MiB       2.73 MiB
extra/python-argcomplete        3.6.2-1        0.31 MiB               
extra/unzip                     6.0-23         0.30 MiB       0.14 MiB
extra/xdg-desktop-portal        1.20.3-2       1.77 MiB               
extra/xdg-desktop-portal-gnome  49.0-1         0.89 MiB       0.21 MiB
extra/xdg-desktop-portal-gtk    1.15.3-1       0.42 MiB               
extra/xorg-fonts-encodings      1.1.0-1        0.61 MiB               
extra/xorg-server-common        21.1.21-1      0.12 MiB               
extra/xorg-setxkbmap            1.3.4-2        0.03 MiB               
extra/xorg-xkbcomp              1.5.0-1        0.21 MiB               
extra/xorg-xwayland             24.1.9-1       2.25 MiB               
extra/gdm                       49.2-1         5.12 MiB       0.84 MiB

Total Download Size:    19.21 MiB
Total Installed Size:  175.96 MiB

:: Proceed with installation? [Y/n] n

Ah.

Offline

#17 2025-12-10 07:37:44

tomfi
Member
Registered: 2025-12-08
Posts: 11

Re: [SOLVED] Stuck Cursor under Wayland - Surface Linux and stuck BTN_0

tomfi wrote:

I disabled the lightdm service, rebooted and started a sway session. Has been running for multiple hours without any issues, so that might have been it!

It wasn't... Booted today without a DM, immediately after boot I have the same problem again on sway

Offline

#18 2025-12-10 09:10:13

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,675

Re: [SOLVED] Stuck Cursor under Wayland - Surface Linux and stuck BTN_0

Are you scaling the output?

Online

#19 2025-12-10 09:49:40

tomfi
Member
Registered: 2025-12-08
Posts: 11

Re: [SOLVED] Stuck Cursor under Wayland - Surface Linux and stuck BTN_0

seth wrote:

Are you scaling the output?

It happens both with fractional scaling to 1.8 and no scaling

Offline

#20 2025-12-10 09:52:21

tomfi
Member
Registered: 2025-12-08
Posts: 11

Re: [SOLVED] Stuck Cursor under Wayland - Surface Linux and stuck BTN_0

I finally found a reliable trigger: Pressing the "Print" button. At first I thought the screenshot tool was responsible because pressing "Print" triggers a screenshot. But under sway I disabled all bindings to the Print button and pressing Print still triggers this Bug.

So: I login, everything is fine. I press print. Immediately, the weird cursor behavior starts.

This is the case both on plasma wayland and on sway.

I think there must be other triggers because I don't think I took a screenshot every time this occured.

In https://gitlab.freedesktop.org/wayland/ … te_3229782 Someone mentioned that "Ideally there should be a compositor hotkey to break grabs in order to recover from misbehaving applications". I think the Print button does exactly this. When the cursor is locked to window A, the mouse only acts on window A even when window B is in the foreground. But when I press Print again, the cursor focus is pulled to window B and acts an window B even when I put window A in the foreground

Last edited by tomfi (2025-12-10 09:55:00)

Offline

#21 2025-12-10 12:28:17

tomfi
Member
Registered: 2025-12-08
Posts: 11

Re: [SOLVED] Stuck Cursor under Wayland - Surface Linux and stuck BTN_0

Finally I found out whats going on. It is not the Print button in itself. Every time I hit "Print" on my built in keyboard, I also hit FN.
Using libinput debug-events --show-keycodes and evtest I found out that the FN button of my built in keyboard (surface typecover) spams BTN_0 as a HID event 30 times a second. That's what pulled the focus. I found an issue describing exactly this in the surface linux repository https://github.com/linux-surface/linux- … ssues/1851. The linked issue also explains why this does not affect plasma x11:

X11 and GNOME Wayland handle stuck button events more gracefully. KWin Wayland's focus tracking is more sensitive to input flooding.

So this (hopefully) finally solves this for me. Just by leaving FN Lock on (so pressing F8 triggers Print or more specifically KEY_SYSRQ), the system behaves completely normal (so far).

Last edited by tomfi (2025-12-10 12:32:41)

Offline

Board footer

Powered by FluxBB