Bug 442839 - [wayland] mouse cursor changes away from the theme cursor to adwaita
Summary: [wayland] mouse cursor changes away from the theme cursor to adwaita
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 5.22.90
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-09-23 11:35 UTC by Pawel
Modified: 2023-06-17 05:08 UTC (History)
13 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.27.6


Attachments
adwaita (3.84 KB, image/png)
2021-09-23 11:35 UTC, Pawel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pawel 2021-09-23 11:35:21 UTC
Created attachment 141819 [details]
adwaita

This is a follow up bug from https://bugs.kde.org/show_bug.cgi?id=442539 where a related bug was fixed by Vlad. 

Clicking on a menu item in firefox (92.0) or Thunderbird (91.1.1) makes the mouse cursor to change from the theme cursor selected by the user (in my case breeze) into the adwaita theme cursor. 

I would expect it to remain at the cursor I have selected in the settings - breeze. Executing xsetroot -cursor_name left_ptr resolves this issue. Clicking on a thunderbird/firefox menu item retains the breeze cursor as expected.


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 Vlad Zahorodnii 2021-09-23 15:12:22 UTC
The issue is that the startup sequence looks as follows:

* kwin starts
* xwayland is launched
* kwin sets the cursor for the root window

* plasma starts
* plasma updates various xsettings properties, include the cursor theme

since kwin doesn't monitor xsettings, it continues using its cached xcb_cursor_t.

there are two options:

* monitor xsettings. it's not as trivial as it seems. kwin will need to read and parse xsettings properties
* ignore xsettings and load cursors on our own (we have the infrastructure to do so already). this one should be easier to implement, but not sure if it's 5.23 material.
Comment 2 Vlad Zahorodnii 2021-09-23 15:12:50 UTC
s/include the cursor theme/including the cursor theme/
Comment 3 Vlad Zahorodnii 2021-09-23 15:14:42 UTC
As a (lame) work around, you could enable native wayland support in Thunderbird and Firefox. I've been using both with native wayland support for about a year and they work pretty decently.
Comment 4 Nate Graham 2021-09-24 20:27:46 UTC
Yeah, I have too. Still it probably affects other XWayland apps, right?
Comment 5 Samuel Reddy 2021-10-16 07:36:16 UTC
What about making plasmashell set the cursor for the x root window?
Comment 6 Patrick Silva 2021-12-21 16:29:49 UTC
Can reproduce with these gtk2 Xwayland apps:
asunder audio cd ripper
gimp
grip audio cd ripper
hexchat
isomaster
leafpad text editor
tixati torrent client

Operating System: Arch Linux
KDE Plasma Version: 5.23.4
KDE Frameworks Version: 5.89.0
Qt Version: 5.15.2
Graphics Platform: Wayland
Comment 7 Patrick Silva 2021-12-31 18:20:16 UTC
(In reply to Patrick Silva from comment #6)
> Can reproduce with these gtk2 Xwayland apps:
> asunder audio cd ripper
> gimp
> grip audio cd ripper
> hexchat
> isomaster
> leafpad text editor
> tixati torrent client
> 
> Operating System: Arch Linux
> KDE Plasma Version: 5.23.4
> KDE Frameworks Version: 5.89.0
> Qt Version: 5.15.2
> Graphics Platform: Wayland

Blender running on Xwayland is also affected.
Comment 8 youduda 2022-01-23 22:33:18 UTC
*** Bug 448821 has been marked as a duplicate of this bug. ***
Comment 9 Samuel Reddy 2022-01-24 02:42:50 UTC
Affects games like Minecraft
Comment 10 Patrick Silva 2022-06-07 13:28:11 UTC
*** Bug 454959 has been marked as a duplicate of this bug. ***
Comment 11 Patrick Silva 2022-06-16 00:12:13 UTC
Still an issue.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.25.0
KDE Frameworks Version: 5.95.0
Qt Version: 5.15.4
Graphics Platform: Wayland
Comment 12 tneo 2022-06-21 14:40:13 UTC
This is an issue in X11 as well. My mouse theme changes depending on where it is on the screen. On the desktop it becomes Adwaita, on the application screen it is my selected theme, moving over to the task-bar it turns Adwaita again, hovering an application icon in the task-bar is my selected theme.

Operating System: openSUSE Tumbleweed 20220613
KDE Plasma Version: 5.25.0
KDE Frameworks Version: 5.94.0
Qt Version: 5.15.2
Kernel Version: 5.18.2-1-default (64-bit)
Graphics Platform: X11
Comment 13 Patrick Silva 2022-06-21 14:55:43 UTC
(In reply to tneo from comment #12)
> This is an issue in X11 as well. My mouse theme changes depending on where
> it is on the screen. On the desktop it becomes Adwaita, on the application
> screen it is my selected theme, moving over to the task-bar it turns Adwaita
> again, hovering an application icon in the task-bar is my selected theme.
> 
You are facing a different bug. See bug 382604
Comment 14 tneo 2022-06-21 15:07:25 UTC
Ah. Sorry I had not found that one.
Comment 15 Shmerl 2022-06-26 22:40:52 UTC
The bug description should probably mention XWayland.

I noticed that any XWayland use case simply ignores the cursor theme and uses default.

A very simple test - run xev and notice how cursor changes when hovering over it.
Comment 16 Patrick Silva 2022-08-15 11:20:36 UTC
I'm unable to reproduce on neon unstable.

Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.25.80
KDE Frameworks Version: 5.97.0
Qt Version: 5.15.5
Graphics Platform: Wayland
Comment 17 Patrick Silva 2022-08-15 11:34:36 UTC
Nevermind. If a third-party cursor theme is used, cursor changes to Breeze when I hover over Xwayland apps.
Comment 18 Zesko 2022-09-04 12:28:27 UTC
I confirmed this issue:

The 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.

This is for Wayland, but X11 has no issue.
Comment 19 Zesko 2022-10-10 12:09:44 UTC
(In reply to Zesko from comment #18)
> I confirmed this issue:
> 
> The 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.
> 
> This is for Wayland, but X11 has no issue.

I solved my issue:

1. Check what is the cursor-theme for GTK with root permission:
$ sudo gsettings get org.gnome.desktop.interface cursor-theme" 
The output is "Adwaita"

2. See the list of cursor-themes:
$ find /usr/share/icons  -type d -name "cursors"

You can select any cursor-theme from this list.
3.  You can change "Adwaita" to your cursor-theme e.g: "Breeze_Snow"
$ sudo dbus-launch gsettings set org.gnome.desktop.interface cursor-theme Breeze_Snow

4. Reboot,  that works for me.
Comment 20 Pawel 2022-10-10 12:14:07 UTC
(In reply to Zesko from comment #19)
> (In reply to Zesko from comment #18)
> > I confirmed this issue:
> > 
> > The 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.
> > 
> > This is for Wayland, but X11 has no issue.
> 
> I solved my issue:
> 
> 1. Check what is the cursor-theme for GTK with root permission:
> $ sudo gsettings get org.gnome.desktop.interface cursor-theme" 
> The output is "Adwaita"
> 
> 2. See the list of cursor-themes:
> $ find /usr/share/icons  -type d -name "cursors"
> 
> You can select any cursor-theme from this list.
> 3.  You can change "Adwaita" to your cursor-theme e.g: "Breeze_Snow"
> $ sudo dbus-launch gsettings set org.gnome.desktop.interface cursor-theme
> Breeze_Snow
> 
> 4. Reboot,  that works for me.

this works for me as well - thanks
Comment 21 Patrick Silva 2022-10-10 12:26:21 UTC
(In reply to Zesko from comment #19)
> (In reply to Zesko from comment #18)
> > I confirmed this issue:
> > 
> > The 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.
> > 
> > This is for Wayland, but X11 has no issue.
> 
> I solved my issue:
> 
> 1. Check what is the cursor-theme for GTK with root permission:
> $ sudo gsettings get org.gnome.desktop.interface cursor-theme" 
> The output is "Adwaita"
> 
> 2. See the list of cursor-themes:
> $ find /usr/share/icons  -type d -name "cursors"
> 
> You can select any cursor-theme from this list.
> 3.  You can change "Adwaita" to your cursor-theme e.g: "Breeze_Snow"
> $ sudo dbus-launch gsettings set org.gnome.desktop.interface cursor-theme
> Breeze_Snow
> 
> 4. Reboot,  that works for me.

Your instructions are a workaround, not a fix. Cursors KCM should set the cursor for all apps correctly.
Comment 22 Shmerl 2022-10-11 23:45:25 UTC
And why would root's settings affect user session even in XWayland case? There is clearly some kind of misconfig / disconnect of expectations here.
Comment 23 Shmerl 2022-11-09 04:00:11 UTC
(In reply to Vlad Zahorodnii from comment #1)
> The issue is that the startup sequence looks as follows:
> 
> * kwin starts
> * xwayland is launched
> * kwin sets the cursor for the root window
> 
> * plasma starts
> * plasma updates various xsettings properties, include the cursor theme
> 
> since kwin doesn't monitor xsettings, it continues using its cached
> xcb_cursor_t.
> 

Until there is a fix, is there some config file that sets default global X11 cursor theme statically? That can help avoiding this.
Comment 24 Bug Janitor Service 2022-11-24 20:47:21 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/3239
Comment 25 Vlad Zahorodnii 2023-01-06 11:07:19 UTC

*** This bug has been marked as a duplicate of bug 459468 ***
Comment 26 Vlad Zahorodnii 2023-06-14 14:01:55 UTC
Git commit dc4c463ca36b26ceb25efda7fa25a7c7a906002d by Vlad Zahorodnii, on behalf of Severin von Wnuck.
Committed on 14/06/2023 at 13:37.
Pushed by vladz into branch 'master'.

xwayland: Remove cursor definition

This is now handled by krdb.
Related: bug 459468

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

https://invent.kde.org/plasma/kwin/-/commit/dc4c463ca36b26ceb25efda7fa25a7c7a906002d
Comment 27 Vlad Zahorodnii 2023-06-14 14:50:53 UTC
Git commit fb238b25d126df6f1b7a48ddbdef10b7cc572f60 by Vlad Zahorodnii, on behalf of Severin von Wnuck.
Committed on 14/06/2023 at 14:06.
Pushed by vladz into branch 'Plasma/5.27'.

xwayland: Remove cursor definition

This is now handled by krdb.
Related: bug 459468


(cherry picked from commit dc4c463ca36b26ceb25efda7fa25a7c7a906002d)

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

https://invent.kde.org/plasma/kwin/-/commit/fb238b25d126df6f1b7a48ddbdef10b7cc572f60