Skip to content

wayland: Fix loading of HiDPI cursors

Vlad Zahorodnii requested to merge work/hidpi-cursor into master

Xcursors don't support hidpi so if a hidpi cursor is needed, kwin will scale the desired size by the scale factor and ask Xcursor helpers to load a theme with the given name and the size.

However, the theme loading code doesn't take into account that Xcursor theme loading helpers may not return cursor sprites of size size * scale if the theme has no such a size.

For example, if the cursor theme only provides 24, 36, and 48 sizes and kwin attempts to load cursors of size 48 with a scale factor of 2, we will get cursors of size 48 instead of 96. Unfortunately, this will result in the issue where the cursor shrinks when hovering decorations because kwin doesn't know that the effective scale factor (1) is different from the requested scale factor (2).

In order to fix loading of HiDPI cursors, we need to approximate the effective scale factor of every cursor sprite as we load it.

Merge request reports