Bug 493583

Summary: Excessive Cursor Size in GTK4 Applications on KDE Plasma 6 Under Wayland with Scaling Above 100%
Product: [I don't know] kde Reporter: reiokorn
Component: generalAssignee: Unassigned bugs mailing-list <unassigned-bugs>
Status: RESOLVED UPSTREAM    
Severity: normal CC: ad.liu.jin, cwo.kde, dobrovvvvvvvv, jgqehj55, sbarnard86
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description reiokorn 2024-09-24 12:18:35 UTC
STEPS TO REPRODUCE
1. Set display scaling to above 100% (e.g., 150%) in KDE Plasma settings on a Wayland session.
2. Launch the Bottles/ProtonPlus/Alpaca application (and possibly others).
3. Observe the cursor size within the GUI.

OBSERVED RESULT
The cursor size within the application's GUI becomes excessively large when hovering over it, disrupting the user experience. This issue occurs only under Wayland with scaling settings above 100%, including integer scaling factors like 200%.

EXPECTED RESULT
The cursor should maintain a consistent and appropriate size relative to other GUI elements within the application, regardless of the display scaling factor.

SOFTWARE/OS VERSIONS

    Operating System: openSUSE Tumbleweed 20240922
    KDE Plasma Version: 6.1.5
    KDE Frameworks Version: 6.6.0
    Qt Version: 6.7.2
    Kernel Version: 6.10.11-1-default (64-bit)
    Graphics Platform: Wayland
    Processors: 16 × AMD Ryzen 7 7800X3D 8-Core Processor
    Memory: 30.5 GiB of RAM
    Graphics Processor: AMD Radeon RX 7900 XTX
    Manufacturer: Gigabyte Technology Co., Ltd.
    Product Name: B650 GAMING X AX

ADDITIONAL INFORMATION
- Context: The issue persists even with integer scaling factors (e.g., 200%). When using a 150% scaling factor, the cursor size becomes disproportionately large within GTK4 applications like Bottles.
- Terminal Output:
  (bottles:9894): Gdk-WARNING **: 19:28:34.137: ../gdk/wayland/gdkcursor-wayland.c:210 cursor image size (32) not an integer multiple of theme size (24)

This warning appears multiple times with varying cursor image sizes.

Logs and Attachments:
If additional logs or diagnostic information are required, please let me know, and I can provide them promptly.

Notes:
- The issue does not occur when scaling is set to 100%.
- The problem is specific to GTK4 applications under Wayland with scaling enabled.
- Similar warnings are present even at 100% scaling, though the cursor size issue is more pronounced above 100%.

Please let me know if you need any further information or assistance in diagnosing this issue. Thank you for your attention to this matter!
Comment 1 cwo 2024-09-24 16:03:17 UTC
Thank you for the detailed bug report!

Unfortunately, gtk does not support the cursor-shape-v1 Wayland protocol yet, which should solve this. For more information see this gtk issue and the links there: https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/6212

There are some hacks that you can try, for example here: https://www.reddit.com/r/kde/comments/133dkad/gtk_mouse_scaling_on_wayland/

It may also help to use a cursor theme with a lot of sizes available, in case you're using something other than breeze.

*** This bug has been marked as a duplicate of bug 451158 ***
Comment 2 Jin Liu 2024-09-24 16:17:15 UTC
This is actually a GTK4 bug/regression. It's triggered when you have global scaling AND a cursor theme with "nominal size" (the size you choose in the Cursor Theme KCM) different from image sizes.

E.g. if you run `xcursor-viewer /usr/share/icons/breeze_cursors/cursors/`, you'll see info like "Nominal size: 24. Image size: 32x32.".

But for `xcursor-viewer /usr/share/icons/Adwaita/cursors/`, it will be "Nominal size: 24. Image size: 24x24.".

So it can be worked around by using a cursor theme like Adwaita.

I've already submitted the fix, but it hasn't been merged yet:

https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/7722

So I'll change this to UPSTREAM, as this doesn't really require `wayland/cursor-shape-v1` to fix. And it worked in GTK 4.14. It's a recent regression in their code.
Comment 3 Filip 2024-11-08 07:43:28 UTC
*** Bug 495951 has been marked as a duplicate of this bug. ***
Comment 4 Filip 2024-11-08 18:09:41 UTC
*** Bug 495965 has been marked as a duplicate of this bug. ***
Comment 5 Filip 2024-11-30 09:34:20 UTC
*** Bug 496856 has been marked as a duplicate of this bug. ***