Rough proposal for a cursor-geometry protocol
Jonas Ådahl
jadahl at gmail.com
Fri Dec 20 09:05:35 UTC 2024
On Fri, Dec 20, 2024 at 01:07:27PM +1100, Campbell Barton wrote:
> Hi, I've been maintaining Blender's Wayland integration and have run into
> issues with cursor size being too big/small.
>
> At first I thought it could be overlooked (treated as more of a glitch),
> however in the worst case this is an accessibility issue, one user for
> example found the cursor was so small it was difficult to see in their
> system [0].
>
> Furthermore, as a user of wayland I notice my cursor changing size all the
> time - it seems each window has a different method of calculating
> the cursor size, so moving the cursor between applications will show
> at a different size for each.
>
> Note that the cursor-shape-v1 API is good, but doesn't solve the problem
> when the application defines custom-cursors.
>
> Currently we face the problem that there is no way to know the cursor
> theme/size ... or (a lesser problem) when these are re-configured/modified
> at run-time.
>
> Existing partial solutions:
>
> - Use environment variables XCURSOR_THEME / XCURSOR_SIZE,
> while these "work", it relies on technical users to
> manipulate their environment variables values.
>
> - Use DBUS to access common settings used by GNOME/KDE,
> This is something we tried but ended up disabling as
> DBUS would sometimes hang for 5+ seconds on startup.
> Given we didn't use DBUS for anything else,
> it seemed simplest to disable.
Things should never hang like that, so this is likely a bug somewhere
that should be fixed, if it hasn't already. There was issues like this
at the beginning of xdg-desktop-portal 1.16, but I believe they were
ironed out already. If you still see issues like this, please file bugs.
If part of the motivation is accessibility, then you might still need to
use what I assume is the portal settings API, to get other accessibility
related settings e.g. whether to use high contrast theming, larger font
sizes, etc, not to mention just general appearance settings, e.g.
dark/light mode.
>
> Even if this could be made to work it seems like a weak solution
> that every application needs to read desktop specific settings from
> GNOME/KDE/XFCE/Cosmic... etc.
I think this would be trivial to fix. I filed
https://github.com/flatpak/xdg-desktop-portal/pull/1539 for it.
Adding a Wayland protocol would scatter appearance settings into
multiple places, which isn't ideal.
Jonas
>
>
> Proposal
> ========
>
> It would be useful if there was a protocol for accessing the theme/size.
> With the added benefit that run-time changes could be accounted for.
>
> If well documented, applications would have a shared method of accessing &
> showing the cursor size.
>
> Here is a rough outline for the protocol
> (name could be cursor-geometry-v1 or similar).
>
> ```
> /* Preferred callbacks: */
> preferred_theme(seat, const char *cursor_theme);
> preferred_size(seat, int cursor_size);
>
> /* Apply changes requested by `preferred_*` functions. */
> configure(seat);
> ```
>
> Notes:
>
> - There could be other things to configure,
> added as new `preferred_*` callbacks as needed.
>
> - The theme & size would roughly map to:
> `XCURSOR_THEME` & `XCURSOR_SIZE`.
>
> - These callbacks would run after registering the "seat",
> before registering "pointers",
> so the values can be used for applications on startup
> (to avoid flickering caused by cursor changes on startup).
>
> - Changes to the cursor theme/size (GNOME/KDE... etc)
> should also re-configure the cursor.
>
> - The size from `preferred_size` would *not* have
> scale/fractional-scaling applied so it's up to the client
> to scale the `cursor_size` based on the output scale.
>
> The reason not to apply output scaling
> users may move the cursor between outputs,
> meaning this call back would have to run much
> more frequently on systems with outputs with different scaling.
>
> While it could be made to work I believe it complicates
> using the protocol unnecessarily.
>
> The docs should provide the method of applying
> fractional scaling so cursor size doesn't
> change between applications).
>
> - The *level* this protocol applies to is an open topic.
> Per "seat" seems logical to me, there may be some argument
> that this should be per: "pointer", "tablet" although I can't
> see a good reason to do that.
>
> Regards,
> - Campbell
>
> [0]: https://projects.blender.org/blender/blender/issues/105895
More information about the wayland-devel
mailing list