Mouse not working properly on versions 15.x and 16.x

Hello there.

I’ve found a bug: On some screens the mouse won’t work properly on newer Kodi versions. Here is the data I’ve collected so far:

Control Group:
C1: OpenELEC 5.0.8 / Kodi 14.2 on RPi 2 / Logitech M185 -> LibreELEC 7.0.2 / Kodi 16.1
C2: OpenELEC 5.0.8 / Kodi 14.2 on RPi 2 / Logitech M305 -> OpenELEC 6.0.3 / Kodi 15.2

Manifesting:
M1: OpenELEC 6.0.3 / Kodi 15.2 on RPi B / A4Tech 53J
M2: OSMC 2016.09-1 / Kodi 16.? on RPi 2 / Microsoft M1000
M3: OpenELEC 6.95.3 / Kodi 16.1 on RPi 2 / Microsoft M1000

C1 and C2 started to manifest the problem after the update as described.

Description:
On some screens, most notably when the on-screen keyboard is displaying, the mouse cursor will either disappear, freeze, or update its position at very low rates (each 5 seconds or more). The problem seems to be somewhat skin-dependent, while all skins have caused the problem to some degree, of all skins tested, none of them were immune to the issue:

C1: Amber, AppTV, Confluence, Arctic: Zephyr, Re-Touched, ReFocus, Transparency!, Unity
C2: AppTV, Confluence, Transparency!
M1: Confluence, AppTV
M2: OSMC Skin, Confluence
M3: Confluence

Apparently the problem occurs when there are either too many button UI objects on screen or/and too many overlaying dialogues, for example when you’re configuring a media type for a source(*1), however, an important exception is the OSMC Skin which has an usable on-screen keyboard, although it manifests the problem elsewhere. A significant note is that while the cursor doesn’t respond adequately to the mouse movement, the UI objects will still highlight normally, as if there was an ‘invisible’ cursor hovering them.

*1: For example, that dialog where you can change the language for the TVDB scraper.

Since the problem apparently is broad (Pi or Pi 2, 3 different systems, apparently any 15.x or 16.x version, and any skin), I think reproducibility won’t be a problem. Basically if you plug a mouse in your Pi running Kodi and try to enter text using the on-screen keyboard, chances are you’re going to see the problem.

I guess it’s safe to assume it’s not distro-specific but I don’t have enough data to predict an extent. Maybe trying Kodi on Raspbian and confirming non-reproducibility on x86 Linux systems could provide valuable data for further diagnostics.

I hope this is useful somehow.

Thank you.