libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
9.89k stars 1.78k forks source link

Tiny mouse cursor in the app window with 125% fractional scaling enabled in Wayland #16679

Open archerallstars opened 1 month ago

archerallstars commented 1 month ago

First and foremost consider this:

Description

The mouse cursor is tiny with 125% fractional scaling enabled in Wayland session, as shown in the screen recording below:

https://github.com/libretro/RetroArch/assets/1403194/5a6b35d8-f6cf-4abc-91e7-2cccc435c6d9

I tried setting XCURSOR_THEME=Adwaita and XCURSOR_SIZE=32 environment variables to match my system setting, but it doesn't work.

*This issue is not occurring if I force the app to run in XWayland mode.

**This issue is not occurring under Wayland in fullscreen mode, as shown in the screenshot below, but the cursor theme is not matching with the system:

ssssssss

Expected behavior

The mouse cursor scale correctly in Wayland with fractional scaled display.

Actual behavior

The mouse cursor doesn't scale correctly under Wayland with fractional scaled display, and also doesn't respect XCURSOR_SIZE environment variable.

Steps to reproduce the bug

  1. Using Wayland.
  2. Enable fractional scaling.
  3. Open the app in native Wayland mode. See the tiny cursor inside the app window.

Bisect Results

I just start using RetroArch today on PC (usually on my Android box). I am not sure when this happened.

But running the app in verbose mode gives me 2 Wayland related info:

[INFO] [Wayland]: Compositor doesn't support zxdg_decoration_manager_v1 protocol
[INFO] [Wayland]: fractional_scale_v1 enabled

Version/Commit

I install the app from Flathub.

Environment information

ColinKinloch commented 1 month ago

Ah, interesting. I can reproduce this, it doesn't seem to be a fractional scaling issue. In Gnome settings Accessibility > Seeing > Cursor Size to larger than default.

Screencast from 2024-06-12 16-16-59.webm

ColinKinloch commented 1 month ago

libdecor has some code for getting the desktops cursor theme and size. Unfortunately it's part of the internal API. Once we have that info we need to request a big enough cursor buffer with wl_cursor_theme_load. Then scale it with wl_surface_set_buffer_scale or wp_viewporter. https://gitlab.freedesktop.org/libdecor/libdecor/-/blob/c2bd8ad6fa42c0cb17553ce77ad8a87d1f543b1f/src/desktop-settings.c#L122