Proper scaling of cursors

Olivier Fourdan ofourdan at redhat.com
Thu Dec 14 09:39:59 UTC 2023


Hi Maxim,


On Thu, Dec 14, 2023 at 10:19 AM Maxim Kartashev <
maxim.kartashev at jetbrains.com> wrote:

> I'd like to pick your brains on a Wayland problem that does not look
> solvable to me.
>
> In Wayland, where (in general) there are no server-side decorations, the
> application is responsible for taking care of its own frame, which includes
> changing the mouse cursor when it is above or near the border to indicate
> that the window can be resized.
>
> Now consider a set-up with two monitors, one with 100% scale and the other
> with 200% scale. Suppose a window is stretched between two of them. The
> window is aware of all the monitors it is displayed on, but is not aware
> which part is showing where. How is the application supposed to determine
> what would be the right scale for the mouse cursor's surface buffer?
>
> If the highest scale is chosen, the cursor will look larger than necessary
> on the 100% monitor; this is what we've currently implemented and it
> differs from how the "native" Wayland applications behave.
>

If you render a cursor at scale 2x and set the surface scale accordingly,
the compositor has all it needs to render properly. Similarly, if your
client is not capable of hidpi, the cursor will be rendered at scale 1x
with a surface scale 1 and the compositor will be able to scale that cursor
image up when placed on the hidpi monitor.

HTH
Cheers
Olivier
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/wakefield-dev/attachments/20231214/5cd4f5a7/attachment.htm>


More information about the wakefield-dev mailing list