Skip to content

cursor-sprite-xcursor: Emulate Wayland hotspot limitations

Jonas Ådahl requested to merge jadahl/mutter:wip/fix-1px-cursor-shift into master

For HiDPI pointer cursors backed by Wayland surfaces, the hotspot must be placed using integers on the logical pixel grid. In practice what this means is that if the client loads a cursor sprite with the buffer scale 2, and it's hotspot is not dividable by 2, it will be rounded down to an integer that can. E.g. a wl_surface with buffer scale 2 and a cursor image with hotspot coordinate (7, 7) will have the coordinate (3.5, 3.5) in surface coordinate space, and will in practice be rounded down to (3, 3) as the hotspot position in wl_pointer only takes integers.

To not potentially shift by 1 pixel on HiDPI monitors when switching between wl_surface backend cursor sprites and built-in ones, make the built in one emulate the restrictions put up by the Wayland protocol.

This also initializes the theme scale of the xcursor sprite instances to 1, as they may not have been set prior to being used, it'll only happen in response to "prepare-at" signals being emitted prior to rendering.

Fixes: #1094 (closed)

Merge request reports

Loading