Bug 442539 - [Wayland] mouse cursor turns into X in GTK and SDL apps running through XWayland
Summary: [Wayland] mouse cursor turns into X in GTK and SDL apps running through XWayland
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 5.22.90
Platform: Arch Linux Linux
: HI normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2021-09-16 15:58 UTC by Pawel
Modified: 2022-09-04 13:16 UTC (History)
11 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
thunderbird (4.63 KB, image/png)
2021-09-16 15:58 UTC, Pawel
Details
awdaita (3.84 KB, image/png)
2021-09-23 10:22 UTC, Pawel
Details
breeze (4.41 KB, image/png)
2021-09-23 10:23 UTC, Pawel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pawel 2021-09-16 15:58:51 UTC
Created attachment 141603 [details]
thunderbird

After upgrading to plasma 5.22.90 on Arch linux, I have noticed that whenever I click on any menu item in a GTK app (firefox, thunderbird, vmWare Horizon Client), the cursor turns into an black X.

It's the left mouse button click that triggers this change.

I have attached a screenshot.

Operating System: Arch Linux
KDE Plasma Version: 5.22.90
KDE Frameworks Version: 5.86.0
Qt Version: 5.15.2
Kernel Version: 5.13.0-1-amd-staging-drm-next-git-00935-gb44d240c34d2 (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 3700X 8-Core Processor
Memory: 31.3 GiB of RAM
Graphics Processor: AMD Radeon RX 5700 XT
Comment 1 Pawel 2021-09-16 16:05:07 UTC
I cannot reproduce on X11. Seems to be fine there.
Comment 2 Nate Graham 2021-09-16 18:35:56 UTC
Can reproduce on Wayland. Happens to me in an SDL app too (Endless Sky, a FOSS space game)
Comment 3 Patrick Silva 2021-09-17 00:13:13 UTC
Reproducible on neon unstable with Audacity and Deluge installed from flathub.
Comment 4 Contijn Buijs 2021-09-17 06:30:36 UTC
Happens to me as well with the NoiseTorch app, when I am on that window, I see the X. I am also on Wayland.

I also see the X when I press the 3 dot menu in Google Chrome.
Comment 5 Zamundaaa 2021-09-17 07:53:42 UTC
Can confirm. AFAICT this only affects stuff running through Xwayland, and only some apps and even sometimes only some surfaces of an app are affected. In xournal++ for example the canvas has the correct cursor, toolbars and menus have the X.
Comment 6 Lewis Lakerink 2021-09-20 20:08:11 UTC
+1 for me as well. Games such as factorio only have the X cursor in Xwayland.
Comment 7 Samuel Reddy 2021-09-23 02:39:26 UTC
Running this command seems to fix the problem, but you have to do this everytime at login:

xsetroot -cursor_name left_ptr
Comment 8 Bug Janitor Service 2021-09-23 09:04:06 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/1454
Comment 9 Pawel 2021-09-23 09:17:23 UTC
the above MR resolves the issue only partially. Clicking on menu items in thunder bird still changes the cursor into X, as per the screenshot I attached in the original report. 

executing xsetroot -cursor_name left_ptr resolves the issue *fully*. so there must be a difference somewhere still.
Comment 10 Vlad Zahorodnii 2021-09-23 09:28:49 UTC
Thanks for testing the patch. I've changed BUG to CCBUG. It seems like we still need to change the cursor shape on the root window after all..
Comment 11 Vlad Zahorodnii 2021-09-23 09:41:24 UTC
@Pawel can you please re-test the merge request again? (make sure that you have "wayland: Set default cursor shape for the root window" commit)
Comment 12 Pawel 2021-09-23 10:22:48 UTC
Created attachment 141816 [details]
awdaita

Hi Vlad,

I have made sure to apply this commit as well now and the situation has slightly improved: instead of an X, the cursor now changes into what I think is the default, adwaita cursor. I would expect it to remain at the cursor I have selected in the settings - breeze.

See attached screenshots.
Comment 13 Pawel 2021-09-23 10:23:04 UTC
Created attachment 141817 [details]
breeze
Comment 14 Pawel 2021-09-23 10:24:59 UTC
and again, executing xsetroot -cursor_name left_ptr resolves this as well. Clicking on a thunderbird menu item retains the breeze cursor
Comment 15 Vlad Zahorodnii 2021-09-23 11:25:02 UTC
(In reply to Pawel from comment #12)
> Created attachment 141816 [details]
> awdaita
> 
> Hi Vlad,
> 
> I have made sure to apply this commit as well now and the situation has
> slightly improved: instead of an X, the cursor now changes into what I think
> is the default, adwaita cursor. I would expect it to remain at the cursor I
> have selected in the settings - breeze.

I've just booted in Plasma 5.22 and I see the same issue. Please file a new bug report as putting new issues in the same bug report makes it harder to keep track of what has regressed in 5.23.
Comment 16 Pawel 2021-09-23 11:35:42 UTC
sure np. here: https://bugs.kde.org/show_bug.cgi?id=442839
Comment 17 Nate Graham 2021-09-23 13:54:07 UTC
Git commit ca1c72dd16699a5b8250e235f27e67f0f78adae9 by Nate Graham, on behalf of Vlad Zahorodnii.
Committed on 23/09/2021 at 13:52.
Pushed by ngraham into branch 'master'.

wayland: Fix cross cursor in Xwayland apps

Startup code in plasmashell was changed so xsetroot is not called
anymore, which is sort of fine.

Unfortunately (or not?), it exposed a bug in kwin. Cursor::x11Cursor()
only works in the standalone X11 session.

On Wayland, Cursor::x11Cursor() will return XCB_NONE which results in
seeing cross cursor when there should be arrow cursor.

This change moves xcb_cursor_t look up code from X11Cursor to the base
Cursor class. In hindsight, I would like to introduce a window manager
class where the xcb cursor and other x11 specific code can be moved in
the future for better encapsulation of platform-specific code.

M  +2    -0    autotests/CMakeLists.txt
M  +1    -0    src/CMakeLists.txt
M  +35   -14   src/cursor.cpp
M  +1    -12   src/cursor.h
M  +1    -1    src/plugins/platforms/x11/standalone/CMakeLists.txt
M  +0    -44   src/plugins/platforms/x11/standalone/x11cursor.cpp
M  +0    -4    src/plugins/platforms/x11/standalone/x11cursor.h

https://invent.kde.org/plasma/kwin/commit/ca1c72dd16699a5b8250e235f27e67f0f78adae9
Comment 18 Nate Graham 2021-09-23 13:54:15 UTC
Git commit 966a95e5fdfeeaf0044bd1a2fd0fe0862332ec63 by Nate Graham, on behalf of Vlad Zahorodnii.
Committed on 23/09/2021 at 13:52.
Pushed by ngraham into branch 'master'.

wayland: Set default cursor shape for the root window

Previously, it was done by plasmashell, now it needs to be done by kwin.

M  +6    -0    src/xwl/xwayland.cpp

https://invent.kde.org/plasma/kwin/commit/966a95e5fdfeeaf0044bd1a2fd0fe0862332ec63
Comment 19 Nate Graham 2021-09-23 13:54:49 UTC
Git commit ab234fa25dfef4181a48a704e3b0d9c62aa80185 by Nate Graham, on behalf of Vlad Zahorodnii.
Committed on 23/09/2021 at 13:54.
Pushed by ngraham into branch 'Plasma/5.23'.

wayland: Fix cross cursor in Xwayland apps

Startup code in plasmashell was changed so xsetroot is not called
anymore, which is sort of fine.

Unfortunately (or not?), it exposed a bug in kwin. Cursor::x11Cursor()
only works in the standalone X11 session.

On Wayland, Cursor::x11Cursor() will return XCB_NONE which results in
seeing cross cursor when there should be arrow cursor.

This change moves xcb_cursor_t look up code from X11Cursor to the base
Cursor class. In hindsight, I would like to introduce a window manager
class where the xcb cursor and other x11 specific code can be moved in
the future for better encapsulation of platform-specific code.


(cherry picked from commit ca1c72dd16699a5b8250e235f27e67f0f78adae9)

M  +2    -0    autotests/CMakeLists.txt
M  +1    -0    src/CMakeLists.txt
M  +35   -14   src/cursor.cpp
M  +1    -12   src/cursor.h
M  +1    -1    src/plugins/platforms/x11/standalone/CMakeLists.txt
M  +0    -44   src/plugins/platforms/x11/standalone/x11cursor.cpp
M  +0    -4    src/plugins/platforms/x11/standalone/x11cursor.h

https://invent.kde.org/plasma/kwin/commit/ab234fa25dfef4181a48a704e3b0d9c62aa80185
Comment 20 Nate Graham 2021-09-23 13:54:59 UTC
Git commit 3f5d8a94b190bcc033f004f72b18389423ba130e by Nate Graham, on behalf of Vlad Zahorodnii.
Committed on 23/09/2021 at 13:54.
Pushed by ngraham into branch 'Plasma/5.23'.

wayland: Set default cursor shape for the root window

Previously, it was done by plasmashell, now it needs to be done by kwin.


(cherry picked from commit 966a95e5fdfeeaf0044bd1a2fd0fe0862332ec63)

M  +6    -0    src/xwl/xwayland.cpp

https://invent.kde.org/plasma/kwin/commit/3f5d8a94b190bcc033f004f72b18389423ba130e
Comment 21 gudvinr+kde 2021-10-24 21:37:27 UTC
I am not sure if it's fixed. When I start SDL-based game from Steam, it shows black cursor (from Adwaita theme) but when game is loaded I see breeze cursor.
Comment 22 Zesko 2022-09-04 09:57:00 UTC
There is a new issue:

mouse cursor turns into black "Adwaita theme" in any GTK app (for example: snapper-gui,  pamac-manager) when using root permission in Wayland or XWayland.

Try to run "kdesu snapper-gui" to show wrong cursor theme.

It works fine without using root permission, but it does not work with root permission.
Comment 23 Patrick Silva 2022-09-04 11:50:05 UTC
(In reply to Zesko from comment #22)
> There is a new issue:
> 
> mouse cursor turns into black "Adwaita theme" in any GTK app (for example:
> snapper-gui,  pamac-manager) when using root permission in Wayland or
> XWayland.
> 
> Try to run "kdesu snapper-gui" to show wrong cursor theme.
> 
> It works fine without using root permission, but it does not work with root
> permission.

Possibly you are facing bug 442839
Comment 24 Zesko 2022-09-04 12:25:57 UTC
> Possibly you are facing bug 442839


Thanks, I report it in 442839
Comment 25 Nate Graham 2022-09-04 13:16:45 UTC
> There is a new issue:

This means you should file a new bug report, not re-open an existing one. :)