Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wayland: ensure at least a scale factor of 1 when drawing cursor
With the addition of fractional scaling support, wl->scaling was converted to a double. Some compositors (Plasma) can report values under 1 for fractional scaling, so this meant wl->scaling could be some small fractional value. This is fine except that when using the legacy code for drawing the mouse cursor (i.e. not the cursor-shape protocol), it still uses the old integer scaling method in core wayland. The reason for this is simply because fractionally scaling the mouse cursor surface is nonsense and nobody even has cursor images for anything besides a select few sizes anyways (32x32, 48x48, etc.). The existing integer scaling sort of works but it's pretty bad too and you can get some weird sizes anyway. This is why cursor-shape is preferred since it fixes this. Anyways, since buffer scaling for the cursor only takes integers, there could be truncation to 0 in the previously mentioned fractional scale this. This naturally causes the compositor to send us an error and mpv quits. The fix is to always make sure that the scale value used for the cursor is at least 1. Anything less makes no sense. Fixes #12309.
- Loading branch information