Mouse Cursor Being Cropped on Sway with HiDPI Scaling
Edit: Cropping happens when the cursor exceeds a certain size and is not tied to any specific scaling factor. See comment below.
Describe the bug
When running Rnote inside Sway with HiDPI scaling set to anything higher than 1.75 (like 1.9 and 2), the cursor is being cropped in proportion how much it exceeds 1.75, with values over 2 making the cursor completely invisible.
It might be worth mentioning that when I used grim -c to take screenshots of the mouse cursor, it seemed to have temporarily fixed the issue until I "refreshed" its state by moving it outside the canvas and then bringing it back inside which produced the same cropped cursor. That is why the screenshots below are taken by my phone.
To Reproduce
Steps to reproduce the behavior:
- Set fractional scaling to a value above 1.75 (e.g.
swaymsg 'output * scale 2' - Open Rnote
- Place the mouse cursor on the canvas
Expected behavior
Mouse cursor with HiDPI scaling over 1.75 should be displayed without any cropping similar to how it is shown with HiDPI scaling less than or equal to 1.75.
Console Output
$ flatpak --env=RUST_LOG=rnote=debug --env=RUST_BACKTRACE=1 run com.github.flxzt.rnote
0.000137229s DEBUG rnote: .. tracing subscriber initialized.
MESA-INTEL: warning: ../src/intel/vulkan/anv_formats.c:949: FINISHME: support YUV colorspace with DRM format modifiers
MESA-INTEL: warning: ../src/intel/vulkan/anv_formats.c:981: FINISHME: support more multi-planar formats with DRM modifiers
(rnote:2): Gtk-WARNING **: 11:41:26.919: Creating a portal monitor failed: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.portal.Inhibit” on object at path /org/freedesktop/portal/desktop
Screenshots
HiDPI scaling set to 1.75:
HiDPI scaling set to 1.9:
HiDPI scaling set to 2:
However, the cursor seems to be fine outside the canvas:
Desktop (please complete the following information):
- OS: Fedora 41
- App Version: Rnote v0.13.1
- Installation Source: Flatpak
- Desktop Environment: Sway
- Display Server: Wayland
- Input Source: Mouse and XP-Pen Tablet
Testing with other cursor shapes, they start being cropped at different scaling factors. So I think there isn't anything special about 1.75.
I can't reproduce on KDE, though the cursor doesn't feel hidpi
It might be worth mentioning that when I used grim -c to take screenshots of the mouse cursor, it seemed to have temporarily fixed the issue until I "refreshed" its state by moving it outside the canvas and then bringing it back inside which produced the same cropped cursor. That is why the screenshots below are taken by my phone.
This makes me think this is related to gpu-related optimizations (damage tracking from a frame to another, whereas the screenshot will trigger a full refresh).
On the gtk side, we're using https://docs.gtk.org/gdk4/ctor.Cursor.new_from_texture.html for the cursor.
There might be better things on more recent versions with svg (maybe possible from the rust code) ? see https://gitlab.gnome.org/GNOME/gtk/-/blob/main/demos/gtk-demo/cursors.c?ref_type=heads
So this may be a compositor bug (or a gtk4 one ?). Better report this on sway and/or gtk4